调试 redmine 的 docker 镜像时没有 VIM 很不方便,看到此 docker 是基于 debian buster 的,所以更换一下国内源来安装。

软件源如下:

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

备份/etc/apt/sources.list
#备份
cp /etc/apt/sources.list /etc/apt/sources.list.bak
在/etc/apt/sources.list 文件,注释原文件所有内容,前面添加上面的条目。
添加方式可以用 echo "" >> sources.list 来完成

echo "deb http://mirrors.aliyun.com/debian/ buster main non-free contrib" >> sources.list
echo "deb-src http://mirrors.aliyun.com/debian/ buster main non-free contrib" >> sources.list
echo "deb http://mirrors.aliyun.com/debian-security buster/updates main" >> sources.list
echo "deb-src http://mirrors.aliyun.com/debian-security buster/updates main" >> sources.list
echo "deb http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib" >> sources.list
echo "deb-src http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib" >> sources.list
echo "deb http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib" >> sources.list
echo "deb-src http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib" >> sources.list

添加完后

apt update
apt install VIM

/etc/apt/sources.list 是包管理工具 apt 所用的记录软件包仓库位置的配置文件
其中,deb:档案类型为二进制预编译软件包,一般我们所用的档案类型。
deb-src:档案类型为用于编译二进制软件包的源代码

宝剑锋从磨砺出,梅花香自苦寒来.