gitlab

该博客详细介绍了如何在CentOS 8.5系统上从纯净环境开始部署GitLab。首先更新系统源,然后安装必要依赖包如curl、postfix等,接着下载并安装GitLab的rpm包,解决依赖问题。之后修改GitLab配置文件,设置外部URL,并重载配置文件及重启GitLab服务。最后,通过命令行修改默认管理员密码,关闭防火墙和SELinux以确保GitLab正常运行。
摘要由CSDN通过智能技术生成

gitlab部署

注意!!!在部署之前要确保环境为纯洁环境,内存尽量给多一些

[root@129-master ~]# cd /etc/yum.repos.d/
[root@129-master yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
[root@129-master yum.repos.d]# sed -i 's|^#baseurl=https://download.example/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel*
[root@129-master yum.repos.d]# sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel*
 
# 安装依赖包
yum -y install curl openssh-server openssh-clients postfix cronie  perl

# 启动postfix服务并设置开机自启
[root@129-master ~]# systemctl restart postfix
[root@129-master ~]# systemctl enable postfix
Created symlink /etc/systemd/system/multi-user.target.wants/postfix.service → /usr/lib/systemd/system/postfix.service.

下载gitlab的rpm包

[root@129-master ~]# cd /usr/src/
[root@129-master src]# ls
debug  kernels
[root@129-master src]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-15.3.3-ce.0.el7.x86_64.rpm
此时安装会发现需要一个依赖包 policycoreutils-python
wget https://mirrors.tuna.tsinghua.edu.cn/centos/7/os/x86_64/Packages/policycoreutils-python-2.5-34.el7.x86_64.rpm
[root@129-master src]# ls
debug  gitlab-ce-15.3.3-ce.0.el7.x86_64.rpm  kernels  policycoreutils-python-2.5-34.el7.x86_64.rpm

rpm -ivh gitlab-ce-15.3.3-ce.0.el7.x86_64.rpm --nodeps

修改配置文件

[root@129-master ~]# vim /etc/gitlab/gitlab.rb
external_url 'http://192.168.253.133'  //将此处设为gitlab的服务器ip地址亦或域名

重载配置文件并重启gitlab

[root@129-master ]# gitlab-ctl start
[root@129-master ]# gitlab-ctl reconfigure
ok: run: alertmanager: (pid 27635) 0s
ok: run: gitaly: (pid 27645) 0s
ok: run: gitlab-exporter: (pid 27661) 0s
ok: run: gitlab-kas: (pid 27663) 0s
ok: run: gitlab-workhorse: (pid 27677) 1s
ok: run: logrotate: (pid 27688) 0s
ok: run: nginx: (pid 27694) 1s
ok: run: node-exporter: (pid 27702) 0s
ok: run: postgres-exporter: (pid 27712) 1s
ok: run: postgresql: (pid 27731) 0s
ok: run: prometheus: (pid 27733) 1s
ok: run: puma: (pid 27832) 0s
ok: run: redis: (pid 27837) 1s
ok: run: redis-exporter: (pid 27843) 0s
ok: run: sidekiq: (pid 27853) 0s

查看当前的gitlab版本

[root@129-master src]# head -1 /opt/gitlab/version-manifest.txt
gitlab-ce 15.3.3

破解管理员密码

[root@localhost ~]# gitlab-rails console -e production
--------------------------------------------------------------------------------
 Ruby:         ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
 GitLab:       15.3.3 (c629a47f87f) FOSS
 GitLab Shell: 14.10.0
 PostgreSQL:   13.6
------------------------------------------------------------[ booted in 24.80s ]
Loading production environment (Rails 6.1.6.1)
irb(main):001:0> user = User.where(id:1).first
=> #<User id:1 @root>
irb(main):002:0> user.password = 'renweiwei'
=> "renweiwei"
irb(main):003:0> user.password_confirmation = 'renweiwei'
=> "renweiwei"
irb(main):004:0> user.save!
=> true
irb(main):005:0> exit

关闭防火墙和selinux

[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost ~]#  setenforce 0
[root@localhost ~]# sed -ri 's/^(SELINUX=).*/\1disabled/g' /etc/sysconfig/selinux

在这里插入图片描述
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值