2.用传输工具把之前说的两个包传入虚拟机内,这里我用的是Xftp 5
3. 这里我是直接传输到虚拟机的 /root/ 目录下的
4.因为直接用虚拟机不方便操作,所以这里我们改用远程登录工具来,这里我使用的是
到这里准备工作就做完了
#vi /etc/sysconfig/selinux
SELINUX=disabled
#reboot
#getenforce
Disabled
#ssh-keygen
一直回车到结束
#ssh-copy-id 192.168.10.20
#yes
#输入192.168.10.20的密码
#systemctl stop firewalld
#systemctl disable firewalld
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
#hostnamectl set-hostname server
#bash
#vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.10.10 server(添加)
192.168.10.20 client(添加)
#ping client
#hostnamectl set-hostname client
#bash
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.10.10 server(添加)
192.168.10.20 client(添加)
#ping server
#vi /etc/sysctl.conf
#System default settings live in /usr/lib/sysctl.d/00-system.conf.
#To override those settings, enter new settings here, or in an /etc/sysctl.d/.conf file
#For more information, see sysctl.conf(5) and sysctl.d(5).
net.ipv4.ip_forward = 1(添加)
net.ipv4.conf.default.rp_filter = 0(添加)
net.ipv4.conf.all.rp_filter = 0(添加)
#sysctl -p
net.ipv4.ip_forward = 1
net.ipv4.conf.default.rp_filter = 0
net.ipv4.conf.all.rp_filter = 0
# mkdir /opt/centos
# mkdir /opt/docker
## mount -o loop XianDian-PaaS-v2.2.iso /opt/docker/
mount: /dev/loop0 is write-protected, mounting read-only
#mount -o loop CentOS-7-x86_64-DVD-1511.iso /opt/centos/
mount: /dev/loop1 is write-protected, mounting read-only
#rm -rfv /etc/yum.repos.d/* 或者 mv -rfv /etc/yum.repos.d/* /home
#vi /etc/yum.repos.d/docker.repo
(添加下面这些)
[centos]
name=centos
baseurl=file:///opt/centos
gpgcheck=0
enabled=1
[docker]
name=docker
baseurl=file:///opt/docker/docker
gpgcheck=0
enabled=1
#yum -y install vsftpd
#vi /etc/vsftpd/vsftpd.conf
anon_root=/opt(添加这一行)
#systemctl restart vsftpd
#systemctl enable vsftpd
Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.
#rm -rfv /etc/yum.repos.d/* 或者 mv -rfv /etc/yum.repos.d/* /home
#vi /etc/yum.repos.d/docker.repo
(添加下面这些)
[centos]
name=centos
baseurl=//server/centos
gpgcheck=0
enabled=1
[docker]
name=docker
baseurl=ftp://server/docker/docker
gpgcheck=0
enabled=1
#yum clean all
#yum list
# yum -y install docker
# systemctl restart docker
# systemctl enable docker
#cd /opt/docker/images/rancher1.6.5/
#docker load -i registry_latest.tar
#docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/registry latest c9bd19d022f6 3 years ago 33.27 MB
# docker run -d -p 5000:5000 --restart=always --name registry docker.io/registry:latest
20a07207bf28256d13fbc53cf2a1d978a4827bf8f360b32a8106d996f024c001
# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
20a07207bf28 docker.io/registry:latest "/entrypoint.sh /etc/" 8 seconds ago Up 3 seconds 0.0.0.0:5000->5000/tcp registry
# vi /etc/sysconfig/docker
(添加这两行)
ADD_REGISTRY='--add-registry 192.168.10.10:5000'
INSECURE_REGISTRY='--insecure-registry 192.168.10.10:5000'
#systemctl daemon-reload
#systemctl restart docker
#docker info
#docker tag c9bd19d022f6 192.168.10.10:5000/registry:latest
#docker push 192.168.10.10:5000/registry:latest
至此仓库就建立好了,我们需要将所有镜像全部推送到仓库中,提供给其他节点使用。
# docker load -i rancher_server_v1.6.5.tar
# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
<none> <none> f89070da7581 3 weeks ago 984.9 MB
10.0.3.137:5000/registry latest c9bd19d022f6 15 months ago 33.27 MB
docker.io/registry latest c9bd19d022f6 15 months ago 33.27 MB
# docker tag f89070da7581 192.168.10.10:5000/rancher/server:v1.6.5
# docker push 192.168.10.10:5000/rancher/server:v1.6.5
# docker run -d --restart=unless-stopped -p 8080:8080 rancher/server:v1.6.5;
2ff52cf39d6f2637ac300e7d430dc828fba99cef4ec118793e91e9d680a16509
# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2ff52cf39d6f rancher/server:v1.6.5 "/usr/bin/entry /usr/" 18 seconds ago Up 6 seconds 3306/tcp, 0.0.0.0:8080->8080/tcp modest_turing
20a07207bf28 docker.io/registry:latest "/entrypoint.sh /etc/" 39 minutes ago Up 38 minutes 0.0.0.0:5000->5000/tcp registry
然后通过网页访问server节点的8080节点
选择ADMIN-Access Controller,选择LOCAL进行认证设置
选择ADMIN-Settings,下拉到最下面,找到Advanced Settings
打开Advanced Settings,下拉到最后设置仓库地址
选择右下方的语言,可以进行中文切换
选择Default-环境管理,点击添加环境,选择Cattle环境模板,环境名称自定义
查看建立的环境状态,Active状态为正常
切换到新建的环境
添加主机之前要确保仓库中有agent服务的相关镜像,没有的话需要提前传到私有仓库中,clinet节点配置好私有仓库地址即可直接拉取。
#ll
REPOSITORY TAG IMAGE ID CREATED SIZE
192.168.10.10:5000/rancher/server v1.6.5 f89070da7581 22 months ago 984.9 MB
192.168.10.10:5000/centos latest ff426288ea90 23 months ago 207.2 MB
192.168.10.10:5000/rancher/scheduler v0.8.2 690ef14a99b7 2 years ago 241.9 MB
192.168.10.10:5000/rancher/agent v1.2.5 ef5fea38dbe6 2 years ago 237.1 MB
192.168.10.10:5000/rancher/network-manager v0.7.4 787fc137ac53 2 years ago 248.8 MB
192.168.10.10:5000/rancher/metadata v0.9.2 d46f30a656e0 2 years ago 251.5 MB
192.168.10.10:5000/rancher/net v0.11.3 9495baae8faf 2 years ago 267.3 MB
192.168.10.10:5000/rancher/dns v0.15.1 af5509fe436b 2 years ago 239.8 MB
192.168.10.10:5000/rancher/healthcheck v0.3.1 10710b438de7 2 years ago 383.9 MB
192.168.10.10:5000/rancher/net holder 665d9f6e8cc1 2 years ago 267.2 MB
docker.io/registry latest c9bd19d022f6 3 years ago 33.27 MB
192.168.10.10:5000/registry latest c9bd19d022f6 3 years ago 33.27 MB