Centos7 安装 gitlab

1、介绍

GitLab 是一个用于仓库管理系统的开源项目。使用Git作为代码管理工具,并在此基础上搭建起来的web服务。
gitlab 手工安装超级复杂,所以一般使用集成安装包。国内下载比较慢,走国内镜像比较好,清华的镜像最快。

2、相关资料

gitlab 官网:https://about.gitlab.com/
gitlab 安装地址:https://about.gitlab.com/downloads/#centos7
gitlab 各版本的安装包:https://packages.gitlab.com/gitlab/gitlab-ce
gitlab 的 github 地址:https://github.com/gitlabhq/gitlabhq.git

清华镜像:https://mirrors.tuna.tsinghua.edu.cn/help/gitlab-ce/
gitlab 汉化地址:https://github.com/larryli/gitlabhq.git

3、安装

3.1、预安装环境

sudo yum install curl policycoreutils openssh-server openssh-clients postfix
sudo systemctl enable sshd
sudo systemctl start sshd
sudo systemctl enable postfix
sudo systemctl start postfix
sudo firewall-cmd --permanent --add-service=http
sudo systemctl reload firewalld

3.2、安装

#gitlab各版本的安装包:https://packages.gitlab.com/gitlab/gitlab-ce
#官网下载地址:https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-8.8.7-ce.1.el7.x86_64.rpm
#清华镜像地址:http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-8.8.7-ce.1.el7.x86_64.rpm
#官网下载地址与清华镜像地址只是域名不同,下载时注意替换
#axel 为linux下的多线程下载工具,如果没有可以使用 wget 或curl

axel http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-8.8.7-ce.1.el7.x86_64.rpm
sudo rpm -ivh gitlab-ce-8.8.7-ce.1.el7.x86_64.rpm
sudo gitlab-ctl reconfigure

3.3、配置

sudo vim /etc/gitlab/gitlab.rb

#配置域名
#external_url 'http://localhost'            #此行注释掉,复制并修改为自己的域名
external_url 'http://gitlab.local.com'

#邮箱
gitlab_rails['gitlab_email_from'] = '【发送邮件的邮箱】'

gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.163.com"
gitlab_rails['smtp_port'] = 25
gitlab_rails['smtp_user_name'] = "【提供163的smtp的用户名】"
gitlab_rails['smtp_password'] = "【你的密码】"
gitlab_rails['smtp_domain'] = "163.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true

user['git_user_name'] = "【设置发件用户名】"
user['git_user_email'] = "【发送邮件的邮箱】"

#重新加载配置
sudo gitlab-ctl reconfigure

4、安装汉化包

4.1、查看当前版本

cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
8.8.7

4.2、选择与版本对应的汉化包

git clone https://github.com/larryli/gitlabhq.git
git checkout 8-8-stable                              #8-8-stable是英文稳定版
git checkout 8-8-zh                                    #8-8-zh是中文版

4.3、生成并应用汉化补丁

#两个 版本 diff 结果便是8.8 版本的汉化补丁
git diff origin/8-8-stable..8-8-zh > /tmp/8.8.diff

#停止 gitlab
sudo gitlab-ctl stop

#应用汉化补丁
cd /opt/gitlab/embedded/service/gitlab-rails
git apply /tmp/8.8.diff  

#启动gitlab
sudo gitlab-ctl start
posted @ 2016-07-12 10:13  菁武  阅读(171)  评论(0编辑  收藏  举报