13、CentOS7 安裝配置GitLab
1、安裝依賴
yum install –y curl policycoreutils openssh-server openssh-clients
systemctl enable sshd
systemctl start sshd
yum install -y postfix
systemctl enable postfix
systemctl start postfix
2、我的環境是用了iptables防火牆,所以下面的命令沒有使用,關閉防火牆,如果使用firewalld,若不想關閉防火牆,可以放開許可權:
sudo firewall-cmd --permanent --add-service=http
sudo systemctl reload firewalld
3、安裝GitLab
1、第一種、新增 GitLab 映象源並安裝(成功)
curl -sS http://packages.gitlab.com.cn/install/gitlab-ce/script.rpm.sh | sudo bash
sudo yum install gitlab-ce
2、第二種、下載gitlab rpm手動安裝,成功gitlab-ce-10.1.4-ce.0.el7.x86_64
1、直接下載有版本的映象安裝
2.1、下載方式一 wget (沒有成功)
2.2、下載方式二 crul (L列表顯示 O預設的名字,J ),沒有成功
3、安裝成功
3、配置並啟動 GitLab
gitlab-ctl reconfigure
4. 通過瀏覽器訪問上一步配置的域名
localhost
第一次訪問 GitLab,系統會重定向 url 到重置密碼的頁面,你需要輸入初始化管理員賬號的密碼。 設定完成後,系統會重定向到登入介面,你就可以使用剛才輸入的密碼登入系統了。
系統預設的管理員賬號為 root, 登入系統後,你可以修改管理員賬號為自己喜歡的賬號。
登入
5、修改埠
gitlab本身採用80埠,如安裝前伺服器有啟用80,安裝完訪問會報錯。需更改gitlab的預設埠。修改
vim /etc/gitlab/gitlab.rb:
- external_url 'http://localhost:90'
如果就想用80埠,那沒問題。如果更改了埠,後邊可以自行調整nginx配置檔案進行nginx反向代理設定。
6、配置郵箱
1、設定SMTP郵件伺服器,用於GitLab傳送郵件
開啟/etc/gitlab/gitlab.rb檔案,將以下設定新增到檔案中,儲存。
# Change the external_url to the address your users will type in their browser
external_url 'http://localhost' //修改之前的example,這裡就是提供給郵箱認證的網址
#Sending application email via SMTP
gitlab_rails['smtp_enable']=true
gitlab_rails['smtp_address']="smtp.163.com"
gitlab_rails['smtp_port']= 25
gitlab_rails['smtp_user_name']=" [email protected]" gitlab_rails['smtp_password']="****"
gitlab_rails['smtp_domain']="163.com"
gitlab_rails['smtp_authentication']= :login gitlab_rails['smtp_enable_starttls_auto']=true
##修改gitlab配置的發信人
gitlab_rails['gitlab_email_from']="[email protected]"
user["git_user_email"]=" [email protected]"
2、當我們新增一個user使用者的時候,設定[email protected]郵箱,會發送認證密碼的郵件
1、輸入兩次密碼進行確認
7、基本命令
檢視狀態
gitlab-ctl status
啟動Gitlab所有元件
gitlab-ctl start
停止Gitlab所有元件
gitlab-ctl stop
重啟Gitlab所有元件
gitlab-ctl restart