[转帖]ubuntu 修改 apt源的方法

https://www.cnblogs.com/dadonggg/p/11129973.html

ubuntu 和 centos 是不一样的

ubunut 里面 用deb开头 放置到 /etc/apt/sources.list 里面

centos 是在 /etc/yum.repos.d/xxxx.repo 里面

主要 [name]
name
baseurl
enable
gpgcheck
等字段

以Ubuntu18.04为例:

1. 备份原有软件源文件

cp /etc/apt/sources.list /etc/apt/sources.list.bak_yyyymmdd

2. 打开sources.list文件,在文件末尾增加如下软件源地址

vi /etc/apt/sources.list

追加如下地址:

#添加阿里源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

3. 更新系统软件源

执行命令,更新系统软件源地址

apt-get update
apt-get upgrade

4. 其他软件源

中科大源
##中科大源
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

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

清华源
##清华源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

原文地址:https://www.cnblogs.com/jinanxiaolaohu/p/11444509.html

时间: 2024-11-09 03:38:26

[转帖]ubuntu 修改 apt源的方法的相关文章

更改 Ubuntu 的 apt 源

1.在更改apt源之前要先备份官方自带的apt源 cd /etc/apt sudo cp sources.list sources.list.bak 2. 更改 sources.list 文件 sudo gedit sources.list  或者 sudo vim sources.list 3.一些 国内的 apt 源 香港中文大学: deb http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty main restricted universe mul

ubuntu的apt源

修改文件:/etc/apt/sources.list 内容如下: # 电子科大(教育网用户推荐) deb http://ubuntu.uestc.edu.cn/ubuntu/ precise main restricted universe multiverse deb http://ubuntu.uestc.edu.cn/ubuntu/ precise-backports main restricted universe multiverse deb http://ubuntu.uestc.e

Ubuntu修改环境变量PATH方法

在LINUX安装一些软件通常要添加环境变量.环境变量通俗的讲就是把程序的路径"备案"到系统中,这样执行这些程序时就不需要输入完整路径,直接在bash输入程序名就可以执行.比如常用的ls命令就是添加好了环境变量才可以直接执行ls 环境变量的名字是PATH,$符号用于读取变量的值,终端输入echo $PATH返回如下,各路径用:隔开 echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/ga

ubuntu如何修改IP地址、和apt源

新安装的ubuntu没有vim,使用vi修改自己的IP地址 [email protected]:~# cat /etc/network/interfaces # interfaces(5) file used by ifup(8) and ifdown(8) auto lo iface lo inet loopback auto ens3 iface ens3 inet static address 192.168.200.7 netmask 255.255.255.0 gateway 192.

Ubuntu 16.1 更改apt源

1 修改apt源配置文件,把/etc/apt/sources.list替换为以下内容: sudo gedit /etc/apt/sources.list deb http://mirrors.163.com/ubuntu/ precise main restricted deb-src http://mirrors.163.com/ubuntu/ precie main restricted deb http://mirrors.163.com/ubuntu/ precise-updates m

ubuntu和win10下修改pip源

ubuntu修改pip源1.在home下创建.pip目录:mkdir ~/.pip 2.创建pip.conf文件: gedit ~/.pip/pip.conf 3. 在pip.conf文件添加如下内容(更换为清华大学镜像源): [global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple 保存退出即可: win10下的修改方法为: pip install pip -U pip config set global.index-url h

Ubuntu 18.04 更换apt源

1.备份apt源 cp /etc/apt/sources.list /etc/apt/sources.list.bak 2.修改apt源 sudo gedit /etc/apt/sources.list 3.删除所有,添加阿里源 #添加阿里源 deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-se

连接不上cn.archive.ubuntu.com软件源问题

问题描述:无法连接上cn.archive.ubuntu.com软件源 解决方法:更换软件源,进入源列表中,执行sudo vim /etc/apt/sources.list ,将cn.archive.ubuntu.com替换为其它的源,ubuntu 16.04版本可替换的源参看下图,其它版本可进入http://wiki.ubuntu.org.cn/%E6%BA%90%E5%88%97%E8%A1%A8查询不同版本的ubuntu系统对应的源列表 替换完成后,刷新下载列表,执行sudo apt-get

ubuntu笔记 - 修改软件源

Ubuntu软件源的修改比较简单,一种方法是直接修改软件软列表:只需要把所需的软件源添加到或直接替换原来的系统源列表就可以,列表文件就是/etc/apt/sources.list .在终端执行以下命令: #进入所在目录: cd /etc/apt/ #备份源列表: sudo cp sources.list sources.list.bak #编辑源列表: sudo gedit /etc/apt/sources.list 如果希望把某一个软件源添加到列表,则只需要一个命令就好,比如在Ubuntu上安