gitlab部署
//关闭防火墙
[root@Server ~]# systemctl disable --now firewalld.service
[root@Server ~]# sed -ri 's/^(SELINUX=).*/1disabled/g' /etc/selinux/config
[root@Server ~]# setenforce 0
setenforce: SELinux is disabled
//配置yum源
[root@Server ~]# curl -o /etc/yum.repos.d/CentOS-base.repo https://mirrors.aliyun.com/repo/Centos-8.repo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2595 100 2595 0 0 9980 0 --:--:-- --:--:-- --:--:-- 9980
[root@Server ~]# sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-base.repo
//配置epel与git
[root@Server ~]# yum -y install epel-release git
//安装依赖包
[root@Server ~]# yum -y install curl openssh-server openssh-clients postfix cronie policycoreutils-python-utils
//启动postfix服务并设置开机自启
[root@Server ~]# systemctl enable --now postfix.service
[root@apache ~]# ss -anlt
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 32 192.168.122.1:53 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 5 127.0.0.1:631 0.0.0.0:*
LISTEN 0 100 127.0.0.1:25 0.0.0.0:*
LISTEN 0 128 0.0.0.0:111 0.0.0.0:*
LISTEN 0 128 [::]:22 [::]:*
LISTEN 0 5 [::1]:631 [::]:*
LISTEN 0 100 [::1]:25 [::]:*
LISTEN 0 80 *:3306 *:*
LISTEN 0 128 [::]:111
//下载gitlab的rpm包
[root@apache ~]# cd /usr/src/
[root@apache src]# wget https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/8/gitlab-ce-13.12.3-ce.0.el8.x86_64.rpm/download.rpm
[root@apache src]# ls
debug download.rpm gitlab-ce-14.3.2-ce.0.el8.x86_64.rpm kernels
//安装gitlab [root@apache src]# rpm -ivh gitlab-ce-14.3.2-ce.0.el8.x86_64.rpm
警告:gitlab-ce-14.3.2-ce.0.el8.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID f27eab47: NOKEY
Verifying... ################################# [100%]
准备中... ################################# [100%]
正在升级/安装...
1:gitlab-ce-14.3.2-ce.0.el8 ################################# [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-3
//修改配置文件
[root@apache ~]# sed -i "s#^external_url 'http://gitlab.example.com'#external_url 'http://192.168.47.128'#g" /etc/gitlab/gitlab.rb
//重新读取配置文件
[root@apache ~]# gitlab-ctl reconfigure
//重启gitlab
[root@apache ~]# gitlab-ctl restart
ok: run: alertmanager: (pid 127025) 1s
ok: run: gitaly: (pid 127058) 0s
ok: run: gitlab-exporter: (pid 127072) 0s
ok: run: gitlab-workhorse: (pid 127076) 0s
ok: run: grafana: (pid 127108) 1s
ok: run: logrotate: (pid 127154) 0s
ok: run: nginx: (pid 127160) 0s
ok: run: node-exporter: (pid 127193) 1s
ok: run: postgres-exporter: (pid 127198) 0s
ok: run: postgresql: (pid 127284) 0s
ok: run: prometheus: (pid 127301) 0s
ok: run: puma: (pid 127394) 0s
ok: run: redis: (pid 127423) 0s
ok: run: redis-exporter: (pid 127429) 1s
ok: run: sidekiq: (pid 127565) 0s
[root@apache ~]# ss -anlt
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 32 192.168.122.1:53 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 5 127.0.0.1:631 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:3000 0.0.0.0:*
LISTEN 0 100 127.0.0.1:25 0.0.0.0:*
LISTEN 0 511 0.0.0.0:8060 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:9121 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:9090 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:9187 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:9093 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:9100 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:9229 0.0.0.0:*
LISTEN 0 128 0.0.0.0:111 0.0.0.0:*
LISTEN 0 511 0.0.0.0:80 0.0.0.0:*
LISTEN 0 128 127.0.0.1:9168 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:9236 0.0.0.0:*
LISTEN 0 128 [::]:22 [::]:*
LISTEN 0 5 [::1]:631 [::]:*
LISTEN 0 100 [::1]:25 [::]:*
LISTEN 0 1024 *:9094 *:*
LISTEN 0 80 *:3306 *:*
LISTEN 0 128 [::]:111 [::]:*
LISTEN 0 128 [::1]:9168 [::]:*
//破解管理员密码
[root@apache ~]# gitlab-rails console -e production
--------------------------------------------------------------------------------
Ruby: ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux]
GitLab: 14.3.2 (92acfb1b8a9) FOSS
GitLab Shell: 13.21.1
PostgreSQL: 12.7
--------------------------------------------------------------------------------
Loading production environment (Rails 6.1.3.2)
irb(main):001:0> user = User.where(id: 1).first
=> #
irb(main):002:0> user.password = '12345678'
=> "12345678"
irb(main):003:0> user.password_confirmation = '12345678'
=> "12345678"
irb(main):004:0> user.save!
Enqueued ActionMailer::MailDeliveryJob (Job ID: 292db0c7-53eb-4753-8ad7-afb833692ddd) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", {:args=>[#>]}
=> true
irb(main):005:0> exit



