2. 1. 准备
sudo apt-get update
sudo apt-get install -y curl openssh-server ca-certificates
sudo apt-get install -y postfix
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
修改地址
vi /etc/apt/sources.list.d/gitlab_gitlab-ce.list
内容改为
deb https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu xenial main
2. 安装ce版,即社区版,企业版是gitlab-ee
sudo apt-get update
sudo apt-get install gitlab-ce
3. 后续
按需要修改配置文件/etc/gitlab/gitlab.rb
最重要的是 external_url,这个不影响实际访问地址,但是会影响git库主页中,可以通过按钮复制的那个库地址。
启用email,以腾讯企业邮箱为例,/etc/gitlab/gitlab.rb对应配置如下
### Email Settings
gitlab_rails['gitlab_email_enabled'] = true
gitlab_rails['gitlab_email_from'] = 'admin@xxx.com'
gitlab_rails['gitlab_email_display_name'] = 'XXXX'
gitlab_rails['gitlab_email_reply_to'] = 'noreply@xxx.com'
gitlab_rails['gitlab_email_subject_suffix'] = ''
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.exmail.qq.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "admin@xxx.com"
gitlab_rails['smtp_password'] = "password"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true
gitlab_rails['gitlab_email_from'] = 'admin@xxx.com'
4. 启用配置并启动:
sudo gitlab-ctl reconfigure
sudo gitlab-ctl start
浏览器访问:默认为80端口
校验email是否可用
gitlab-rails console
irb(main):003:0> Notify.test_email('xxxx@qq.com', 'Message Subject', 'Message Body').deliver_now
5. 其他参考
http://blog.csdn.net/ouyang_peng/article/details/72903221