本文用的docker方式部署

#方法一:二进制安装
curl -L https://github.com/docker/compose/releases/download/1.16.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
#c.根据自己的情况决定是否安装命令补全功能
yum install bash-completion
curl -L https://raw.githubusercontent.com/docker/compose/1.16.1/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose
#测试是否安装成功
docker-compose --version

#方法二:pip
yum install python-pip
pip install  docker-compose

#卸载docker-compose
#二进制:
rm  /usr/local/bin/docker-compose
#pip:
pip uninstall  docker-compose

#安装Harbor
#在线安装
wget -P /usr/loca/src/     https://github.com/vmware/harbor/releases/download/v1.2.0/harbor-online-installer-v1.2.0.tgz
#离线安装
https://github.com/vmware/harbor/releases/download/v1.2.0/harbor-offline-installer-v1.2.0.tgz

# cd /usr/local/src/
# tar zxf harbor-online-installer-v1.2.0.tgz  -C /usr/local/
# cd /usr/local/harbor/

# vim /usr/local/harbor/harbor.cfg
hostname = harbor.1nth.com
#邮箱配置
email_server = smtp.mxhichina.com
email_server_port = 25
email_username = root@1nth.com
email_password = xiaofan@1
email_from = root <root@1nth.com>
email_ssl = false
#禁止用户注册
self_registration = off
#设置只有管理员可以创建项目
project_creation_restriction = adminonly

#安装
/usr/local/harbor/install.sh

docker-compose start

默认账号密码: admin / Harbor12345



#1.修改各docker client配置
# vim /usr/lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd --insecure-registry rgs.unixfbi.com

#或者
# cat > /etc/docker/daemon.json << EOF
{ "insecure-registries":["rgs.unixfbi.com"] }
EOF



#五、Harbor配置TLS证书
vi harbor.cfg
hostname = rgs.unixfbi.com
ui_url_protocol = https
ssl_cert = /etc/certs/ca.crt
ssl_cert_key = /etc/certs/ca.key

mkdir /etc/certs
openssl genrsa -out /etc/certs/ca.key 2048 
openssl req -x509 -new -nodes -key /etc/certs/ca.key -subj "/CN=harbor.1nth.com" -days 5000 -out /etc/certs/ca.crt
./install.sh



#客户端配置
mkdir -p /etc/docker/certs.d/rgs.unixfbi.com
scp /etc/certs/ca.crt root@192.168.199.183:/etc/docker/certs.d/rgs.unixfbi.com/
systemctl restart docker