- 选择docker版本:
docker ce:免费
docker ee :商业 - 查看操作系统版本
[root@Grafana ~]# cat /etc/redhat-release CentOS仅在7.0版本之后支持docker运行
CentOS Linux release 7.8.2003 (Core)
- 设置yum源
# 更换成aliyun yum源
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
#curl 是发出网络请求,然后获取数据,显示在"标准输出"(stdout)上面,加上 -o 文件名 可以将获取的数据保存到文件中
# 编译CentOS-Base.repo,把带mirrors.aliyuncs.com的行都删除
vi /etc/yum.repos.d/CentOS-Base.repo
# 运行以下命令生成缓存
yum clean all
yum makecache
# 查看已启用的repo,确保centos-extras repository是启用了,安装docker时需要
yum repolist
#--------------------------------------------------------------------------
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
repo id repo name status
base/7/x86_64 CentOS-7 - Base - mirrors.aliyun.com 9,591
extras/7/x86_64 CentOS-7 - Extras - mirrors.aliyun.com 284
updates/7/x86_64 CentOS-7 - Updates - mirrors.aliyun.com 1,540
repolist: 11,415
#--------------------------------------------------------------------------
#更新当前系统已安装的所有yum源
yum update
yum源相关文件介绍:
文件/etc/yum.conf
[main]
cachedir=/var/cache/yum #yum下载的RPM包的缓存目录
keepcache=0 #缓存是否保存,1保存,0不保存。
debuglevel=2 #调试级别(0-10),默认为2(具体调试级别的应用,我也不了解)。
logfile=/var/log/yum.log #yum的日志文件所在的位置
exactarch=1 #在更新的时候,是否允许更新不同版本的RPM包,比如是否在i386上更新i686的RPM包。
obsoletes=1 #这是一个update的参数,具体请参阅yum(8),简单的说就是相当于upgrade,允许更新陈旧的RPM包。
gpgcheck=1 #是否检查GPG(GNU Private Guard),一种密钥方式签名。
plugins=1 #是否允许使用插件,默认是0不允许,但是我们一般会用yum-fastestmirror这个插件。
installonly_limit=3 #允许保留多少个内核包。
exclude=selinux* #屏蔽不想更新的RPM包,可用通配符,多个RPM包之间使用空格分离。
目录/etc/yum.repos.d/
[root@610 ~]# cd /etc/yum.repos.d/
[root@610 yum.repos.d]# ll
total 36
-rw-r--r--. 1 root root 1664 Nov 23 2018 CentOS-Base.repo_bk
-rw-r-