采用最小化方式安装的 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发布的细节,可以参考这里。
文章末尾固定信息
继续阅读
1F
/etc/apt/source.list是不是少了一个s??不是/etc/apt/sources.list吗?
B1
@ kk 的确,是否手写错误,已经更正