[ci]gitlab安装配置(含gitlab邮件配置)
gitlab安装配置
参考:
https://www.unixhot.com/article/48
原则:简单维护为准,故yum安装gitlab
1,gitlab安装
2,gitlab邮箱配置
1,gitlab安装
yum install curl policycoreutils openssh-server openssh-clients postfix
systemctl start postfix
配置清华大学的源
cat > /etc/yum.repos.d/gitlab-ce.repo << EOF
[gitlab-ce]
name=gitlab-ce
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/
repo_gpgcheck=0
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/gpg.key
EOF
cat /etc/yum.repos.d/gitlab-ce.repo
安装gitlab
yum clean all && yum makecache
yum install gitlab-ce
gitlab-ctl reconfigure #首次启动初始化
管理维护
gitlab-ctl stop
gitlab-ctl sart
gitlab-ctl restart
访问: http://IP
2,设置gitlab邮箱,域名等
参考:
https://ruby-china.org/topics/20450
http://blog.haohtml.com/archives/17059 含腾讯企业邮
https://yxnt.github.io/2015/12/15/gitlab-mail/
http://www.zrick.net/2015/04/08/1428493100/ 重度参考
复制邮箱配置文件:
find / -name smtp_settings.rb.sample
cp /opt/gitlab/embedded/service/gitlab-rails/config/initializers/smtp_settings.rb.sample \ /opt/gitlab/embedded/service/gitlab-rails/config/initializers/smtp_settings.rb
cat /opt/gitlab/embedded/service/gitlab-rails/config/initializers/smtp_settings.rb
…
address: "smtp.sina.com",
port: 25,
user_name: "test@sina.com",
password: "test",
domain: "sina.com",
authentication: :login,
enable_starttls_auto: false,
#openssl_verify_mode: 'peer' # See ActionMailer documentation for other possible options
…
设置邮箱信息
vim /var/opt/gitlab/gitlab-rails/etc/gitlab.yml
13 host: node2.ma.com
41 email_from: lannymxl@sina.com
42 email_display_name: GitLab CE
登录
root登录,修改这个邮箱,试试收到的邮件链接.
如果不设置,gitlab设置个人信息时候发的邮件让你确认,确认链接是gitlab.example.com很是蛋疼.而且比较恶心的是新建的项目
配置主配置文件域名:
vim /var/opt/gitlab/gitlab-rails/etc/gitlab.yml
…
13 host: node2.ma.com
35 time_zone: Asia/Shanghai
…
改完重启下:
gitlab-ctl restart
后期运维还需要考虑git仓库数据迁移备份等,后面再说吧.
测试:
gitlab web界面新建个仓库,并初始化个readme.md文件.
找台git客户端, 做个ssh-key互信.
git pull --- git add -- git commit -- git push origin 测测是否能正常拉取.
怎么访问起来巨慢捏, 我给了个gitlab server 2G的内存.
我用的版本是
9.0吧.