docker安装

手敲.sh
#配置时间服务器
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
echo ‘Asia/Shanghai’ >/etc/timezone
ntpdate time2.aliyun.com

#配置hosts文件
cat >> /etc/hosts <

10.99.31.217 ap-gitlab01
10.99.31.218 ap-harbor01
10.99.31.219 ap-jenkins01
10.99.31.220 ap-k8smaster01
10.99.31.221 ap-k8sworker01
10.99.31.222 ap-k8sworker02

EOF

#配置java
tar -zxf jdk-8u202-linux-x64.tar.gz
mv jdk1.8.0_202 /usr/local/
ln -s /usr/local/jdk1.8.0_202 /usr/local/jdk
#刷新
source /etc/profile

#配置maven
#wget https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz
#tar -zxf apache-maven-3.8.6-bin.tar.gz
#mv apache-maven-3.8.6 /usr/local/
#ln -s /usr/local/apache-maven-3.8.6 /usr/local/maven
#配置环境变量
cat >> /etc/profile < export JAVA_HOME=/usr/local/jdk
#export MAVEN_HOME=/usr/local/maven
export CLASSPATH=.: J A V A H O M E / l i b / d t . j a r : JAVA_HOME/lib/dt.jar: JAVAHOME/lib/dt.jar:JAVA_HOME/lib/tools.jar
export PATH= P A T H : PATH: PATH:JAVA_HOME/bin:$MAVEN_HOME/bin
EOF
#刷新
source /etc/profile

java -version
mvn -v

#docker安装脚本
export REGISTRY_MIRROR=https://registry.cn-hangzhou.aliyuncs.com
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum -y install https://mirrors.aliyun.com/docker-ce/linux/centos/7/x86_64/stable/Packages/containerd.io-1.5.10-3.1.el7.x86_64.rpm
yum install -y docker-ce-20.10.9 docker-ce-cli-20.10.9
systemctl enable docker.service
systemctl start docker.service

#配置基础环境
#配置阿里云镜像加速器
mkdir -p /etc/docker
cat >> /etc/docker/daemon.json < {
“registry-mirrors”: [“https://ct8asqlq.mirror.aliyuncs.com”],
“insecure-registries”:[“10.99.31.218”]
}

EOF

systemctl daemon-reload
systemctl restart docker
#安装nfs-utils
yum install -y nfs-utils
#启动nfs-server
systemctl start nfs-server
systemctl enable nfs-server
#关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
#关闭SeLinux
setenforce 0
sed -i “s/SELINUX=enforcing/SELINUX=disabled/g” /etc/selinux/config
#关闭 swap
swapoff -a
yes | cp /etc/fstab /etc/fstab_bak
cat /etc/fstab_bak |grep -v swap > /etc/fstab
#修改 /etc/sysctl.conf

你可能感兴趣的