Ubuntu 16.04 LTS 64位安装rar提示‘E: Unable to locate package rar’如何解决?
Hey there! Let's break down why you're hitting this error and get rar installed smoothly.
First off, the root cause here is that the rar package lives in Ubuntu's universe repository—a community-maintained software source that isn't enabled by default on older releases like 16.04. That's why apt-get can't find it when you try to install directly.
Let's fix this step by step:
- First, update your local package list to ensure
apthas the latest repo info:sudo apt-get update - Next, enable the universe repository (this is the missing piece):
sudo add-apt-repository universe - Run the update command again to pull in package data from the newly enabled repo:
sudo apt-get update - Now you can install rar without any issues:
sudo apt-get install rar
To clear up your confusion about apt-get and the Ubuntu Software Center: they’re two interfaces for the same underlying system. apt-get is the command-line tool, while the Software Center is the graphical frontend. Both pull software from the same configured repositories—sometimes the Software Center will auto-prompt you to enable missing repos, which is why some folks don’t run into this problem.
Other users can install rar directly because their systems already have the universe repository enabled—either it was turned on by default during setup, or they enabled it for another package earlier.
内容的提问来源于stack exchange,提问作者Zach Smith

