王海庆的云笔记

搭建rancher2.6环境


关闭防火墙

systemctl stop firewalld
systemctl disable firewalld
sed -i -e  's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
setenforce 0


换成阿里云的源

rm -rf /etc/yum.repos.d/*
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
# curl -o /etc/yum.repos.d/docker-ce.repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

yum clean all
yum makecache fast -y


ntpdate 时间同步

yum -y install ntpdate

ntpdate time1.aliyun.com
echo "0 8 * * * /usr/sbin/ntpdate time1.aliyun.com >> /var/log/ntpdate.log" >> /var/spool/cron/root
timedatectl set-timezone Asia/Shanghai
hwclock --systohc


服务器上面安装docker

export VERSION=19.03
curl -fsSL "https://get.docker.com/" | bash -s -- --mirror Aliyun
systemctl start docker
systemctl enable docker


采用签名证书、采用2.6.2(之后的2.6版本界面完全不一样了)

docker rm -f rancher
docker run -d --privileged \
    --name rancher \
    --restart=unless-stopped \
    -p 80:80 -p 443:443 \
    -v /opt/rancher:/var/lib/rancher/ \
    -v /opt/domain.cer:/etc/rancher/ssl/cert.pem \
    -v /opt/domain.key:/etc/rancher/ssl/key.pem \
    rancher/rancher:v2.6.2 --no-cacerts


去掉80端口给GitLab使用  

docker rm -f rancher
docker run -d --privileged \
    --name rancher \
    --restart=unless-stopped \
    -p 443:443 \
    -v /opt/rancher:/var/lib/rancher/ \
    -v /opt/domain.cer:/etc/rancher/ssl/cert.pem \
    -v /opt/domain.key:/etc/rancher/ssl/key.pem \
    rancher/rancher:v2.6.2 --no-cacerts


查看安装过程日志

docker ps | grep rancher | awk '{print $1}' | xargs docker logs -f


访问

https://118.24.103.71/


密码,默认管理员账号为: admin

docker logs  rancher  2>&1 | grep "Bootstrap Password:"


参考

https://blog.csdn.net/qq12547345/article/details/120560047

文章最后更新时间: 2021-12-07 14:06:12