一 下载
清华大学开源软件镜像站 https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/?C=M&O=D
2022-07-01版本(找到CentOS7对应的el7版本):
[root@hecs ]cd /opt
[root@hecs opt]wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-14.10.5-ce.0.el7.x86_64.rpm
二 在线安装
2.1 安装依赖
[root@hecs opt]sudo yum install -y curl policycoreutils-python openssh-server postfix
2.1.1依赖显示
--2022-07-17 12:27:43-- https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-14.10.5-ce.0.el7.x86_64.rpm
正在解析主机 mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.15.130, 2402:f000:1:400::2
正在连接 mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.15.130|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:1038273357 (990M) [application/x-redhat-package-manager]
正在保存至: “gitlab-ce-14.10.5-ce.0.el7.x86_64.rpm”
100%[=========================================================================================================================================================>] 1,038,273,357 11.4MB/s 用时 88s
2022-07-17 12:29:11 (11.3 MB/s) - 已保存 “gitlab-ce-14.10.5-ce.0.el7.x86_64.rpm” [1038273357/1038273357])
[root@hecs-234032 opt]# sudo yum install -y curl policycoreutils-python openssh-server postfix
已加载插件:fastestmirror
Determining fastest mirrors
base | 3.6 kB 00:00:00
epel | 4.7 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/7): base/7/x86_64/group_gz | 153 kB 00:00:00
(2/7): epel/x86_64/group_gz | 96 kB 00:00:00
(3/7): epel/x86_64/primary_db | 7.0 MB 00:00:00
(4/7): extras/7/x86_64/primary_db | 247 kB 00:00:00
(5/7): epel/x86_64/updateinfo | 1.1 MB 00:00:01
(6/7): updates/7/x86_64/primary_db | 16 MB 00:00:02
(7/7): base/7/x86_64/primary_db | 6.1 MB 00:00:06
软件包 curl-7.29.0-59.el7_9.1.x86_64 已安装并且是最新版本
软件包 openssh-server-7.4p1-22.el7_9.x86_64 已安装并且是最新版本
软件包 2:postfix-2.10.1-9.el7.x86_64 已安装并且是最新版本
正在解决依赖关系
--> 正在检查事务
---> 软件包 policycoreutils-python.x86_64.0.2.5-34.el7 将被 安装
--> 正在处理依赖关系 setools-libs >= 3.3.8-4,它被软件包 policycoreutils-python-2.5-34.el7.x86_64 需要
--> 正在处理依赖关系 libsemanage-python >= 2.5-14,它被软件包 policycoreutils-python-2.5-34.el7.x86_64 需要
--> 正在处理依赖关系 audit-libs-python >= 2.1.3-4,它被软件包 policycoreutils-python-2.5-34.el7.x86_64 需要
--> 正在处理依赖关系 python-IPy,它被软件包 policycoreutils-python-2.5-34.el7.x86_64 需要
--> 正在处理依赖关系 libqpol.so.1(VERS_1.4)(64bit),它被软件包 policycoreutils-python-2.5-34.el7.x86_64 需要
--> 正在处理依赖关系 libqpol.so.1(VERS_1.2)(64bit),它被软件包 policycoreutils-python-2.5-34.el7.x86_64 需要
--> 正在处理依赖关系 libcgroup,它被软件包 policycoreutils-python-2.5-34.el7.x86_64 需要
--> 正在处理依赖关系 libapol.so.4(VERS_4.0)(64bit),它被软件包 policycoreutils-python-2.5-34.el7.x86_64 需要
--> 正在处理依赖关系 checkpolicy,它被软件包 policycoreutils-python-2.5-34.el7.x86_64 需要
--> 正在处理依赖关系 libqpol.so.1()(64bit),它被软件包 policycoreutils-python-2.5-34.el7.x86_64 需要
--> 正在处理依赖关系 libapol.so.4()(64bit),它被软件包 policycoreutils-python-2.5-34.el7.x86_64 需要
--> 正在检查事务
---> 软件包 audit-libs-python.x86_64.0.2.8.5-4.el7 将被 安装
---> 软件包 checkpolicy.x86_64.0.2.5-8.el7 将被 安装
---> 软件包 libcgroup.x86_64.0.0.41-21.el7 将被 安装
---> 软件包 libsemanage-python.x86_64.0.2.5-14.el7 将被 安装
---> 软件包 python-IPy.noarch.0.0.75-6.el7 将被 安装
---> 软件包 setools-libs.x86_64.0.3.3.8-4.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
=====================================================================================================================================================================================================
Package 架构 版本 源 大小
=====================================================================================================================================================================================================
正在安装:
policycoreutils-python x86_64 2.5-34.el7 base 457 k
为依赖而安装:
audit-libs-python x86_64 2.8.5-4.el7 base 76 k
checkpolicy x86_64 2.5-8.el7 base 295 k
libcgroup x86_64 0.41-21.el7 base 66 k
libsemanage-python x86_64 2.5-14.el7 base 113 k
python-IPy noarch 0.75-6.el7 base 32 k
setools-libs x86_64 3.3.8-4.el7 base 620 k
事务概要
=====================================================================================================================================================================================================
安装 1 软件包 (+6 依赖软件包)
总下载量:1.6 M
安装大小:5.3 M
Downloading packages:
(1/7): audit-libs-python-2.8.5-4.el7.x86_64.rpm | 76 kB 00:00:00
(2/7): libcgroup-0.41-21.el7.x86_64.rpm | 66 kB 00:00:00
(3/7): libsemanage-python-2.5-14.el7.x86_64.rpm | 113 kB 00:00:00
(4/7): checkpolicy-2.5-8.el7.x86_64.rpm | 295 kB 00:00:00
(5/7): python-IPy-0.75-6.el7.noarch.rpm | 32 kB 00:00:00
(6/7): policycoreutils-python-2.5-34.el7.x86_64.rpm | 457 kB 00:00:00
(7/7): setools-libs-3.3.8-4.el7.x86_64.rpm | 620 kB 00:00:00
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计 1.6 MB/s | 1.6 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
警告:RPM 数据库已被非 yum 程序修改。
正在安装 : libcgroup-0.41-21.el7.x86_64 1/7
正在安装 : setools-libs-3.3.8-4.el7.x86_64 2/7
正在安装 : audit-libs-python-2.8.5-4.el7.x86_64 3/7
正在安装 : python-IPy-0.75-6.el7.noarch 4/7
正在安装 : libsemanage-python-2.5-14.el7.x86_64 5/7
正在安装 : checkpolicy-2.5-8.el7.x86_64 6/7
正在安装 : policycoreutils-python-2.5-34.el7.x86_64 7/7
验证中 : checkpolicy-2.5-8.el7.x86_64 1/7
验证中 : libsemanage-python-2.5-14.el7.x86_64 2/7
验证中 : python-IPy-0.75-6.el7.noarch 3/7
验证中 : policycoreutils-python-2.5-34.el7.x86_64 4/7
验证中 : audit-libs-python-2.8.5-4.el7.x86_64 5/7
验证中 : setools-libs-3.3.8-4.el7.x86_64 6/7
验证中 : libcgroup-0.41-21.el7.x86_64 7/7
已安装:
policycoreutils-python.x86_64 0:2.5-34.el7
作为依赖被安装:
audit-libs-python.x86_64 0:2.8.5-4.el7 checkpolicy.x86_64 0:2.5-8.el7 libcgroup.x86_64 0:0.41-21.el7 libsemanage-python.x86_64 0:2.5-14.el7 python-IPy.noarch 0:0.75-6.el7
setools-libs.x86_64 0:3.3.8-4.el7
完毕!
[root@hecs opt]#
2.1.2 设置与启动
#配置开机启动
sudo systemctl enable sshd
sudo systemctl enable postfix
#启动ssh和postfix
sudo systemctl start sshd
sudo systemctl start postfix
2.2 安装gitlab
[root@hecs ]#cd /opt
[root@hecs opt]#sudo rpm -ivh gitlab-ce-14.10.5-ce.0.el7.x86_64.rpm
安装过程:
警告:gitlab-ce-14.10.5-ce.0.el7.x86_64.rpm: 头V4 RSA/SHA1 Signature, 密钥 ID ****: *****
准备中... ################################# [100%]
正在升级/安装...
1:gitlab-ce-14.10.5-ce.0.el7 ################################# [100%]
It looks like GitLab has not been configured yet; skipping the upgrade script.
*. *.
*** ***
***** *****
.****** *******
******** ********
,,,,,,,,,***********,,,,,,,,,
,,,,,,,,,,,*********,,,,,,,,,,,
.,,,,,,,,,,,*******,,,,,,,,,,,,
,,,,,,,,,*****,,,,,,,,,.
,,,,,,,****,,,,,,
.,,,***,,,,
,*,.
_______ __ __ __
/ ____(_) /_/ / ____ _/ /_
/ / __/ / __/ / / __ `/ __ \
/ /_/ / / /_/ /___/ /_/ / /_/ /
\____/_/\__/_____/\__,_/_.___/
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=14-10
2.3 修改配置文件
备份/etc/gitlab/gitlab.rb
[root@hecs opt]cp /etc/gitlab/gitlab.rb /etc/gitlab/gitlab.rb.bak
修改 vi /etc/gitlab/gitlab.rb
external_url 'http://ip:8712'
gitlab_rails['time_zone'] = 'Asia/Shanghai'
gitlab_rails['gitlab_default_can_create_group'] = false
# puma['per_worker_max_memory_mb'] = 1024 ## 默认情况下大概占用3.8g内存。
puma['per_worker_max_memory_mb'] = 512 ## 一开始内存减少,但是cup飙高,但是后面cpu降低,内存稍微增高。
2.4 重新配置并启动
[root@hecs opt]sudo gitlab-ctl reconfigure
#其他常用命令
[root@hecs opt]sudo gitlab-ctl start
[root@hecs opt]sudo gitlab-ctl stop
[root@hecs opt]sudo gitlab-ctl restart
#开放防火墙(先测试端口是否开放)
[root@hecs opt]sudo firewall-cmd --zone=public --add-port=8712/tcp --permanent && sudo firewall-cmd --reload
安装完成提示:
Notes:
Default admin account has been configured with following details:
Username: root
Password: You didn't opt-in to print initial root password to STDOUT.
Password stored to /etc/gitlab/initial_root_password. This file will be cleaned up in first reconfigure run after 24 hours.
NOTE: Because these credentials might be present in your log files in plain text, it is highly recommended to reset the password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.
gitlab Reconfigured!
三 初始密码
[root@hecs opt]cat /etc/gitlab/initial_root_password
Password: ***BYt+Tiyeh1DJKRGSoKhk2fxTDnAObwV+aFaFp***
将Password内容复制去登录界面登录即可
四 登录
http://ip:8712/
账号:admin
密码:123456
五 设置
5.1 设置中文
刷新页面即可看见中文显示。
5.2 重置密码
5.3 注册限制
菜单->管理员->设置 ,找到注册限制,把"已启用注册功能、新的注册需要管理员批准"前面的勾去掉即可。登录页面就不会有注册功能显示了。
【设置前】
【设置后】
页面拉下去保存即可,再退出登录查看页面:
六 用户
默认管理员用户:root
6.1自定义用户
创建管理员用户:cyzhong
1)菜单->管理员:概况->用户,点击创建用户按钮,填写信息(可设置管理员)后保存即可。保存后,可以重新编辑进行修改密码。
2)首次登录的用户需要修改密码。