沙滩星空的博客沙滩星空的博客

Debian9和Ubuntu更改apt软件源

软件包管理是区分不同发行版的一大特征,如RedHat使用RPM软件包来管理软件,Debian使用Deb软件包来管理软件。apt-get是Debian的Deb软件包管理工具,它的最低底层还是调用dpkg包管理程序,通过apt-get工具可使我们很好地解决软件包的依赖关系,方便软件的安装和升级。

要使用好apt-get就要配置好一个名为sources.list的资源列表,资源列表指向Debian系统的软件库,apt-get会从该软件库安装各种软件包。
软件包源配置文件路径:

/etc/apt/sources.list

文件内容如下:

#deb-src http://debian.cn99.com/debian/ etch main
deb http://mirrors.163.com/debian/ stable main
deb-src http://mirrors.163.com/debian/ stable main</span>

说明:
deb/deb_src 表示获取安装包和源代码
http://mirrors.163.com/debian/ 国内一般使用这个,Debian软件资源库
stable 表示Debian系统的版本类型。stable/testing/unstable 三种

我们只需在执行 apt-get update命令之前,将我们编写好的包源的配置文件进行替换就行了.

备份旧的配置文件

mv /etc/apt/sources.list /etc/apt/sources.list.bak

替换为我们自定义的配置文件

mv sources.list /etc/apt/

包源替换完毕,执行更新

apt-get update

测试一下安装个VIM和一些lib依赖包:

aptitude install vim
apt-get install libicu-dev
apt-get install libqt4-opengl libqt4-opengl-dev

使用网易包源的配置文件:

deb http://mirrors.163.com/debian/ stretch main non-free contrib
deb http://mirrors.163.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.163.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib
deb-src http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib

阿里云包源配置文件:

deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb http://mirrors.aliyun.com/debian-security stretch/updates main
deb-src http://mirrors.aliyun.com/debian-security stretch/updates main
deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib

中科大源

deb http://mirrors.ustc.edu.cn/debian stable main contrib non-free
# deb-src http://mirrors.ustc.edu.cn/debian stable main contrib non-free
deb http://mirrors.ustc.edu.cn/debian stable-updates main contrib non-free
# deb-src http://mirrors.ustc.edu.cn/debian stable-updates main contrib non-free
# deb http://mirrors.ustc.edu.cn/debian stable-proposed-updates main contrib non-free
# deb-src http://mirrors.ustc.edu.cn/debian stable-proposed-updates main contrib non-free

main - 提供了 Debian 官方主要的软件。这些软件都符合 Debian Free Software Guideline(DFSG),并会包括在官方安装光盘中。
contrib -提供了因为依靠了一些在Non-free组别套件 (即不符合Debian Free Software Guideline) 的套件。
non-free -提供非自由软件的套件。这些软件都未能符合Debian Free Software Guideline(DFSG) 。


阿里云官方镜像站 https://developer.aliyun.com/mirror/
清华大学开源软件镜像站 https://mirror.tuna.tsinghua.edu.cn/help/debian/
中国科技大学Debian源 http://mirrors.ustc.edu.cn/help/debian.html
Debian 9 Stretch国内常用镜像源https://www.cnblogs.com/liuguanglin/p/9397428.html
更改debian的软件源sources.list https://www.cnblogs.com/coding-my-life/p/3749871.html
Docker实用技巧之更改软件包源提升构建速度 https://www.cnblogs.com/stulzq/p/9339250.html

未经允许不得转载:沙滩星空的博客 » Debian9和Ubuntu更改apt软件源

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址