linux更换源

1、ubuntu 更换源

以ubuntu16.04为例

(1)cp /etc/apt/sources.list /etc/apt/sources.list.bak           //备份系统原有的源

(2)vi /etc/apt/sources.list       //将文件内容改为如下对应需要的源的内容

阿里源:
# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse


网易163源:

deb http://mirrors.163.com/ubuntu/ xenial main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse

(3)sudo apt-get update       //更新源

(4)sudo apt-cache search 命令   //当不知道对应命令需要下载的软件包的名称时,可以使用该命令进行查找  ,如 sudo apt-cache search xfreerdp

(5)sudo apt-get install 软件名     //下载对应的软件 , 如sudo apt-get install freerdp


2、Centos 更换源

以centos7.2为例

(1) cd  /etc/yum.repos.d       //进入yum源配置文件所在文件夹
(2) mv  CentOS-Base.repo  CentOS-Base.repo.bak      //备份原有的源文件
(3) 下载对应的yum源文件
    163源:wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
    阿里源:wget http://mirrors.aliyun.com/repo/Centos-7.repo
    将文件改名为 :CentOS-Base.repo
(4) yum  clean  all           //清理缓存
(5) yum  makecache         //重新生成缓存
(6) yum  -y  update         //更新系统
(7) yum  -y  install  软件名     //下载对应的软件 , 如yum -y install vim

展开阅读全文

没有更多推荐了,返回首页