linux各安装源修改成阿里源

linux各个版本对应的阿里安装源

apt

sudo cp /etc/apt/source.list /etc/apt/source.list.bak       # 将原有的源文件复制保存
sudo vim /etc/apt/source.list                               # 打开源文件
# 将下列的复制到文件中
deb http://mirrors.aliyun.com/ubuntu/ vivid main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ vivid-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ vivid-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ vivid-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ vivid-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ vivid main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ vivid-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ vivid-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ vivid-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ vivid-backports main restricted universe multiverse
# 跟新apt
sudo apt update     
sudo apt upgrade

yum

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bakup        # 复制原有的源文件
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo              # 通过wget获取阿里云的源文件
yum clean all                                   # 清除缓存
yum makecache                                   # 生成缓存

pip

mkdir .pip              #目标目录下创建.pip文件
sudo vim .pip/pip.conf  #创建pip.conf文件
# 将下面的写入文件中 
    [global]
        index-url = http://mirrors.aliyun.com/pypi/simple/
    [install] 
        trusted-host=mirrors.aliyun.com

  • linux各个版本对应的阿里安装源
      • apt
      • yum
      • pip

你可能感兴趣的:(Linux)