1、更新服务器:
sudo yum update -y && sudo yum upgrade -y
2、下载Gitlab的RPM包
https://packages.gitlab.com/gitlab/gitlab-ce
ce表示开源
el表示centos 选64位
el8对应CentOS8
本教程以centos8为例,在服务器中,下载centos8的rpm包:
cd / && sudo yum install -y wget && sudo wget https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/8/gitlab-ce-16.5.0-ce.0.el8.x86_64.rpm/download.rpm
3、安装依赖:
sudo yum install policycoreutils-python-utils -y
4、用rpm命令安装Gitlab的rpm包:
rpm -ivh gitlab-ce-16.5.0-ce.0.el8.x86_64.rpm
5、安装成功,会显示类似的内容:
Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your GitLab instance by setting `external_url`
configuration in /etc/gitlab/gitlab.rb file.
Then, you can start your GitLab instance by running the following command:
sudo gitlab-ctl reconfigure
For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
Help us improve the installation experience, let us know how we did with a 1 minute survey:
https://gitlab.fra1.qualtrics.com/jfe/form/SV_6kVqZANThUQ1bZb?installation=omnibus&release=15-0
6、打开Gitlab配置文件,配置项目IP访问地址:
vim /etc/gitlab/gitlab.rb
#配置项目的访问地址和端口
external_url 'http://XXX.XXX.XXX.XXX:6868'
#由于默认端口被占用,这里指定监听端口为 6868
nginx['listen_port'] = 6868
gitlab_pages['listen_proxy'] = "XXX.XXX.XXX.XXX:6868"
7、配置完执行生效命令:
sudo gitlab-ctl reconfigure
执行完,最后看到如下提示,则表示新配置应用成功!
INFO: Cinc Client Run complete in 51.157296534 seconds
8、 查看服务状态:
gitlab-ctl status
看到如下信息,这表示服务正在运行中:
9、Gitlab安装初始化后,默认账户名是 root ,密码存放在配置里。查看初始化密码命令:
#查看gitlab初始密码
cat /etc/gitlab/initial_root_password
10、打开上面的配置地址:
http://xxx.xxx.xxx.xxx:6868
11、 修改后台语言:
12、关闭注册功能,账号只能由管理员添加创建,转到 http://xxx.xxx.xxx.xxx:6868/admin/application_settings/general,关闭 已启用注册功能,点击底下的 保存更改。
13、创建用户,转到 http://xxx.xxx.xxx.xxx:6868/admin/ ,点击用户,添加用户: