gitlab部署和基本使用

简介

  • GitLab是利用 Ruby on Rails 一个开源的版本管理系统,实现一个自托管的Git项目仓库,可通过Web界面进行访问公开的或者私人项目。

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

常用的版本控制工具

  • CVS,逐渐被SVN取代,是CVX重写版和改写版svc
  • SVN,Subversion
  • gitlab

gitlab部署

  • 配置网络yum源
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
安装过程略
……

[root@localhost ~]# sed -i 's/\$releasever/7/g' /etc/yum.repos.d/CentOS7-Base-163.repo
[root@localhost ~]# sed -i 's/^enabled=.*/enabled=1/g' /etc/yum.repos.d/CentOS7-Base-163.repo
[root@localhost ~]# yum -y install epel-release
……
  • 安装git
[root@localhost ~]# yum -y install epel-release git
安装过程略
  • 安装依赖包
[root@localhost ~]# yum -y install curl openssh-server openssh-clients postfix cronie policycoreutils-python
安装过程略....

  • 启动postfix服务并设置开机自启
[root@localhost ~]# systemctl restart postfix
[root@localhost ~]# systemctl enable postfix
  • 下载gitlab的rpm包
[root@localhost ~]# cd /usr/src/
[root@localhost src]# ls
debug  kernels
[root@localhost src]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm
--2019-08-30 16:50:20--  https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm
正在解析主机 mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.8.193, 2402:f000:1:408:8100::1
正在连接 mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.8.193|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:444944490 (424M) [application/x-redhat-package-manager]
正在保存至: “gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm”

100%[================================================>] 444,944,490 3.09MB/s 用时 2m 21s 

2019-08-30 16:52:41 (3.01 MB/s) - 已保存 “gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm” [444944490/444944490])


  • 安装gitlab
[root@localhost src]# rpm -ivh gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm
警告:gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm: 头V4 RSA/SHA1 Signature, 密钥 ID f27eab47: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:gitlab-ce-11.2.1-ce.0.el7        ################################# [100%]
It looks like GitLab has not been configured yet; skipping the upgrade script.

       *.                  *.
      ***                 ***
     *****               *****
    .******             *******
    ********            ********
   ,,,,,,,,,***********,,,,,,,,,
  ,,,,,,,,,,,*********,,,,,,,,,,,
  .,,,,,,,,,,,*******,,,,,,,,,,,,
      ,,,,,,,,,*****,,,,,,,,,.
         ,,,,,,,****,,,,,,
            .,,,***,,,,
                ,*,.
  


     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ `/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /
  \____/_/\__/_____/\__,_/_.___/
  

Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your GitLab instance by setting `external_url`
configuration in /etc/gitlab/gitlab.rb file.
Then, you can start your GitLab instance by running the following command:
  sudo gitlab-ctl reconfigure

For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md



  • 修改配置文件
[root@localhost ~]# vim /etc/gitlab/gitlab.rb
......  //此处为省略内容
external_url 'http://192.168.170.14'     //将此处设为gitlab的服务器ip地址亦或域名

  • 重载配置文件并重启gitlab
[root@localhost ~]# gitlab-ctl reconfigure
[root@localhost ~]# gitlab-ctl restart
ok: run: alertmanager: (pid 17305) 0s
ok: run: gitaly: (pid 17318) 0s
ok: run: gitlab-monitor: (pid 17331) 0s
ok: run: gitlab-workhorse: (pid 17335) 0s
ok: run: logrotate: (pid 17363) 1s
ok: run: nginx: (pid 17369) 0s
ok: run: node-exporter: (pid 17380) 1s
ok: run: postgres-exporter: (pid 17386) 0s
ok: run: postgresql: (pid 17396) 1s
ok: run: prometheus: (pid 17405) 0s
ok: run: redis: (pid 17420) 0s
ok: run: redis-exporter: (pid 17425

  • 查看当前的gitlab版本
[root@localhost src]# head -1 /opt/gitlab/version-manifest.txt 
gitlab-ce 11.2.1
[root@localhost src]# 


  • 设置管理员密码


gitlab管理

在浏览器输入gitlab服务器ip地址

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

同样操作,创建一个普通usr,名字为wyh,然后记得编辑wyh的密码,保存并退出登录,第一次登录,修改密码

在这里插入图片描述

在这里插入图片描述

发布了60 篇原创文章 · 获赞 3 · 访问量 2094

猜你喜欢

转载自blog.csdn.net/weixin_42313749/article/details/100163959