Ubuntu之离线安装Gitlab,搭建私有代码仓库

Ubuntu之离线安装Gitlab,搭建私有代码仓库

文章目录

  • Ubuntu之离线安装Gitlab,搭建私有代码仓库
    • 1. 官网下载:
    • 2. 安装Gitlab
    • 3. 使用

1. 官网下载:

https://packages.gitlab.com/gitlab/gitlab-ce

  1. wget下载地址:

wget https://packages.gitlab.com/gitlab/gitlab-ce/packages/ubuntu/bionic/gitlab-ce_13.10.2-ce.0_amd64.deb/download.deb

  1. 下载后的文件为:gitlab-ce_13.10.2-ce.0_amd64.deb

2. 安装Gitlab

yuan@yuan-server:/opt/modules$ dpkg -i gitlab-ce_13.10.2-ce.0_amd64.deb 
  1. 安装完成后会显示下面信息
yuan@yuan-server:/opt/modules$ sudo dpkg -i gitlab-ce_13.10.2-ce.0_amd64.deb 
Selecting previously unselected package gitlab-ce.
(Reading database ... 67087 files and directories currently installed.)
Preparing to unpack gitlab-ce_13.10.2-ce.0_amd64.deb ...
Unpacking gitlab-ce (13.10.2-ce.0) ...
Setting up gitlab-ce (13.10.2-ce.0) ...
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

Help us improve the installation experience, let us know how we did with a 1 minute survey:
https://gitlab.fra1.qualtrics.com/jfe/form/SV_6kVqZANThUQ1bZb?installation=omnibus&release=13-10

yuan@yuan-server:/opt/modules$ 
  1. 编辑 /etc/gitlab/gitlab.rb 文件
sudo vim /etc/gitlab/gitlab.rb

找到 external_url ‘http://gitlab.example.com’ 修改为服务器的ip及端口,如

# 将 
external_url 'http://gitlab.example.com'
# 修改为
external_url 'http://192.168.31.60:9090'
  1. 重新配置gitlab
# 注意,此命令配置过程较慢长,请耐心等待
sudo gitlab-ctl reconfigure
  1. 重新配置后如果出现下面的内容,则表示安装成功
Running handlers:
Running handlers complete
Chef Infra Client finished, 586/1555 resources updated in 06 minutes 32 seconds

Notes:
It seems you haven't specified an initial root password while configuring the GitLab instance.
On your first visit to  your GitLab instance, you will be presented with a screen to set a
password for the default admin account with username `root`.

gitlab Reconfigured!
yuan@yuan-server:/opt/modules$ 
# 【注意:最后提示 已经默认有root账户了,首次登录就是要设置root用户密码】

3. 使用

  1. 在浏览器中输入 http://192.168.31.60:9090,出现下面界面则表示安装成功

    在这里插入图片描述

  2. 此界面中默认提示您要修改root的密码

  3. 修改完root密码后,提示下面页面

在这里插入图片描述

  1. 使用root用户登录后如下:

在这里插入图片描述

  1. 至此gitlab已经安装成功