Linux环境搭建记录——GitLab安装

Linux环境搭建记录

GitLab安装


更多GitLab详细信息请参考:GitLab官方文档

分步指南

  1. 获取GitLab资源
    可以访问 https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/ 下载获取,根据系统版本选用资源,本文展示使用的为Centos7所以选用的el7目录下资源,如果系统为Centos8请选择el8目录,资源为rpm文件。

  2. 上传资源到服务器
    创建gitlab文件夹,上传资源文件

    mkdir /home/admin/download/gitlab && cd /home/admin/download/gitlab
    

    执行前置依赖插件安装命令

    yum -y install policycoreutils-python
    yum -y install git
    

    执行rpm安装命令

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

    执行成功效果如下
    执行成功效果展示

  3. 修改运行gitlab配置
    修改运行地址

    vim /etc/gitlab/gitlab.rb
    

    找到内容并修改为

    #修改为服务器自身的ip访问地址或域名
    external_url='http://127.0.0.1'
    

    重新加载配置

    gitlab-ctl reconfigure
    
  4. 开启防火墙端口策略

    #查看防火墙全部设置
    firewall-cmd --list-all
    #若防火墙服务未启动可执行
    systemctl start firewalld
    #设置nexus服务端口防火墙可访问
    firewall-cmd --zone=public --add-port=80/tcp --permanent
    #重新加载防火墙设置
    firewall-cmd --reload
    #重新查看防火墙全部设置确认添加成功
    firewall-cmd --list-all
    

    此时就能通过浏览器访问了
    默认登录账号:root
    默认登录密码:可以在

    cat /etc/gitlab/initial_root_password
    

    进行查看
    访问界面展示效果
    至此GitLab安装完毕,之后需要进行使用配置

  5. 生成密钥文件

    ssh-keygen
    #为其它账号生成sshkey可以执行如下命令,更换邮箱即可
    #ssh-keygen -t rsa -C "youremail@xxx.com" -f filepath
    

执行生成密钥效果

  1. 配置密钥
    查看密钥

    cat /root/.ssh/id_rsa.pub
    

    在 GitLab 设置中添加 ssh key
    设置ssh key

  2. gitlab常用命令说明

    #gitlab的守护进程是会默认开启nginx的,如果想要关闭,可以尝试一下操作
    gitlab-ctl stop nginx
    gitlab-ctl restart nginx
    #如果想要释放资源,关闭gitlab时,可以尝试一下操作
    gitlab-ctl stop
    
    #启动所有 gitlab 组件
    gitlab-ctl start
    #停止所有 gitlab 组件
    gitlab-ctl stop
    #重启所有 gitlab 组件
    gitlab-ctl restart
    #查看服务状态
    gitlab-ctl status
    #启动服务
    gitlab-ctl reconfigure
    #修改默认的配置文件
    vim /etc/gitlab/gitlab.rb
    #检查gitlab
    gitlab-rake gitlab:check SANITIZE=true --trace
    #查看日志
    gitlab-ctl tail
    
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

绯色灬观月

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值