############# 常用命令 1.更新配置 sudo gitlab-ctl reconfigure 2.重启 sudo gitlab-ctl restart 3.状态 sudo gitlab-ctl status 4.停止 gitlab-ctl stop ############1.安装软件 [root@gitlab ~]# yum install -y curl policycoreutils-python openssh-server #安装依赖 [root@gitlab ~]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.2.2-ce.0.el7.x86_64.rpm #下载软件包 [root@gitlab ~]# rpm -ivh gitlab-ce-10.2.2-ce.0.el7.x86_64.rpm #安装gitlab ########### 2.修改配置 根据安装完成提示界面进行访问URL更改及重新加载配置文件 更改次选项为自己的域名或者IP external_url 'http://gitlab.example.com' [root@gitlab ~]# vim /etc/gitlab/gitlab.rb #编辑配置文件 external_url 'http://192.168.1.21' #改为自己的IP地址 [root@gitlab ~]# gitlab-ctl reconfigure #重新加载配置文件 [root@gitlab ~]# vim /etc/gitlab/gitlab.rb ## GitLab URL ##! URL on which GitLab will be reachable. ##! For more details on configuring external_url see: ##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab ###要修改的地方 external_url 'http://62.234.18.0:8777' ### 配置邮件新用户会收到邮件 gitlab_rails['smtp_enable'] = true gitlab_rails['smtp_address'] = "smtp.exmail.qq.com" gitlab_rails['smtp_port'] = 465 gitlab_rails['smtp_user_name'] = "3268727800@qq.com" gitlab_rails['smtp_password'] = "密码" gitlab_rails['smtp_authentication'] = "login" gitlab_rails['smtp_enable_starttls_auto'] = true gitlab_rails['smtp_tls'] = true gitlab_rails['gitlab_email_from'] = '3268727800@qq.com' gitlab_rails['smtp_domain'] = "exmail.qq.com" ### 出现异常如下(unicorn['port'] = 8087 修改这个端口就可以): ### Whoops, GitLab is taking too much time to respond. 502 ### Advanced settings # unicorn['listen'] = '127.0.0.1' unicorn['port'] = 8087 # unicorn['socket'] = '/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket' # unicorn['pidfile'] = '/opt/gitlab/var/unicorn/unicorn.pid' # unicorn['tcp_nopush'] = true # unicorn['backlog_socket'] = 1024 ########### 3.编辑完更新配置就可以 [root@gitlab ~]# gitlab-ctl reconfigure #重新加载配置文件 ########### 4.启动会让输入新的密码,输入确认即可。 http://62.234.18.0:8777/ ########### 5.登录 http://62.234.18.0:8777/ 用户:root(系统默认) 密码:第一次输入的。 ########### 6.汉化 1、下载汉化补丁 [root@gitlab ~]# git clone https://gitlab.com/xhang/gitlab.git [root@gitlab ~]# cd gitlab 2、查看全部分支版本 [root@gitlab ~]# git branch -a 3、对比版本、生成补丁包 [root@gitlab ~]# git diff remotes/origin/10-2-stable remotes/origin/10-2-stable-zh > /tmp/10.2.2-zh.diff 4、停止服务器 [root@gitlab ~]# gitlab-ctl stop 5、打补丁 [root@gitlab ~]# patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < /tmp/10.2.2-zh.diff 6、启动和重新配置 [root@gitlab ~]# gitlab-ctl start [root@gitlab ~]# gitlab-ctl reconfigure ############# 安装邮件(可以省略,邮件发送不成功在配置) 1. 安装依赖软件 yum -y install policycoreutils openssh-server openssh-clients postfix 2.设置postfix开机自启,并启动,postfix支持gitlab发信功能 systemctl enable postfix && systemctl start postfix [root@ ~]# systemctl start postfix Job for postfix.service failed because the control process exited with error code. See "systemctl status postfix.service" and "journalctl -xe" for details. 修改 /etc/postfix/main.cf的设置 inet_protocols = ipv4 inet_interfaces = all ############# 测试配置是否成功: 执行 gitlab-rails console进入控制台。 发送一封测试邮件:Notify.test_email('收件人邮箱', 'title', 'body').deliver_now irb(main):001:0> Notify.test_email('3268727800@qq.com', 'git测试', '这个是三三四四所所所所所所所所所所所所所所所所所所所所所所所所').deliver_now #重新配置 gitlab_rails['smtp_enable'] = true gitlab_rails['smtp_address'] = "smtp.qq.com" gitlab_rails['smtp_port'] = 465 gitlab_rails['smtp_user_name'] = "3268727800@qq.com" gitlab_rails['smtp_password'] = "授权码(开启服务: POP3/SMTP服务 (如何使用 Foxmail 等软件收发邮件?) 已开启 | 关闭会弹出授权码)" gitlab_rails['smtp_domain'] = "smtp.qq.com" gitlab_rails['smtp_authentication'] = "login" gitlab_rails['smtp_enable_starttls_auto'] = true gitlab_rails['smtp_tls'] = true gitlab_rails['gitlab_email_from'] = '3268727800@qq.com'