Gitlab14.x 安装、配置、启动 (Centos/Red Hat7/8.x)
  XHDrlE4yaUzu 2023年11月02日 214 0


Gitlab14.x 安装、配置、启动 (Centos/Red Hat7/8.x)_linux

Gitlab14.x 安装、配置、启动 (Centos/Red Hat7/8.x)_git_02

Gitlab14.x 安装、配置、启动 (Centos/Red Hat7/8.x)_oracle_03

文章目录

声明:Centos/Red Hat7/8.x 下载、安装、配置不通的地方我会进行特殊说明,未说明的属于共有部分。

一、下载、安装、配置依赖
1. 安装配置需要的依赖

​https://about.gitlab.com/install/#centos-7​

Gitlab14.x 安装、配置、启动 (Centos/Red Hat7/8.x)_centos_04

Gitlab14.x 安装、配置、启动 (Centos/Red Hat7/8.x)_centos_05

# On CentOS 7 (and RedHat/Oracle/Scientific Linux 7), the commands below will also open HTTP, HTTPS and SSH access in the system firewall. This is an optional step, and you can skip it if you intend to access GitLab only from your local network.
sudo yum install -y policycoreutils-python openssh-server perl

# Enable OpenSSH server daemon if not enabled: sudo systemctl status sshd
sudo systemctl enable sshd
sudo systemctl start sshd

# Check if opening the firewall is needed with: sudo systemctl status firewalld
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo systemctl reload firewalld

# Next, install Postfix to send notification emails. If you want to use another solution to send emails please skip this step and configure an external SMTP server after GitLab has been installed.
sudo yum install postfix
sudo systemctl enable postfix
sudo
2. Gitlab下载

Centos/Red Hat7.x 下载链接:

​https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/​

Gitlab14.x 安装、配置、启动 (Centos/Red Hat7/8.x)_centos_06


Centos/Red Hat8.x 下载链接:

​https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el8/​

Gitlab14.x 安装、配置、启动 (Centos/Red Hat7/8.x)_linux_07

3. 安装Gitlab
# Centos/Red Hat7.x 安装方式
[root@localhost ~]# rpm -ivh gitlab-ce-14.2.3-ce.0.el7.x86_64.rpm

# Centos/Red Hat8.x 安装方式
[root@localhost ~]# rpm -ivh gitlab-ce-14.2.3-ce.0.el8.x86_64.rpm

操作记录:

[root@localhost ~]# rpm -ivh gitlab-ce-14.2.3-ce.0.el7.x86_64.rpm 
警告:gitlab-ce-14.2.3-ce.0.el7.x86_64.rpm: 头V4 RSA/SHA1 Signature, 密钥 ID f27eab47: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:gitlab-ce-14.2.3-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-2

[root@localhost ~]#
4. 配置external_url
[root@localhost ~]# vim /etc/gitlab/gitlab.rb
#external_url 'http://gitlab.example.com'调整为http://+ip:端口的格式
external_url 'http://192.168.159.102:8000'

Gitlab14.x 安装、配置、启动 (Centos/Red Hat7/8.x)_git_08

5. 重新加载配置文件
[root@localhost ~]# sudo gitlab-ctl reconfigure

Gitlab14.x 安装、配置、启动 (Centos/Red Hat7/8.x)_centos_09


等着安装完毕就好了

6. 查看服务状态
sudo

Gitlab14.x 安装、配置、启动 (Centos/Red Hat7/8.x)_git_10

7. 配置防火墙
#开放端口(开放后需要要重启防火墙才生效)
firewall-cmd --zone=public --add-port=8000/tcp --permanent

# 重新启动防火墙

Gitlab14.x 安装、配置、启动 (Centos/Red Hat7/8.x)_oracle_11

8. 浏览器验证
# 格式:IP+端口号(默认8080)

这个Gitlab14.x版本,和以前有些不同,以前的第一次访问会让你设置root用户的密码,但是这个版本,默认为你配置了密码

Gitlab14.x 安装、配置、启动 (Centos/Red Hat7/8.x)_git_12

9. 寻找密码信息

安装完成后,最后会有以下信息

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,root用户的密码存放到​​​/etc/gitlab/initial_root_password​​文件中了,请在24小时内修改密码。

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

Gitlab14.x 安装、配置、启动 (Centos/Red Hat7/8.x)_配置文件_13

10. 查看密码
[root@localhost ~]# cat /etc/gitlab/initial_root_password

# WARNING: This value is valid only in the following conditions
# 1. If provided manually (either via `GITLAB_ROOT_PASSWORD` environment variable or via `gitlab_rails['initial_root_password']` setting in `gitlab.rb`, it was provided before database was seeded for the first time (usually, the first reconfigure run).
# 2. Password hasn't been changed manually, either via UI or via command line.
#
# If the password shown here doesn't work, you must reset the admin password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.

Password: oQIWkCNmUtrOeYebj8vVJ53CocII+ZlpWhzssaLUH5c=

# NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.
[root@localhost ~]#
11. 重新登陆

Gitlab14.x 安装、配置、启动 (Centos/Red Hat7/8.x)_git_14


Gitlab14.x 安装、配置、启动 (Centos/Red Hat7/8.x)_git_15

12. 修改密码

Gitlab14.x 安装、配置、启动 (Centos/Red Hat7/8.x)_oracle_16

13. 重新登陆

Gitlab14.x 安装、配置、启动 (Centos/Red Hat7/8.x)_linux

Gitlab14.x 安装、配置、启动 (Centos/Red Hat7/8.x)_git_02

Gitlab14.x 安装、配置、启动 (Centos/Red Hat7/8.x)_oracle_03

14. Gitlab常用命令

命令功能

执行命令

重启配置,并启动gitlab服务

sudo gitlab-ctl reconfigure

启动所有 gitlab

sudo gitlab-ctl start

重新启动GitLab

sudo gitlab-ctl restart

停止所有 gitlab

sudo gitlab-ctl stop

查看服务状态

sudo gitlab-ctl status

查看Gitlab日志

sudo gitlab-ctl tail

修改默认的配置文件

sudo vim /etc/gitlab/gitlab.rb

检查gitlab

gitlab-rake gitlab:check SANITIZE=true --trace


接下一篇:​​Centos/Red Hat7/8.x 安装、配置、启动Gitlab14.x (语言和主题配置​

想学习更多前后端分离、微服务、分布式、MQ/缓存/引擎中间件、数据库、项目重构技巧等系列技术

请移步技术专栏 ​​https://gblfy.com​

让我们一起进步!!!


【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月08日 0

暂无评论

推荐阅读
  9E2BTpjt8nym   2023年12月06日   35   0   0 WindowsgitCentOS
XHDrlE4yaUzu