新安装的Linux系统-阿里云开发者社区

开发者社区> 开发与运维> 正文

新安装的Linux系统

简介: 设置root用户的密码 sudo passwd root 回车 设置root用户的密码(使用root账户) 安装yum sudo apt-get updatesudo apt install yum Linux系统(Ubuntu)中使用国内的源地址 ...

设置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就是版本代号

如图:


img_fd955c496dcae4b16c7040f2e9d946ee.png
image.png

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

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

分享:
开发与运维
使用钉钉扫一扫加入圈子
+ 订阅

集结各类场景实战经验,助你开发运维畅行无忧

其他文章