Docker安装yum,vim

1.没有yum命令

添加国内镜像

mv /etc/apt/sources.list /etc/apt/sources.list.bak
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

更新apt-get指令

apt-get update

安装yum命令

apt-get install yum

安装vim命令

apt-get install vim

添加ls命令

vim ~/.bashrc

在最后一行添加

alias ll='ls $LS_OPTIONS -l'

使之生效

source ~/.bashrc
安装ping指令为            apt-get install iputils-ping;
​
安装ifconfig指令为      apt-get install net-tools,
​
以此类推,安装你需要的工具。

 

安装完yum不能运行

 

root@3c7c47822bf0:/var/plugin# yum -y install fontconfig libX11 libXext libXrender libjpeg openssl xorg-x11-fonts-75dpi xorg-x11-fonts-Type1 && rpm -ivh wkhtmltox-0.12.5-1.centos7.x86_64.rpm
There are no enabled repos.
 Run "yum repolist all" to see the repos you have.
 You can enable repos with yum-config-manager --enable 

解决办法:

运行

yum repolist all

结果

root@3c7c47822bf0:/var/plugin# yum repolist all
repolist: 0

运行

yum -y install yum-utils

不能运行yum -y install yum-utils,返回以下错误

root@3c7c47822bf0:/var/plugin# yum -y install yum-utils
There are no enabled repos.
 Run "yum repolist all" to see the repos you have.
 You can enable repos with yum-config-manager --enable 

文件目录看好,我的是在docker 容器了里遇到的,文件目录是:

/etc/yum/repos.d/

执行ls /etc/yum/repos.d/命令查看, /etc/yum/repos.d/目录下为空

 

如果yum -y install yum-utils不能运行先试着更换yum源:

wget -O /etc/yum/repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

或者

curl -o /etc/yum/repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

执行ls /etc/yum/repos.d/命令查看,CentOS-Base.repo下载完成

root@3c7c47822bf0:/var/plugin# ls /etc/yum/repos.d/
CentOS-Base.repo

运行命令生成缓存

yum clean all
yum makecache

执行yum makecache出现以下错误:

root@3c7c47822bf0:/var/plugin# yum makecache
http://mirrors.aliyun.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
http://mirrors.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: (28, 'Connection timed out after 30001 milliseconds')
Trying other mirror.
http://mirrors.cloud.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Could not resolve host: mirrors.cloud.aliyuncs.com"
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again

编辑/etc/yum/repos.d/CentOS-Base.repo文件,将文件中的$releasever变量都改为7

vim /etc/yum/repos.d/CentOS-Base.repo

将文件中的$releasever变量都改为7

:%s/$releasever/7/g

 

你可能感兴趣的:(Docker)