对于下载缓慢的问题,可能就是源的问题,还是国内的源快啊,真香!
查看源
ll /etc/yum.repos.d
CentOS-Base.repo:在线的yum源配置文件
CentOS-Media.repo:本地yum源配置文件
cd /etc/yum.repos.d
cat CentOS-Base.repo
如果是我这样就是阿里的源
[base]
name=CentOS-$releasever
enabled=1
failovermethod=priority
baseurl=http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.cloud.aliyuncs.com/centos/RPM-GPG-KEY-CentOS-7
[updates]
name=CentOS-$releasever
enabled=1
failovermethod=priority
baseurl=http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.cloud.aliyuncs.com/centos/RPM-GPG-KEY-CentOS-7
[extras]
name=CentOS-$releasever
enabled=1
failovermethod=priority
baseurl=http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.cloud.aliyuncs.com/centos/RPM-GPG-KEY-CentOS-7
如果不是,建议备份下再换源
cp CentOS-Base.repo CentOS-Base.repo.bak
查看可用的yum源: yum repolist
阿里云的源发现不好用了,来更新下源
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
yum安装软件:
yum list | grep 软件名 //查看软件
yum install 软件 -y //安装
下载依赖包 到指定位置
yum install yum-plugin-downloadonly erlang --downloaddir=/root/mypackages/
yum install --downloadonly --downloaddir=<directory> <package-name>
yum install --downloadonly --downloaddir=/root/mypackages/ nginx
yum install --downloadonly --downloaddir=/home/mypackages/ epel-release