1.安装
新建 /etc/yum.repos.d/gitlab-ce.repo
,内容为
[gitlab-ce]
name=gitlab-ce
baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6
repo_gpgcheck=0
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/gpg.key
再执行
sudo yum makecache
sudo yum install gitlab-ce
2. 基本命令
1.查看状态
gitlab-ctl status
run: gitlab-workhorse: (pid 3133) 5619s; run: log: (pid 3000) 5687s run: logrotate: (pid 7021) 2078s; run: log: (pid 3023) 5679s run: nginx: (pid 3008) 5685s; run: log: (pid 3007) 5685s run: postgresql: (pid 2861) 5735s; run: log: (pid 2860) 5735s run: redis: (pid 2778) 5741s; run: log: (pid 2777) 5741s run: sidekiq: (pid 2991) 5688s; run: log: (pid 2990) 5688s run: unicorn: (pid 2960) 5694s; run: log: (pid 2959) 5694s |
2.启动和停止
# Start all GitLab components
sudo gitlab-ctl start
# Stop all GitLab components
sudo gitlab-ctl stop
# Restart all GitLab components
sudo gitlab-ctl restart
3.配置
1.配置smtp
vi /etc/gitlab/gitlab.rb
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.exmail.qq.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "xxxx@xx.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'] = 'xxxx@xx.com'
2.配置访问域名
修改 external_url
,编辑 /etc/gitlab/gitlab.rb
:
external_url "git.home.com"
修改 /etc/hosts ,添加
127.0.0.1 git.home.com
Reconfigure GitLab 使上面的修改生效:
sudo gitlab-ctl reconfigure
重启下GitLab:
sudo gitlab-ctl restart
在本地修改 git.home.com 只想gitlab-ce服务器的地址即可.
3.汉化
首先确认当前安装版本
cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
当前安装版本是8.5.7
,因此中文补丁需要打8.5版本
。
克隆 GitLab 源码仓库:
# 克隆 GitLab.com 仓库
git clone https://gitlab.com/larryli/gitlab.git
#或 Gitcafe.com 镜像,速度更快
git clone https://gitcafe.com/larryli/gitlab.git
运行汉化补丁:
# 8.5 版本的汉化补丁(8-5-stable是英文稳定版,8-5-zh是中文版,两个 diff 结果便是汉化补丁)
sudo git diff origin/8-5-stable..8-5-zh > /tmp/8.5.diff
# 停止 gitlab
sudo gitlab-ctl stop
# 应用汉化补丁
cd /opt/gitlab/embedded/service/gitlab-rails
git apply /tmp/8.5.diff
# 启动gitlab
sudo gitlab-ctl start
至此,汉化完毕。打开地址http://git.home.com
,便会看到中文版的GitLab
。
4.配置postgresql
内置的也可以使用.如果要使用外置用一下配置