配置 Debian Stretch 的安装源

· · 743 次点击 · · 开始浏览    
这是一个创建于 的文章,其中的信息可能已经有所发展或是发生改变。
采用最小化方式安装的 Debian,在没有接入网络的情况下,默认是没有配置 apt 安装源,也没有安装远程管理用的 SSH 服务的,这个时候就无法使用 apt-get install 在线安装软件的,为使用带来不便。以下为大家提供几个 Debian Stretch 的 apt-get 源配置,详细有不好爱好者在使用 Stretch 时会遇到这个问题。

配置apt-get源

在开始配置新的 apt 源之前,可以先备份原有的安装文件,命令如下:

cp /etc/apt/sources.list /etc/apt/sources.list.backup

更新 apt 源配置文件

使用以下命令,重写整个配置文件即可:

cat  > /etc/apt/sources.list <<END
deb http://mirrors.163.com/debian/ stretch main
deb http://mirrors.163.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib
deb http://httpredir.debian.org/debian stretch-backports main contrib non-free
END

配置文件更新后,即可开始更新源的meta信息了。

sudo apt-get clean all && apt-get update 
sudo apt-get upgrade #更新系统

我们也可以使用阿里云的 Debian Stretch 源,具体的配置如下:

cat > /etc/apt/sources.list <<END
deb http://mirrors.aliyun.com/debian stretch main contrib non-free
deb http://mirrors.aliyun.com/debian stretch-proposed-updates main contrib non-free
deb http://mirrors.aliyun.com/debian stretch-updates main contrib non-free

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

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

deb-src http://mirrors.aliyuncs.com/debian stretch main contrib non-free
deb-src http://mirrors.aliyuncs.com/debian stretch-proposed-updates main contrib non-free
deb-src http://mirrors.aliyuncs.com/debian stretch-updates main contrib non-free

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

Debian Stretch发布的细节,可以参考这里

关注本站微信公众号(和以上内容无关)InfraPub ,扫码关注:InfraPub

743 次点击  
加入收藏 微博
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传