接上一篇,后续操作。
Nw-Harbor虚拟机(220.138)
Harbor
部署
Harbor是由VMware公司开源的企业级的Docker Registry管理项目,项目地址:https://github.com/goharbor/harbor。安装需求:
- 下载离线安装包:
wget https://github.com/goharbor/harbor/releases/download/v2.1.0/harbor-offline-installer-v2.1.0.tgzwget https://github.com/goharbor/harbor/releases/download/v2.1.0/harbor-offline-installer-v2.1.0.tgz
wget https://github.com/goharbor/harbor/releases/download/v2.1.0/harbor-offline-installer-v2.1.0.tgz
- 解压:
tar zxf harbor-offline-installer-v2.1.0.tgz -C /data/tar zxf harbor-offline-installer-v2.1.0.tgz -C /data/
tar zxf harbor-offline-installer-v2.1.0.tgz -C /data/
- 安装Docker环境:
yum install -y yum-utilsyum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repoyum repolistyum install -y docker-cesystemctl enable dockersystemctl start dockercurl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-composechmod +x /usr/local/bin/docker-composedocker-compose --versionyum install -y yum-utils yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo yum repolist yum install -y docker-ce systemctl enable docker systemctl start docker curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose docker-compose --version
yum install -y yum-utils yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo yum repolist yum install -y docker-ce systemctl enable docker systemctl start docker curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose docker-compose --version
- 配置Harbor(配置文件说明):
cd /data/harbor/cp harbor.yml.tmpl harbor.ymlvim harbor.ymlcd /data/harbor/ cp harbor.yml.tmpl harbor.yml vim harbor.yml
cd /data/harbor/ cp harbor.yml.tmpl harbor.yml vim harbor.yml
hostname: 172.16.220.138harbor_admin_password: Nw-Harbor123data_volume: /data/harbor/datahostname: 172.16.220.138 harbor_admin_password: Nw-Harbor123 data_volume: /data/harbor/datahostname: 172.16.220.138 harbor_admin_password: Nw-Harbor123 data_volume: /data/harbor/data
将https配置注释掉,其它配置根据需要修改。
- 安装Harbor:
./prepare./install.sh --with-chartmuseum./prepare ./install.sh --with-chartmuseum
./prepare ./install.sh --with-chartmuseum
Tips: 使Docker客户机支持Harbor方法:
vim /etc/docker/daemon.json
vim /etc/docker/daemon.json
vim /etc/docker/daemon.json
...
{ "insecure-registries": [ "172.16.220.138:80" ] }
...
...
{ "insecure-registries": [ "172.16.220.138:80" ] }
...
... { "insecure-registries": [ "172.16.220.138:80" ] } ...
systemctl restart docker
systemctl restart docker
systemctl restart docker
设置服务
设置服务并开机启动:
vim /lib/systemd/system/harbor.service
vim /lib/systemd/system/harbor.service
vim /lib/systemd/system/harbor.service
[Unit]
Description=Harbor
After=docker.service systemd-networkd.service systemd-resolved.service
Requires=docker.service
Documentation=http://github.com/vmware/harbor
[Service]
Type=simple
Restart=on-failure
RestartSec=5
#需要注意harbor的安装位置
ExecStart=/usr/local/bin/docker-compose -f /data/harbor/docker-compose.yml up
ExecStop=/usr/local/bin/docker-compose -f /data/harbor/docker-compose.yml down
[Install]
WantedBy=multi-user.target
[Unit]
Description=Harbor
After=docker.service systemd-networkd.service systemd-resolved.service
Requires=docker.service
Documentation=http://github.com/vmware/harbor
[Service]
Type=simple
Restart=on-failure
RestartSec=5
#需要注意harbor的安装位置
ExecStart=/usr/local/bin/docker-compose -f /data/harbor/docker-compose.yml up
ExecStop=/usr/local/bin/docker-compose -f /data/harbor/docker-compose.yml down
[Install]
WantedBy=multi-user.target
[Unit] Description=Harbor After=docker.service systemd-networkd.service systemd-resolved.service Requires=docker.service Documentation=http://github.com/vmware/harbor [Service] Type=simple Restart=on-failure RestartSec=5 #需要注意harbor的安装位置 ExecStart=/usr/local/bin/docker-compose -f /data/harbor/docker-compose.yml up ExecStop=/usr/local/bin/docker-compose -f /data/harbor/docker-compose.yml down [Install] WantedBy=multi-user.target
systemctl enable harbor
systemctl start harbor
systemctl status harbor
systemctl enable harbor
systemctl start harbor
systemctl status harbor
systemctl enable harbor systemctl start harbor systemctl status harbor
Nw-Gitlab主机(220.139)
Gitlab
Gitlab部署于 172.16.220.139 物理主机上。下载官方RPM安装包后默认安装即可。
- 下载最新版Gitlab-ce(官网页面):
wget https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/8/gitlab-ce-13.5.1-ce.0.el8.x86_64.rpm/download.rpmwget https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/8/gitlab-ce-13.5.1-ce.0.el8.x86_64.rpm/download.rpm
wget https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/8/gitlab-ce-13.5.1-ce.0.el8.x86_64.rpm/download.rpm
- 安装:
rpm -ivh gitlab-ce-13.5.1-ce.0.el8.x86_64.rpmrpm -ivh gitlab-ce-13.5.1-ce.0.el8.x86_64.rpm
rpm -ivh gitlab-ce-13.5.1-ce.0.el8.x86_64.rpm
- 配置
cd /etc/gitlabsed -i "s/^external_url.*/external_url \'http\:\/\/172\.16\.220\.139\'/" gitlab.rbgitlab-ctl reconfigurecd /etc/gitlab sed -i "s/^external_url.*/external_url \'http\:\/\/172\.16\.220\.139\'/" gitlab.rb gitlab-ctl reconfigure
cd /etc/gitlab sed -i "s/^external_url.*/external_url \'http\:\/\/172\.16\.220\.139\'/" gitlab.rb gitlab-ctl reconfigure
- 启动
默认reconfigure后会自动启动。且设置为开机自启。gitlab-ctl startgitlab-ctl statussystemctl status gitlab-runsvdirgitlab-ctl start gitlab-ctl status systemctl status gitlab-runsvdirgitlab-ctl start gitlab-ctl status systemctl status gitlab-runsvdir
- 访问
首次访问需设置密码:
NFS
- 安装:
yum install -y nfs-utilsyum install -y nfs-utils
yum install -y nfs-utils
- 设置共享目录:
mkdir -p /data/sharechmod o+w /data/share/touch /data/share/Dir_for_k8s_sharing.txtmkdir -p /data/share chmod o+w /data/share/ touch /data/share/Dir_for_k8s_sharing.txt
mkdir -p /data/share chmod o+w /data/share/ touch /data/share/Dir_for_k8s_sharing.txt
- 配置:
vim /etc/exportsvim /etc/exports
vim /etc/exports
/data/share 172.16.220.0/24(sync,rw) 10.10.0.0(sync,rw)/data/share 172.16.220.0/24(sync,rw) 10.10.0.0(sync,rw)/data/share 172.16.220.0/24(sync,rw) 10.10.0.0(sync,rw)
- 启动
systemctl enable nfs-serversystemctl start nfs-serversystemctl status nfs-serversystemctl enable nfs-server systemctl start nfs-server systemctl status nfs-server
systemctl enable nfs-server systemctl start nfs-server systemctl status nfs-server