GItLib环境搭建

服务器配置

centos7+

2核4G+

 

手动部署GitLab环境

1.安装依赖包

sudo yum install -y curl policycoreutils-python openssh-server

 

2.依次运行以下命令,配置SSH服务

  • 启动SSH服务

sudo systemctl start sshd

  • 设置SSH服务为开机自启动

sudo systemctl enable sshd

 

3.安装Postfix来发送通知邮件

sudo yum install postfix

 

4.设置Postfix开机自启动

sudo systemctl enable postfix

 

5.启动Postfix服务

  • 运行以下命令,打开main.cf文件

vim /etc/postfix/main.cf

  • 找到如下图所示的代码,然后按i进入编辑模式

inet_interfaces = localhost

  • 将该行代码修改为inet_interfaces = all
  • Esc退出编辑模式,然后输入:wq并回车,保存关闭文件
  • 运行以下命令,启动Postfix服务

sudo systemctl start postfix

 

6.添加GitLab软件包仓库

curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash

 

7.安装GitLab

sudo EXTERNAL_URL="GitLab服务器的公网IP地址" yum install -y gitlab-ce

 

8.构建命令

sudo gitlab-ctl reconfigure

 

9.检查是否安装成功

sudo gitlab-ctl status

 

10.启动gitlab服务

sudo gitlab-ctl start

 

11.获取Linux初装gitlab初始默认密码

cat /etc/gitlab/initial_root_password

 

12.用浏览器访问GitLab服务器的公网IP地址

 

常用命令

#更新配置,并启动gitlab服务

sudo gitlab-ctl reconfigure

 

#启动 gitlab

sudo gitlab-ctl start

 

#重新GitLab

sudo gitlab-ctl restart

 

#停止 gitlab

sudo gitlab-ctl stop

 

#查看gitlab服务状态

sudo gitlab-ctl status

 

#查看Gitlab日志

sudo gitlab-ctl tail

 

#修改默认的配置文件

sudo vim /etc/gitlab/gitlab.rb

 

参考资料

1.https://help.aliyun.com/document_detail/52857.html

2.https://blog.csdn.net/wangxiuwen12/article/details/118304592

3.https://blog.csdn.net/timonium/article/details/119451755

 

posted @ 2021-10-14 22:40  zetaiota  阅读(192)  评论(0编辑  收藏  举报