# step 1: 安装必要的一些系统工具
sudo apt-get update
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
# step 2: 安装GPG证书
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
# Step 3: 写入软件源信息
sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
# Step 4: 更新并安装Docker-CE

修改镜像

mkdir -p /etc/docker
cat << EOF > /etc/docker/daemon.json
{
  "registry-mirrors": ["https://hfd6rsvx.mirror.aliyuncs.com","http://f1361db2.m.daocloud.io","http://hub-mirror.c.163.com","https://registry.docker-cn.com"]
}
EOF
mkdir -p /etc/systemd/system/docker.service.d
systemctl daemon-reload 
systemctl restart docker && systemctl enable docker

安装Docker Compose

curl -L https://github.com/docker/compose/releases/download/1.29.2/run.sh > /usr/local/bin/docker-compose
sudo mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

安装Harbor
下载地址:https://github.com/goharbor/harbor/releases

wget https://github.com/goharbor/harbor/releases/download/v2.5.5/harbor-online-installer-v2.5.5.tgz
tar xvf harbor-online-installer-v2.5.5.tgz
cd harbor
cp harbor.yml.tmpl harbor.yml

备注:最好申请CA机构签发的域名证书,否则后期使用harbor仓库也麻烦。

编辑配置文件

hostname: harbor.cnbugs.eu.org

# http related config
http:
  # port for http, default is 80. If https enabled, this port will redirect to https port
  port: 80

# https related config
https:
  # https port for harbor, default is 443
  port: 443
  # The path of cert and key files for nginx
  certificate: /data/cert/harbor.crt
  private_key: /data/crt/harbor.key
# 设置admin密码.
harbor_admin_password: Harbor12345  

database:
  # 设置数据库密码.
  password: Harbor12345

# 设置数据保存路径
data_volume: /home/ubuntu/softwares/harbor/data

运行脚本安装harbor

./install.sh
文档更新时间: 2023-03-09 09:31   作者:admin