Gitlab部署

GitLab是Ruby开发的自托管的Git项目仓库,可通过Web界面访问公开的或者私人的项目。

Gitlab服务器部署

该部署以Red Hat 7为例

安装依赖

yum install -y curl policycoreutils-python openssh-server

系统高版本的可能需要使用dnf install policycoreutils-python-utils进行下载policycoreutils-python

当然gitlab版本也要更换,系统版本8的gitlab下载命令:wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/8/gitlab-ce-12.10.1-ce.0.el8.x86_64.rpm/download.rpm

启动ssh服务/设置为开机启动

systemctl enable sshd

systemctl start sshd

安装 Postfix 邮件服务器

yum install -y postfix

systemctl enable postfix

systemctl start postfix

安装gitlab

wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-13.1.2-ce.0.el7.x86_64.rpm

rpm -ivh gitlab-ce-13.1.2-ce.0.el7.x86_64.rpm

修改 gitlab 配置

vim /etc/gitlab/gitlab.rb

#修改该项为自己的IP地址
external_url 'http://192.168.111.129:9081'
#将该注释去掉并修改,端口不可与上方重复
puma['port'] = 9082

重置 gitlab

gitlab-ctl reconfigure

systemctl restart gitlab-runsvdir

启动完成后即可通过地址访问(该地方要稍微等一下,gitlab启动时间有点久,要是看到502代表还在启动中)

测试链接

修改密码,默认用户为root(设置密码并登录)

注:老版本的gitlab会有初始密码在文件 /etc/gitlab/initial_root_password 中查看

登录后的页面

页面访问成功后,即可进行一些组和用户的创建了,可参考Gitlab创建组、用户、项目

中文设置可参考Gitlab设置为中文

Gitlab相关命令

gitlab-ctl start      // 启动所有 gitlab 组件;
gitlab-ctl stop       // 停止所有 gitlab 组件;
gitlab-ctl restart    // 重启所有 gitlab 组件;
gitlab-ctl status     // 查看服务状态;
gitlab-ctl reconfigure        // 刷新配置文件;
gitlab-rake gitlab:check SANITIZE=true --trace    // 检查gitlab;
gitlab-ctl tail        // 查看日志;

  

 

posted @ 2022-06-05 01:23  RFAA  阅读(68)  评论(0编辑  收藏  举报