1、Harbor安裝環境要求nginx
硬件環境:git
1)CPU 2核以上,最好4核以上github
2)內存4G以上,最好8G以上docker
3)硬盤空間至少40G,最好160G以上數據庫
軟件環境:服務器
1)docker v17.06以上版本微信
2)docker-compose v1.18.0以上版本測試
3)Openssl 更新到最新版(通常狀況下,這個可忽略)this
說明:本例中服務器操做系統爲CentOS7.4操作系統
2、Harbor服務器搭建
一、下載Harbor安裝文件
從GitHub上 https://github.com/goharbor/harbor/releases 查看當前可用的harbor版本,通常選擇最新穩定版,目前就是這個:
下載該安裝包到系統目錄中,以下:
[root@localhost ~]# mkdir -p /home/temp/ [root@localhost ~]# cd /home/temp/ [root@localhost temp]# wget https://github.com/goharbor/harbor/releases/download/v1.10.1/harbor-offline-installer-v1.10.1.tgz
下載速度可能會有點慢,耐心等待下載完成。
二、解壓安裝文件
[root@localhost temp]# tar -zxf harbor-offline-installer-v1.10.1.tgz [root@localhost temp]# tar -zxf harbor.v1.10.1.tar.gz
三、配置Harbor
[root@localhost temp]# ls [root@localhost temp]# cd harbor [root@localhost harbor]# ls [root@localhost harbor]# vi harbor.yml
主要修改以下內容:
hostname: 你的服務器IP或域名 http: # port for http, default is 80. If https enabled, this port will redirect to https port port: 你的端口號 #默認是80端口 harbor_admin_password: Harbor12345 #Harbor超級管理員密碼 database: # The password for the root user of Harbor DB. Change this before any production use. password: root123 #數據庫管理員密碼 data_volume: /data #配置harbor數據文件,也就是將來鏡像文件的存儲位置,建議修改,否則直接佔用系統盤空間。 #同時註釋以下內容,默認啓用http,而不是https證書除非你有配置https證書 # https related config #https: # https port for harbor, default is 443 #port: 443 # The path of cert and key files for nginx #certificate: /your/certificate/path #private_key: /your/private/key/path
注:其餘詳細的配置參數詳見《harbor.yml參數描述說明》
四、啓動安裝Harbor
修改完配置文件後,在當前目錄執行./install.sh,harbor服務器會自動調用docker-compose分析依賴的鏡像並逐個下載,同時自動安裝並啓動各服務
[root@localhost harbor]# ./install.sh
若安裝時遇到以下錯誤
這就須要升級docker 版本,具體操做詳見《docker版本升級簡易指南》
升級docker後,從新執行./install.sh,等待程序自動按步驟安裝:
出現以下提示,則表示安裝成功:
注:安裝完後,安裝目錄下會變成這樣,能夠看到其中多出一個docker-compose.yml文件,這也是基於harbor.yml生成的供docker-compose調用建立容器的服務編排文件。
安裝完成後,經過配置中設置的IP或域名+端口,便可訪問harbor管理控制檯,若是端口占用,能夠去安裝目錄下harbor.yml文件中,對應服務的端口映射。
測試安裝是否成功,使用安裝時在harbor.yml中設置的管理員密碼,用戶名是admin,登陸控制檯:
登陸成功
關注弈碼當先微信公衆號獲取更多幹貨
本文由 弈碼當先 www.root1024.com 獨家發佈!