一、centos7
1、网络配置
vim /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
BOOTPROTO=static
NAME=ens33
UUID=57591f6d-ca91-45f1-9e32-4446607bb548
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.0.186
PREFIX=16
GATEWAY=192.168.0.1
DNS1=114.114.114.114
DNS2=8.8.8.8
重启网络服务
/etc/init.d/network restart
2、关闭防火墙
setenforce 0
sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config
systemctl stop firewalld
systemctl disable firewalld
3、替换阿里源
yum install wget vim -y
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
4、安装epel源
yum install -y epel-release
5、安装基础命令
yum install -y wget vim lrzsz net-tools bzip2 unzip
6、同步网络时间
yum -y install ntp && systemctl enable ntpd && systemctl start ntpd && ntpdate -u cn.pool.ntp.org && hwclock -w
7、安装docker
其他服务安装可能需要卸载老版本
yum update -y
yum remove docker docker-common docker-selinux docker-engine -y
安装需要的软件包, yum-util 提供yum-config-manager功能,另外两个是devicemapper驱动依赖的
yum install -y yum-utils device-mapper-persistent-data lvm2
设置yum源
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
可以查看所有仓库中所有docker版本,并选择特定版本安装
yum list docker-ce --showduplicates | sort -r
[root@kubem1 yum.repos.d]# yum list docker-ce --showduplicates | sort -r
已加载插件:fastestmirror
可安装的软件包
* updates: mirrors.aliyun.com
Loading mirror speeds from cached hostfile
* extras: mirrors.aliyun.com
* epel: mirrors.aliyun.com
docker-ce.x86_64 3:18.09.7-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.6-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.5-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.4-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.3-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.2-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.1-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.0-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.3.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.2.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.1.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.0.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.03.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 18.03.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.12.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.12.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.09.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.09.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.06.2.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.06.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.06.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.3.ce-1.el7 docker-ce-stable
docker-ce.x86_64 17.03.2.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.0.ce-1.el7.centos docker-ce-stable
yum install -y docker-ce-18.09.7-3.el7.x86_64.rpm
二、centos6
1、网络配置
vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:0C:29:9E:54:CD
TYPE=Ethernet
UUID=9e703f69-cb41-41e6-be61-5f766c15f17d
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.0.168
PREFIX=16
GATEWAY=192.168.0.1
DNS1=114.114.114.114
DNS2=8.8.8.8
重启网络服务
/etc/init.d/network restart
2、关闭防火墙
setenforce 0
sed -i '/SELINUX/s/permissive/disabled/' /etc/selinux/config
service iptables stop
service iptables enable
chkconfig iptables off
3、替换阿里源
yum install wget -y
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
wget /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
4、安装epel源
yum install -y epel-release
5、同步网络时间
yum -y install ntp && chkconfig ntpd on && service ntpd start && ntpdate -u cn.pool.ntp.org && hwclock -w
6、centos 6 安装docker最新版
导入elrepo的key
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
安装elrepo.repo
rpm -Uvh https://www.elrepo.org/elrepo-release-6-8.el6.elrepo.noarch.rpm
(安装最新版内核)yum --enablerepo=elrepo-kernel -y install kernel-ml
(安装长期稳定版内核)yum --enablerepo=elrepo-kernel -y install kernel-lt
重启
init 6
查看内核
[root@admin ~]# uname -r
4.4.185-1.el6.elrepo.x86_64