GitLab服务的部署
[root@gitlab ~]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-12.3.5-ce.0.el7.x86_64.rpm [root@gitlab ~]# ll gitlab-ce-12.3.5-ce.0.el7.x86_64.rpm -rw-r--r-- 1 root root 696213194 Oct 7 2019 gitlab-ce-12.3.5-ce.0.el7.x86_64.rpm
(2) 安装
[root@gitlab ~]# yum install -y ./gitlab-ce-12.3.5-ce.0.el7.x86_64.rpm
(3) 配置gitlba.rb
[root@gitlab ~]# vim /etc/gitlab/gitlab.rb [root@gitlab ~]# grep "^[a-z]" /etc/gitlab/gitlab.rb external_url 'http://192.168.145.37' #以下为可选邮件通知设置 gitlab_rails['smtp_enable'] = true gitlab_rails['smtp_address'] = "smtp.qq.com" gitlab_rails['smtp_port'] = 465 gitlab_rails['smtp_user_name'] = "1954938301@qq.com" gitlab_rails['smtp_password'] = "授权码" gitlab_rails['smtp_domain'] = "qq.com" gitlab_rails['smtp_authentication'] = "login" gitlab_rails['smtp_enable_starttls_auto'] = true gitlab_rails['smtp_tls'] = true gitlab_rails['gitlab_email_from'] = "1954938301@qq.com" user["git_user_email"] = "1954938301@qq.com"
(4) 初始化服务
[root@localhost ~]# gitlab-ctl reconfigure
(5) 汉化(非必需)
[root@gitlab ~]# cat /opt/gitlab/embedded/service/gitlab-rails/VERSION 12.3.5 [root@gitlab ~]# wget https://gitlab.com/xhang/gitlab/-/archive/v12.3.5-zh/gitlab-v12.3.5-zh.tar.gz [root@gitlab ~]# ll gitlab-v12.3.5-zh.tar.gz -rw-r--r-- 1 root root 74679232 Aug 17 15:12 gitlab-v12.3.5-zh.tar.gz [root@gitlab ~]# gitlab-ctl stop [root@gitlab ~]# cp -rf /opt/gitlab/embedded/service/gitlab-rails /opt/gitlab-rails.bak [root@gitlab ~]# \cp -rf gitlab-v12.3.5-zh/* /opt/gitlab/embedded/service/gitlab-rails/ [root@gitlab ~]# gitlab-ctl reconfigure [root@gitlab ~]# gitlab-ctl start
之后登录后,在右上角账户下拉框选Settings,然后点击左侧Preferences设备项,然后语言选择中文,保存后刷新界面即可。
[root@gitlab ~]# gitlab-rails console -------------------------------------------------------------------------------- GitLab: 12.3.5 (2417d5becc7) GitLab Shell: 10.0.0 PostgreSQL: 10.9 -------------------------------------------------------------------------------- Loading production environment (Rails 5.2.3) irb(main):001:0> Notify.test_email('收件人邮箱', 'title', 'body').deliver_now