环境安装
- 安装依赖包
sudo yum install -y curl policycoreutils-python openssh-server
- 设置SSH开机自启动并启动SSH服务。
sudo systemctl enable sshd
sudo systemctl start sshd
- 安装Postfix来发送通知邮件。
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服务器的公网IP地址" yum install -y gitlab-ce
- 使用浏览器访问GitLab服务器的公网IP地址
邮件配置
- 修改配置文件
vim /etc/gitlab/gitlab.rb
修改下面信息
# 配置发送邮箱
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配置的发信人
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