设置root用户的密码
sudo passwd root 回车
设置root用户的密码(使用root账户)
安装yum
sudo apt-get update
sudo apt install yum
Linux系统(Ubuntu)中使用国内的源地址
- 源地址列表文件路径
ubuntu系统的源列表配置文件的路径是:/etc/apt/ sources.list
为了在替换前留个备份,可以执行命令做个备份:
cp /etc/apt/sources.list /etc/apt/sources.list-bak
- 源地址列表文件的替换
不同的版本,sources.list里的url是不同的,主要是版本好不一样,例如ubuntu14.04的代号是trusty ,而ubuntu16.04是 xenial。
具体查看方法是执行命令:lsb_release -a 回车
返回的Codename就是版本代号
如图:
ubuntu14.04版本
将/etc/apt/ sources.list的内容替换为:
deb http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe
替换后执行命令: sudo apt-get update
ubuntu16.04版本
将/etc/apt/ sources.list的内容替换为:
deb http://mirrors.aliyun.com/ubuntu/ xenial main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main multiverse restricted universe
替换后执行命令: sudo apt-get update
出现apt-get: Package has no installation candidate问题
apt-get update
apt-get upgrade
apt-get install <packagename>
- 添加第三方地址:
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update