環(huán)境安裝
- 安裝依賴包
sudo yum install -y curl policycoreutils-python openssh-server
- 設置SSH開機自啟動并啟動SSH服務停巷。
sudo systemctl enable sshd
sudo systemctl start sshd
- 安裝Postfix來發(fā)送通知郵件耍攘。
sudo yum install postfix
- 設置Postfix開機自啟動
sudo systemctl enable postfix
- 啟動 Postfix
5.1 vim /etc/postfix/main.cf打開main.cf
5.2 修改 inet_interfaces = interface 為 inet_interfaces = all
5.3 sudo systemctl start postfix
安裝gitlab
- 添加gitlab軟件包yum倉庫
vim /etc/yum.repos.d/gitlab-ce.repo
#在編輯器中輸入如下內容保存
[gitlab-ce]
name=gitlab-ce
baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7
repo_gpgcheck=0
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/gpg.key
- 安裝gitlab
yum makecache
sudo EXTERNAL_URL="GitLab服務器的公網(wǎng)IP地址" yum install -y gitlab-ce
- 使用瀏覽器訪問GitLab服務器的公網(wǎng)IP地址
郵件配置
- 修改配置文件
vim /etc/gitlab/gitlab.rb
修改下面信息
# 配置發(fā)送郵箱
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.163.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "user@163.com"
gitlab_rails['smtp_password'] = "password"
gitlab_rails['smtp_domain'] = "163.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
# 修改gitlab配置的發(fā)信人
gitlab_rails['gitlab_email_from'] = "user@163.com"
user["git_user_email"] = "user@163.com"
- 重新載入配置
sudo gitlab-ctl reconfigure
- 進入控制臺(測試郵件服務是否正常)
gitlab-rails console
Notify.test_email("XXX@XXX.XX","title","gitlab").deliver_now