Gitlab私有仓库部署(一)
14.启动gitlab报错,执行 systemctl start gitlab-runsvdir ,用于启动gitlab运行服务目录(runsvdir)13.登录gitlab并新建空白项目,根据新建空白项目首页提示,在本地IDE配置git并推送项目代码到gitlab仓库。15.gitlab占内存太高处理,执行vim /etc/gitlab/gitlab.rb,修改gitlab配置文件。执行后,原窗
参考文章GitLab下载安装_GitLab最新中文基础版下载安装-极狐GitLab
CentOS上完全卸载gitlab_51CTO博客_centos 卸载
简单易行!CentOS 7上安装GitLab社区版的教程_正义的卓别林的博客-CSDN博客
MobaXterm连接远程服务器,使用Linux命令行上传下载文件_mobaxerm连接服务器-CSDN博客Gitlab初始化卡住不动_ruby_block[wait for redis service socket] action r-CSDN博客
Linux初装gitlab初始默认密码_linux gitlab配置初始化密码-CSDN博客
本文主要记录2023/11/7在Centos7上部署Gitlab私有仓库的操作过程,以及过程中问题的处理。
[root@gitlab ~]# hostnamectl
Static hostname: gitlab
Icon name: computer-vm
Chassis: vm
Machine ID: df82112c37d742c8a559f34d1de7fe71
Boot ID: b4c33ccad67c4d8e9fd06cc71bf7e3b6
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-1160.el7.x86_64
Architecture: x86-64
1.从清华大学开源软件镜像站下载gitlab CE包,再上传到Linux上,这里使用Centos7
说明 下载过程中看到不同包EL6、EL7、EL8
EL是Red Hat Enterprise L inux(EL)的缩写。
- EL6是Red Hat 6.x,CentOS 6.x和CloudLinux 6.x的下载。
- EL5是Red Hat 5.x,CentOS 5.x和CloudLinux 5.x的下载。
- EL7是Red Hat 7.x,CentOS 7.x和CloudLinux 7.x的下载。
2.安装相关依赖
yum -y install policycoreutils openssh-server openssh-clients postfifix
3.启动ssh服务&设置为开机启动
systemctl enable sshd && sudo systemctl start sshd
4.设置postfifix开机自启,并启动,postfifix支持gitlab发信功能
systemctl enable postfifix && systemctl start postfifix
5.开放ssh以及http服务,然后重新加载防火墙列表
fifirewall-cmd --add-service=ssh --permanent fifirewall-cmd --add-service=http --permanent fifirewall-cmd --reload
6.安装
rpm -i gitlab-ce-16.3.6-ce.0.el7.x86_64.rpm
7.修改gitlab配置
vi /etc/gitlab/gitlab.rb
修改gitlab访问地址为服务器的ip
external_url 'http://192.168.4.107:82'
8.重载配置及启动 这里会卡死
gitlab-ctl reconfigure // 这里执行会卡死
在下面这个地方卡死
ruby_block[wait for redis service socket] action run
解放方法:重开一个端口,并执行以下命令
/opt/gitlab/embedded/bin/runsvdir-start
执行后,原窗口继续往下走,直到显示如下信息时,该步骤成功完成。
gitlab Configured!
9.开放第7步配置的http端口,用于http访问
firewall-cmd --zone=public --add-port=82/tcp --permanent # 开放82端口,用于http访问
firewall-cmd --reload # 重启防火墙
10.gitlab启停相关操作
gitlab-ctl status
使用控制台实时查看日志
# 查看所有的logs; 按 Ctrl-C 退出
gitlab-ctl tail
# 拉取/var/log/gitlab下子目录的日志
gitlab-ctl tail gitlab-rails
# 拉取某个指定的日志文件
gitlab-ctl tail nginx/gitlab_error.log
#启动关闭gitlab
gitlab-ctl start
gitlab-ctl stop #停止
gitlab-ctl status #查看状态
gitlab-ctl restart #重启
gitlab-ctl reconfigure #更新配置文件,使配置生效
gitlab-ctl help #帮助
gitlab-rake gitlab:check SANITIZE=true --trace #检查gitlab
#gitlab 默认的日志文件存放在/var/log/gitlab 目录下
gitlab-ctl tail #查看所有日志
#禁止 Gitlab 开机自启动
systemctl disable gitlab-runsvdir.service
#启用 Gitlab 开机自启动
systemctl enable gitlab-runsvdir.service
11.查看gitlab默认初始密码,这个文件将在首次执行reconfigure后24小时自动删除
/etc/gitlab/initial_root_password
12.浏览器访问:http://192.168.4.107:82,用root账号及默认密码登录
登录后第一件事,修改登录密码。路径:点击头像-编辑个人资料-密码。
13.登录gitlab并新建空白项目,根据新建空白项目首页提示,在本地IDE配置git并推送项目代码到gitlab仓库。
待补充
14.启动gitlab报错,执行 systemctl start gitlab-runsvdir ,用于启动gitlab运行服务目录(runsvdir)
fail: alertmanager: runsv not running
fail: gitaly: runsv not running
fail: gitlab-monitor: runsv not running
fail: gitlab-workhorse: runsv not running
fail: logrotate: runsv not running
fail: node-exporter: runsv not running
fail: postgres-exporter: runsv not running
fail: postgresql: runsv not running
fail: prometheus: runsv not running
fail: redis: runsv not running
fail: redis-exporter: runsv not running
fail: sidekiq: runsv not running
fail: unicorn: runsv not running
15.gitlab占内存太高处理,执行vim /etc/gitlab/gitlab.rb,修改gitlab配置文件
如果希望内存占用相对较少则,旧版本使用 /unicorn 找到 worker_processes 设置为工作的人数即可;
unicorn['worker_processes'] = 2
新版则全部替换成puma,使用 /puma 找到对应地方,取消注释或者直接新增行
puma[‘enable’] = true
puma[‘worker_timeout’] = 60
puma[‘worker_processes’] = 2 # 基于使用人数
puma[‘max_threads’] = 4
puma[‘per_worker_max_memory_mb’] = 1024
sidekiq[‘max_concurrency’] = 16
postgresql[‘shared_buffers’] = “256MB”
postgresql[‘max_worker_processes’] = 8
16.查看gitlab日志
查看gitlab日志
sudo gitlab-ctl tail
结束查看日志
Ctrl + C
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
所有评论(0)