gitlab安裝與配置(Centos6.8)


0、Centos7請參照官方文檔

https://about.gitlab.com/installation/#centos-7

1. Install and configure the necessary dependencies

下面命令可在gitlab官網找到,【Select an operating system...】選擇不同的系統即可查看。

sudo yum install curl openssh-server openssh-clients postfix cronie

# 先修改下面的配置文件再執行啟動命令 sudo service postfix start sudo chkconfig postfix on

# 若不執行安裝有可能遇到這個錯誤【lokkit: command not found 】
yum -y install lokkit sudo lokkit
-s http -s ssh

  這里安裝了postfix,我自行配置了postfix。

vim /etc/postfix/main.cf
myhostname = sample.test.com  ← 設置系統的主機名

mydomain = test.com  ← 設置域名(我們將讓此處設置將成為E-mail地址“@”后面的部分)

myorigin = $mydomain  ← 將發信地址“@”后面的部分設置為域名(非系統主機名)

inet_interfaces = all  ← 接受來自所有網絡的請求

mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain  ← 指定發給本地郵件的域名

home_mailbox = Maildir/  ← 指定用戶郵箱目錄

  然后測試郵件

echo "Mail Content" | mail -s "Mail Subject" xxxx@xxx.com

若出現【-bash: mail: command not found】執行如下命令:

yum -y install mailx

Note:if you see below warings after you run above command.

send-mail: warning: inet_protocols: IPv6 support is disabled: Address family not supported by protocol send-mail: warning: inet_protocols: configuring for IPv4 support only postdrop: warning: inet_protocols: IPv6 support is disabled: Address family not supported by protocol postdrop: warning: inet_protocols: configuring for IPv4 support only

  that means you don't have IPv6 configured in your OS's network stack, but your mailer (presumably postfix) is configured to use IPv6. Since there is no IPv6 for your mailer to use, it's warning you that it's only going to use IPv4.

To disable the waring messsage, Go to /etc/postfix/main.cf and change from:

inet_protocols = all 

to:

inet_protocols = ipv4 

This will only use ipv4 and the warning message will go away.

You will have to issue a stop and start for postfix to register the change. 

service postfix restart

 

  查看log,確認郵件發送狀態

Postfix郵件的log位置是:/var/log/maillog

發送成功的話,會返回250和OK,也可以去自己的郵件客戶端查收。

一切OK的話,那Postfix mail service應該就搭建成功了。

查看郵件隊列

postqueue -p

 

2. Add the GitLab package server and install the package

curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
sudo yum install gitlab-ce

這里因為網絡院線可能會出現下載失敗,我嘗試了兩次后成功了。

3. Configure and start GitLab

sudo gitlab-ctl reconfigure

 troubleshooting:

 【Error executing action `run` on resource 'execute[semodule -i /opt/gitlab/embedded/selinux/rhel/7/g】

yum install libsemanage-static libsemanage-devel

解決Gitlab的Gravatar頭像無法顯示的問題

vim /etc/gitlab/gitlab.rb
#把下面這一行的注釋去掉即可
gitlab_rails['gravatar_plain_url'] = 'http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon'

編輯完gitlab.rb文件后要執行sudo gitlab-ctl reconfigure

 

解決郵件中URL指向問題

vim /etc/gitlab/gitlab.rb
#將localhost修改為你對應的iP或者域名
external_url 'http://101.101.101.80'

同上,編輯完gitlab.rb文件后要執行sudo gitlab-ctl reconfigure

 

希望以上筆記能幫助你理解gitlab的官方文檔。

 

技術交流群:576269252

--------------------------------------

聲明: 原創文章,未經允許,禁止轉載!

--------------------------------------


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM