Install Rancher-2.x under CentOS (single node online installation)

reference:

  1. https://blog.csdn.net/weixin_37194108/article/details/103817097 (Rapid deployment of single node RancherServer)
  2. https://www.cnblogs.com/lfl17718347843/p/12814435.html (docker deployment rancher)

Rancher is a container management platform that can help organizations deploy and manage containers in a production environment easily and quickly.

First install docker (offline installation)

One, docker's rpm installation package download

2. The required dependency package download (8 + 2 + 1)

  • Eight of the dependency package download addresses: click to go
  • Dependent package list:
  • Two of the dependency package download lists (attach the download link at the time, if the connection fails, you can only find it yourself)
  • One of the dependent package download list (attach the download link at that time, if the connection fails, you can only find it by yourself)

Three, installation

3.1 Check the installation environment

  • Upload the installation package and dependencies to the centos7 server, the test path of this document is: /home/docker/docker-install-package

  • After the upload is successful, the file is as follows:

[root@hadoop4 docker]# ll
总用量 35440
-rw-r--r--. 1 root root    25976 9月  29 15:42 container-selinux-2.9-4.el7.noarch.rpm
-rw-r--r--. 1 root root 36254876 9月  29 15:42 docker-ce-18.03.1.ce-1.el7.centos.x86_64.rpm
drwxr-xr-x. 2 root root     4096 9月  29 15:46 package
  • Wherein packagestoring the previously downloaded all the required packages, as follows:
[root@hadoop4 package]# ll
总用量 1804
-rw-r--r--. 1 root root  78256 9月  29 15:42 audit-libs-python-2.8.5-4.el7.x86_64.rpm
-rw-r--r--. 1 root root 302068 9月  29 15:42 checkpolicy-2.5-8.el7.x86_64.rpm
-rw-r--r--. 1 root root  67720 9月  29 15:42 libcgroup-0.41-21.el7.x86_64.rpm
-rw-r--r--. 1 root root  56988 9月  29 15:42 libseccomp-2.3.1-3.el7.x86_64.rpm
-rw-r--r--. 1 root root 115284 9月  29 15:42 libsemanage-python-2.5-14.el7.x86_64.rpm
-rw-r--r--. 1 root root  69596 9月  29 15:46 pigz-2.3.3-1.el7.centos.x86_64.rpm
-rw-r--r--. 1 root root 468236 9月  29 15:42 policycoreutils-python-2.5-33.el7.x86_64.rpm
-rw-r--r--. 1 root root  32880 9月  29 15:42 python-IPy-0.75-6.el7.noarch.rpm
-rw-r--r--. 1 root root 635184 9月  29 15:42 setools-libs-3.3.8-4.el7.x86_64.rpm

3.2 Start the installation

3.2.1 Batch installation of dependent packages:rpm -Uvh *.rpm --nodeps --force

[root@hadoop4 package]# rpm -Uvh *.rpm --nodeps --force
准备中...                          ################################# [100%]
正在升级/安装...
   1:setools-libs-3.3.8-4.el7         ################################# [ 10%]
   2:python-IPy-0.75-6.el7            ################################# [ 20%]
   3:libsemanage-python-2.5-14.el7    ################################# [ 30%]
   4:libcgroup-0.41-21.el7            ################################# [ 40%]
   5:checkpolicy-2.5-8.el7            ################################# [ 50%]
   6:audit-libs-python-2.8.5-4.el7    ################################# [ 60%]
   7:policycoreutils-python-2.5-33.el7################################# [ 70%]
   8:pigz-2.3.3-1.el7.centos          ################################# [ 80%]
   9:libtool-ltdl-2.4.2-22.el7_3      ################################# [ 90%]
  10:libseccomp-2.3.1-3.el7           ################################# [100%]

3.2.2 Installation container-selinux-2.9-4.el7.noarch.rpm:rpm -Uvh container-selinux-2.9-4.el7.noarch.rpm

[root@hadoop4 docker]# rpm -Uvh container-selinux-2.9-4.el7.noarch.rpm 
警告:container-selinux-2.9-4.el7.noarch.rpm: 头V4 DSA/SHA1 Signature, 密钥 ID 192a7d7d: NOKEY
准备中...                          ################################# [100%]
软件包 container-selinux-2:2.9-4.el7.noarch 已经安装

3.2.3 Installation docker:rpm -Uvh docker-ce-18.03.1.ce-1.el7.centos.x86_64.rpm

[root@hadoop4 docker]# rpm -Uvh docker-ce-18.03.1.ce-1.el7.centos.x86_64.rpm 
警告:docker-ce-18.03.1.ce-1.el7.centos.x86_64.rpm: 头V4 RSA/SHA512 Signature, 密钥 ID 621e9f35: NOKEY
准备中...                          ################################# [100%]
软件包 docker-ce-18.03.1.ce-1.el7.centos.x86_64 已经安装

Fourth, check the docker installation

  • Start docker:systemctl start docker
  • View the dockerlist of startup containers:docker ps
[root@hadoop4 docker]# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

Or check the docker version

docker version 
  • Successful installation
  • tips: If an error is reported during the installation, and there is a package that cannot be found, download it after the Baidu address, and then install it.

Then install Rancher based on the Docker image

1. Search and download rancher/rancher mirror

 docker pull rancher/rancher:

2. View the pulled mirror list (this step can be omitted)

docker image ls

1. Create two mount directories

mkdir -p /rancher/rancher
mkdir -p /rancher/auditlog

2 Create and run the rancher container

docker run -d --restart=unless-stopped -p 80:80 -p 443:443 \
-v /rancher/rancher:/var/lib/rancher \
-v /rancher/auditlog:/var/log/auditlog \
--name rancher rancher/rancher 

Note:

针对以上参数介绍
-p 80:80 -p 443:443 容器端口映射
-v /rancher/rancher:/var/lib/rancher 容器目录映射
-v /rancher/auditlog:/var/log/auditlog 容器目录映射
–name rancher rancher/rancher 为rancher/rancher 取名为 rancher

Docker container added to boot

docker update --restart=always containers/ID

Access ip: port number

1.> rancher-server:

ip:8080

2.> rancher:

ip:80

If you need to use your own SSL signature certificate, you can specify it according to the following parameters:

通过如下三个参数指定自己的签名证书
-v /etc/<CERT_DIRECTORY>/tls.crt:/etc/rancher/ssl/cert.pem \
-v /etc/<CERT_DIRECTORY>/tls.key:/etc/rancher/ssl/key.pem \
-v /etc/<CERT_DIRECTORY>/cacerts.pem:/etc/rancher/ssl/cacerts.pem \

The command reference is as follows:

 docker run -d --restart=unless-stopped \
  -p 80:80 -p 443:443 \
  -v /rancher/rancher:/var/lib/rancher  \      
  -v /rancher/auditlog:/var/log/auditlog \
  -e AUDIT_LEVEL=3 \
  -v /etc/<CERT_DIRECTORY>/tls.crt:/etc/rancher/ssl/cert.pem \   
  -v /etc/<CERT_DIRECTORY>/tls.key:/etc/rancher/ssl/key.pem \    
  -v /etc/<CERT_DIRECTORY>/cacerts.pem:/etc/rancher/ssl/cacerts.pem \
  --name rancher rancher/rancher 为rancher/rancher

Then you can access Rancher through the browser. If you can access it normally, it means it has been installed.
Insert picture description here
Set the password first. After setting the
Insert picture description here
password, you need to set the url address.

Finally, log in and enter, set the language to be displayed in Chinese in the lower right corner
Insert picture description here

Guess you like

Origin blog.csdn.net/shujuelin/article/details/108509974