环境搭建
- 安装依赖软件
yum -y install policycoreutils openssh-server openssh-clients postfix
- 设置postfix开机自启,并启动,postfix支持gitlab发信功能
systemctl enable postfix && systemctl start postfix
- 下载gitlab安装包,然后安装
- 10.0.x版本需要大于4G内存,否则报502(解决办法创建4G的swap,并且赋600权限)
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.0.4-ce.0.el7.x86_64.rpm
rpm -i gitlab-ce-10.0.4-ce.0.el7.x86_64.rpm
chmod -R 755 /var/log/gitlab
- 8.x版本直接安装
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-8.0.0-ce.0.el7.x86_64.rpm
rpm -i gitlab-ce-8.0.0-ce.0.el7.x86_64.rpm
- 修改gitlab配置文件指定服务器ip和自定义端口
vim /etc/gitlab/gitlab.rb
- 重置并启动GitLab
systemctl restart gitlab-runsvdir
gitlab-ctl reconfigure
gitlab-ctl restart
- 查看gitlab版本
head -1 /opt/gitlab/version-manifest.txt
- 设置、重置root密码(下面代码一行一行执行,初始化123456789密码)
cd /opt/gitlab/bin
gitlab-rails console production
u=User.where(id:1).first
u.password=123456789
u.password_confirmation=123456789
u.save!
exit
完全卸载
- 停止gitlab
gitlab-ctl stop
- 卸载gitlab
rpm -e gitlab-ce
- 查看gitlab进程
ps aux | grep gitlab
- 杀掉第一个进程(就是带有好多…的进程)
kill -9 pid
// 杀掉后,在ps aux | grep gitlab确认一遍,还有没有gitlab的进程
- 删除所有包含gitlab文件
find / -name gitlab | xargs rm -rf
汉化
注意gitlab的版本需和汉化版本一致
- 安装git
yum install -y git
- 下载最新的汉化包
cd
git clone https://gitlab.com/xhang/gitlab.git -b v10.0.4-zh
//( -b v10.0.2-zh 版本号自己选)
- 查看该汉化补丁的版本
cat gitlab/VERSION
- 停止gitlab服务
gitlab-ctl stop
- 切换到gitlab汉化包所在的目录
cd /root/gitlab
- 比较汉化标签和原标签,导出patch用的diff文件到/root下(注意版本号)
git diff v10.0.4 v10.0.4-zh > ../10.0.4-zh.diff
- 回到/root目录
cd
- 将10.0.4-zh.diff作为补丁更新到gitlab中(注意版本号)
yum install patch -y
patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < 10.0.4-zh.diff
- 启动gitlab
gitlab-ctl start
- 重新配置gitlab
gitlab-ctl reconfigure