--------------------------------------------------------------------------------------------------------- ##
关闭防火墙和selinux
[root@manager ~]# systemctl stop firewalld && systemctl disable firewalld
[root@manager ~]# sed -i ‘/^SELINUX=/s/enforcing/disabled/’ /etc/selinux/config
[root@manager ~]# setenforce 0
--------------------------------------------------------------------------------------------------------- ##
设置时间同步
[root@manager ~]# timedatectl set-timezone Asia/Shanghai # 可修改时区为上海+08时区
[root@manager ~]# timedatectl # 获取系统时间和时区
[root@manager ~]# yum install ntp -y # 安装ntp时间服务器
[root@manager ~]# sed -i ‘s/server 0.centos.pool.ntp.org iburst/server ntp1.aliyun.com iburst/’ /etc/ntp.conf # 使用aliyun NTP服务
[root@manager ~]# sed -i ‘/1.centos.pool.ntp.org/s/^/#/’ /etc/ntp.conf
[root@manager ~]# sed -i ‘/2.centos.pool.ntp.org/s/^/#/’ /etc/ntp.conf
[root@manager ~]# sed -i ‘/3.centos.pool.ntp.org/s/^/#/’ /etc/ntp.conf
[root@manager ~]# systemctl start ntpd && systemctl enable ntpd # 启动ntp时间服务并设置开机启动
--------------------------------------------------------------------------------------------------------- ##
安装常用软件:
[root@manager ~]# yum -y install vim wget net-tools lrzsz telnet bind-utils bash-completion
#删除旧版docker
[root@localhostsshd]# yum remove docker
docker-client
docker-client-latest
docker-common
docker-latest
docker-latest-logrotate
docker-logrotate
docker-engine
#下载 yum工具包
[root@localhostsshd]# yum install -y yum-utils
#设置docker仓库
[root@localhostsshd]# yum-config-manager
–add-repo
https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
#安装docker
[root@localhostsshd]# yum -y install docker-ce docker-ce-cli containerd.io
#启动docker并设置开机自启
[root@localhostsshd]# systemctl start docker && systemctl enable docker
#查看安装的docker版本
[root@localhostsshd]# docker version
#运行hello-world镜像
[root@localhostsshd]# docker run hello-world