Docker容器里无法使用Xxx命令

Linux系统 apt-get 命令的使用:安装、更新、卸载软件包:https://blog.csdn.net/xietansheng/article/details/80044644


1 更新apt-get

1.1 查看所用的源

vim /etc/apt/sources.list

# deb http://snapshot.debian.org/archive/debian/20191224T000000Z stretch main
deb http://deb.debian.org/debian stretch main
# deb http://snapshot.debian.org/archive/debian-security/20191224T000000Z stretch/updates main
deb http://security.debian.org/debian-security stretch/updates main
# deb http://snapshot.debian.org/archive/debian/20191224T000000Z stretch-updates main
deb http://deb.debian.org/debian stretch-updates main

1.2 备份原来的源

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

1.3 修改为国内源

echo "" > /etc/apt/sources.list
echo "deb http://mirrors.163.com/debian/ jessie main non-free contrib" >> /etc/apt/sources.list
echo "deb http://mirrors.163.com/debian/ jessie-proposed-updates main non-free contrib" >> /etc/apt/sources.list
echo "deb-src http://mirrors.163.com/debian/ jessie main non-free contrib" >> /etc/apt/sources.list
echo "deb-src http://mirrors.163.com/debian/ jessie-proposed-updates main non-free contrib" >> /etc/apt/sources.list

> 输出重定向

>> 输出追加重定向

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

1.4 更新apt软件源

apt-get update

2 下载对应的Xxx即可

apt-get install vim
apt-get install tree
apt-get install yum

 https://blog.csdn.net/huangbaokang/article/details/98029026

发布了515 篇原创文章 · 获赞 97 · 访问量 108万+

猜你喜欢

转载自blog.csdn.net/qq_40794973/article/details/103984182