Install Rancher server
1.pre-requirement:
sudo nmtui
# sudo hostnamectl set-hostname <hostname>
$ sudo hostnamectl set-hostname rancher01
$ sudo systemctl restart systemd-hostnamed
sudo yum install openssh -y
2.docker:
$ sudo yum install yum-utils -y
$ sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
$ sudo yum makecache fast
$ sudo yum install docker-ce
$ sudo groupadd docker
$ sudo usermod -aG docker <youruser>
$ getent group docker
$ systemctl start docker
$ sudo systemctl enable docker
注意上面的在centos7里面很简单就完成了,这里装一下*,所以加进去了,万一后面有用呢。
Install Rancher server
$ docker run -d --restart=unless-stopped -p 8080:8080 rancher/server:stable
$ docker run -d --name rancher-mysql --restart=unless-stopped -e MYSQL_ROOT_PASSWORD=<password> -e MYSQL_DATABASE=cattle mysql:5.7
$ docker run -d --restart=unless-stopped --link rancher-mysql:rancher-mysql -p 8080:8080 rancher/server:stable --db-host rancher-mysql --db-port 3306 --db-user root --db-pass <password> --db-name cattle
$ docker run -d -v <path>:/var/lib/mysql --restart=unless-stopped -p 8080:8080 rancher/server:stable
$ sudo firewall-cmd --zone=public --add-port=8080/tcp --permanent
$ sudo firewall-cmd --reload
$ sudo firewall-cmd --list-ports
Rancher 要检查ipv6:所以要enable it:
$ sudo sysctl -a | grep net.ipv6.conf.all.forwarding
net.ipv6.conf.all.forwarding=1
$ sudo reboot
last:
http://<your ip>:8080
ok: