gitlab 安装_GitLab安装及使用

本文档详细介绍了如何在Linux环境中安装和配置GitLab。首先,通过yum安装必要的基础软件包,然后配置清华大学的GitLab CE镜像源,更新yum缓存。接着,安装GitLab CE并修改配置文件,设置GitLab的外部URL。通过gitlab-ctl命令进行服务的启动、停止、重启和状态检查。首次登陆GitLab需要修改root用户密码,并添加SSH Key以确保安全连接。
摘要由CSDN通过智能技术生成

GitLab是一个利用 Ruby on Rails 开发的开源应用程序,实现一个自托管的Git项目仓库,可通过Web界面进行访问公开的或者私人项目。

  GitLab拥有与Github类似的功能,能够浏览源代码,管理缺陷和注释。可以管理团队对仓库的访问,它非常易于浏览提交过的版本并提供一个文件历史库。它还提供一个代码片段收集功能可以轻松实现代码复用,便于日后有需要的时候进行查找。

1. GitLab安装与配置

1.1. 基础环境准备

1 [root@mini04 ~]# yum install -y curl policycoreutils openssh-server openssh-clients postfix2 ………………3 [root@mini04 ~]# systemctl start postfix

1.2. 配置yum源

  注:由于网络问题,国内用户,建议使用清华大学的镜像源进行安装:

1 [root@mini04 ~]# vim /etc/yum.repos.d/gitlab-ce.repo2 [gitlab-ce]3 name=gitlab-ce4 baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/5 repo_gpgcheck=06 gpgcheck=07 enabled=18 gpgkey=https://packages.gitlab.com/gpg.key

1.3. 更新本地yum缓存

1 [root@mini04 ~]# yum makecache2 ………………

1.4. 安装GitLab

1 [root@mini04 ~]# yum install -y gitlab-ce2 ………………

1.5. 配置修改

1 [root@mini04 ~]# vim /etc/gitlab/gitlab.rb 2 ………………3 ## GitLab URL4 ##! URL on which GitLab will be reachable.5 ##! For more details on configuring external_url see:6 ##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab7 # external_url 'http://gitlab.example.com'8 # 能够解析9 external_url 'http://mini04'

1.6. 配置并启动gitlab-ce

1 [root@mini04 ~]# gitlab-ctl reconfigure2 ………………

1.7. 查看gitlab状态

 1 [root@mini04 ~]# gitlab-ctl status   2 run: alertmanager: (pid 4075) 27s; run: log: (pid 4180) 25s 3 run: gitaly: (pid 4004) 28s; run: log: (pid 4016) 28s 4 run: gitlab-monitor: (pid 4025) 28s; run: log: (pid 4045) 27s 5 run: gitlab-workhorse: (pid 3983) 28s; run: log: (pid 4049) 27s 6 run: logrotate: (pid 3529) 90s; run: log: (pid 4051) 27s 7 run: nginx: (pid 3506) 96s; run: log: (pid 4050) 27s 8 run: node-exporter: (pid 3710) 78s; run: log: (pid 4017) 28s 9 run: postgres-exporter: (pid 4096) 26s; run: log: (pid 4196) 25s10 run: postgresql: (pid 3229) 140s; run: log: (pid 3972) 29s11 run: prometheus: (pid 4052) 27s; run: log: (pid 4070) 27s12 run: redis: (pid 3154) 146s; run: log: (pid 4021) 28s13 run: redis-exporter: (pid 3783) 66s; run: log: (pid 4041) 27s14 run: sidekiq: (pid 3475) 103s; run: log: (pid 3974) 29s15 run: unicorn: (pid 3432) 110s; run: log: (pid 3973) 30s

1.8. GitLab常用命令

1 gitlab-ctl start    # 启动所有 gitlab 组件;2 gitlab-ctl stop        # 停止所有 gitlab 组件;3 gitlab-ctl restart        # 重启所有 gitlab 组件;4 gitlab-ctl status        # 查看服务状态;5 gitlab-ctl reconfigure        # 启动服务;6 vim /etc/gitlab/gitlab.rb        # 修改默认的配置文件;7 gitlab-ctl tail        # 查看日志;8 gitlab-rake gitlab:check SANITIZE=true --trace    # 检查gitlab;

2. GitLab使用

2.1. 首次登陆

1 http://10.0.0.14
2b2d30ed21424439cc344bbfb071db84.png

首次登陆会要求修改root用户的密码。

a1320e2580e228f8abde58e7abb3f1b2.png

之后对到登陆页面,使用root用户登录即可。

2.2. 添加SSH Key信息

 1 [root@mini04 ~]# ssh-keygen -t rsa 2 Generating public/private rsa key pair. 3 Enter file in which to save the key (/root/.ssh/id_rsa):  4 Created directory '/root/.ssh'. 5 Enter passphrase (empty for no passphrase):  6 Enter same passphrase again:  7 Your identification has been saved in /root/.ssh/id_rsa. 8 Your public key has been saved in /root/.ssh/id_rsa.pub. 9 The key fingerprint is:10 SHA256:ACvHut11cMKDaL1QzsrL3x23OyUl9cd7+kLfFW30cLM root@mini0411 The key's randomart image is:12 +---[RSA 2048]----+13 |    . .          |14 |   . O o      o.o|15 |  . B * = .  . *=|16 |   * o o =  . .EB|17 |  . o . S .  o .+|18 |   + o . .  . o.o|19 |  . + .   . .+ o+|20 |     . . . o..o o|21 |      . . . oo o.|22 +----[SHA256]-----+23 [root@mini04 ~]# ll -d .ssh/24 drwx------ 2 root root 38 Sep 17 22:26 .ssh/25 [root@mini04 ~]# cd .ssh/26 [root@mini04 .ssh]# ll27 total 828 -rw------- 1 root root 1679 Sep 17 22:26 id_rsa29 -rw-r--r-- 1 root root  393 Sep 17 22:26 id_rsa.pub30 [root@mini04 .ssh]# cat id_rsa.pub 31 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCpqkXHf8f7UQSPVH0E40pydotJChFQliRSSmHQezVGh91AB++YfUeGPHHDWDgLCjefxCc+KnJrqJPrUR02K1OwJoC9X4K2x0+gJekEpfs9Yb7Y5hE5XiGz4Z6X+ybN015u3G9czVhV5XAT2M4q+couVgaPpf2npfqv9eqhTuh1W0336sKIvAj1N8iXzfSDbdaERCP2NscnTOrgmHZ8aVMvyyruslvQoNjgQN06/91R48aSqwD++kLOTChGo7qNC10H315UR7cX2MKME9ssuyf77azFLYYdBrALR//YjOoid/jkTHkCLO1ZvHdqakWK7YAHOwV/RocTcm71hqq3mLfz root@mini04
5662fa91fc2871681d4dd31245fc3ac4.png
525f9a83fca22dbd834af9b5bbe21951.png
eb62a4a7d186e97ad1b435448a3d5c4c.png

GitLab的页面使用,请自行百度参考。git的命令行使用,可参考前面的几篇博文。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值