0- 一键安装harbor服务器
- 配置建议: 4G 内存以上,50g磁盘,访问互联网在线安装docker-ce和docker-compose
- 脚本使用的是harbor离线包,安装更快,整个安装过程十分钟左右。
curl -o k8s_install.sh https://files-cdn.cnblogs.com/files/lemanlai/k8s_install.sh
chmod a+x k8s_install.sh
./k8s_install harbor
+++++++++++++++++++++++++++++++++++++++以下为详细安装过程+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1- 环境准备
节点 | OS | dns主机名 | IP | cpu | 内存 | 磁盘 | 组件 |
---|---|---|---|---|---|---|---|
harbor | centos7.7 mini | harbor.k8s.lcom | 192.168.141.135(nat) | 2 | 4g | 80g | harbor docker-ce docker-compose |
2- 环境初始化
#关闭防火墙和selinux
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
sed -i.bak 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
#配置清华源
rm -rf /etc/yum.repos.d/*
curl -o /etc/yum.repos.d/CentOS-Base.repo https://files-cdn.cnblogs.com/files/lemanlai/CentOS-7.repo.sh
curl -o /etc/pki/rpm-gpg/RPM-GPG-KEY-7 https://mirror.tuna.tsinghua.edu.cn/centos/7/os/x86_64/RPM-GPG-KEY-CentOS-7
yum install epel-release -y
curl -o /etc/yum.repos.d/docker-ce.repo https://files-cdn.cnblogs.com/files/lemanlai/docker-ce.repo.sh
yum clean all
yum makecache fast
yum install nmap telnet curl wget vim lrzsz bind-utils -y #安装基本工具
3- harbor安装
3.1- docker-ce安装
yum remove docker docker-common docker-selinux docker-engine -y #如果你之前安装过 docker,请先删掉
yum install -y yum-utils device-mapper-persistent-data lvm2 #安装一些依赖
yum -y install docker-ce
systemctl enable docker
curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io #写入加速地址
systemctl daemon-reload
systemctl restart docker #重启服务
3.2- docker-compose安装
curl -L https://get.daocloud.io/docker/compose/releases/download/1.26.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
3.3- harbor安装
cd /opt/
wget http://harbor.orientsoft.cn/harbor-v1.3.0-rc4/harbor-offline-installer-v1.3.0-rc4.tgz #下载离线安装包
#国内镜像网址:http://harbor.orientsoft.cn/
##修改配置文件
cd harbor/
cat harbor.cfg -n
5 hostname = harbor.k8s.lcom #第五行修改主机名
12 db_password = root123 # 第12行 mysql密码
67 harbor_admin_password = Harbor12345 # 第67行harbor web登陆密码
##开始安装
./install.sh
[Step 0]: checking installation environment ...
Note: docker version: 19.03.11
Note: docker-compose version: 1.26.0
[Step 1]: loading Harbor images ...
***
[Step 4]: starting Harbor ...
Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating harbor-db ... done
Creating harbor-adminserver ... done
Creating registry ... done
Creating harbor-ui ... done
Creating nginx ... done
Creating harbor-jobservice ... done
✔ ----Harbor has been installed and started successfully.---- ##安装完成
Now you should be able to visit the admin portal at http://harbor.k8s.lcom.
For more details, please visit https://github.com/vmware/harbor .
3.4- web登陆
浏览器打开 http://192.168.141.135