ubuntu或树莓派搭建gitlab

文章目录

    • 1. 安装依赖包
    • 2. 信任GitLab的GPG 公钥
    • 3. 添加镜像源路经
    • 4. 下载gitlab
    • 5. 配置gitlab的环境
    • 6. gitlab的启动和关闭以及状态查看
    • 7. 访问gitlab
    • 8. 修改gitlab的端口

1. 安装依赖包

  • sudo apt-get install curl openssh-server ca-certificates postfix
  • 当安装postfix依赖包时,用enter键现在确定或者ok。然后在选择Internet site

2. 信任GitLab的GPG 公钥

  • https://packages.gitlab.com/gitlab(具体需要哪一个可以上官网查看,有树莓派版本)
  • curl https://packages.gitlab.com/gpg.key 2> /dev/null | sudo apt-key add - &>/dev/null(针对ubuntu)
  • curl -s https://packages.gitlab.com/install/repositories/gitlab/raspberry-pi2/script.deb.sh | sudo bash(针对树莓派)

3. 添加镜像源路经

  • sudo vi /etc/apt/sources.list.d/gitlab-ce.list,添加内如如下
deb https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu xenial main

4. 下载gitlab

  • sudo apt-get update(一定要执行)
  • sudo apt-get install gitlab-ce
  • 出现如下画面,说明安装成功

Selecting previously unselected package gitlab-ce.
(Reading database ... 100056 files and directories currently installed.)
Preparing to unpack .../gitlab-ce_13.2.5-ce.0_amd64.deb ...
Unpacking gitlab-ce (13.2.5-ce.0) ...
Setting up gitlab-ce (13.2.5-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

5. 配置gitlab的环境

  • sudo gitlab-ctl reconfigure

6. gitlab的启动和关闭以及状态查看

  • sudo gitlab-ctl start
  • sudo gitlab-ctl stop
  • sudo gitlab-ctl status

7. 访问gitlab

http://电脑的IP地址

8. 修改gitlab的端口

  • sudo vim /etc/gitlab/gitlab.rb
将如下数据进行更改
external_url 'http://gitlab.example.com'  
更改为
external_url 'http://ip:端口'  
  • sudo gitlab-ctl reconfigure

你可能感兴趣的:(嵌入式设备)