自己安装一个gitlab

1、安装相关依赖
yum install curl policycoreutils-python openssh-server postfix wget -y
2、设置开机启动

systemctl enable sshd && systemctl start sshd
systemctl enable postfix && systemclt start postfix 

3、开放 ssh http服务重新加载防火墙

firewall-cmd --add-service=ssh --premanent
firewall-cmd --add-service=ssh --premanent
firewall-cmd reload

如果关闭防火墙就不需要设置
5、下载gitlab 并安装

wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-14.6.7-ce.0.el7.x86_64.rpm/download.rpm --no-check-certificate 
rpm -ivh gitlab-ce-14.6.7-ce.0.el7.x86_64.rpm 

6、配置地址和端口

vi /etc/gitlab/gitlab.rb
编写:external_url'http:192.168.0.100:82'
修改:nginx['listen_port']82

7、重新配置机启动

gitlab-ctl reconfigure
gitlab-ctl restart
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.
[root@localhost ~]# gitlab-ctl restart
ok: run: alertmanager: (pid 8745) 0s
ok: run: gitaly: (pid 8756) 0s
ok: run: gitlab-exporter: (pid 8778) 0s
ok: run: gitlab-workhorse: (pid 8781) 0s
ok: run: logrotate: (pid 8797) 0s
ok: run: nginx: (pid 8819) 1s
ok: run: node-exporter: (pid 8827) 0s
ok: run: postgres-exporter: (pid 8832) 0
ok: run: postgresql: (pid 8861) 0s
ok: run: prometheus: (pid 8863) 0s
ok: run: puma: (pid 8888) 0s
ok: run: redis: (pid 8895) 0s
ok: run: redis-exporter: (pid 8901) 1s
ok: run: sidekiq: (pid 8917) 0s
[root@localhost ~]# 

8、把端口加入到防火墙:

firewall-cmd --zone=public --add-port=82/tcp --permanent
firewall-cmd --reload

可以登陆访问了
减少耗内存
解决方法:

top -ac 看一下开启了多少unicorn worker进程,gitlab默认开启进程数与CPU内核数相同

vim /etc/gitlab/gitlab.rb
unicorn['worker_processes'] = 4
postgresql['shared_buffers'] = "256MB"
默认为256MB,可适当改小

减少并发数
postgresql['max_wer_processes'] = 8 --减少数据库并发数
sidekiq['concurrency'] = 25 -- 减少sidekiq并发数
https://blog.csdn.net/weixin_30672295/article/details/99610321
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
卸载
gitlab-ctl stop
rpm -e gitlab-ce
ps aux | grep gitlab
kill -9 杀掉第一个进程
ind / -name gitlab | xargs rm -rf

posted @ 2022-04-03 12:28  donghongchao  阅读(72)  评论(0编辑  收藏  举报