CentOS7下安装gitlab

依赖环境安装
[root@localhost ~]# yum -y install curl openssh-server ca-certificates postfix

[root@localhost ~]# systemctl enable postfix #设置开机启动

[root@localhost ~]# systemctl start postfix #开启postfix服务

下载软件rpm包并安装
[root@localhost src]#

curl -LJO https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-9.2.2-ce.0.el7.x86_64.rpm

安装软件包

[root@localhost home]# rpm -i gitlab-ce-9.2.2-ce.0.el7.x86_64.rpm

修改和自定义默认端口
[root@localhost home]# vim /etc/gitlab/gitlab.rb

external_url 'http://192.168.1.196:8089'

ps:注意这里设置的端口不能被占用,默认是8080端口,如果8080已经使用,请自定义其它端口,并在防火墙设置开放相对应得端口

启动GitLab
[root@localhost home]# gitlab-ctl restart

[root@localhost home]# gitlab-ctl reconfigure #重置

提示”OK”表示启动成功;

汉化GitLab
使用浏览器访问服务器IP地址+端口名 192.168.1.196:8089

默认用户名和密码: root /5iveL!fe

这时的页面是英文版本的;

汉化包下载地址: https://github.com/htve/GitlabForChinese/releases 并下载相应版本的汉化包

导入汉化包

[root@localhost home]# patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 <v9.2.2.zh1.diff

重启GitLab服务 :gitlab-ctl restart

修改GitLab的仓库存储路径
修改GitLab的配置文件,找到git_data_dir位置

[root@localhost ~]# vim /etc/gitlab/gitlab.rb

git_data_dir “路径”

停止当前GitLab,重新加载

[root@localhost ~]# gitlab-ctl stop

[root@localhost ~]# gitlab-ctl reconfigure

就会在配置的路径下多出一个目录

[root@localhost ~]# gitlab-ctl start #再启动服务

[root@localhost ~]# systemctl start postfix

root密码重置
gitlab-rails console production

user = User.where(id: 1).first

user.password = '要设置的密码'

user.password_confirmation = '要设置的密码' 12345678

user.save!

查看gitlab版本号: cat /opt/gitlab/version-manifest.json | grep build_version

原文地址:https://www.cnblogs.com/free-long/p/8603341.html