Ubuntu自建git服务器

Ubuntu 安装 gitlab-ce

sudo apt-get update
sudo apt-get install gitlab-ce

安装成功

 sudo apt-get install gitlab-ce
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
下列【新】软件包将被安装:
  gitlab-ce
升级了 0 个软件包,新安装了 1 个软件包,要卸载 0 个软件包,有 78 个软件包未被升级。
需要下载 1,085 MB 的归档。
解压缩后会消耗 3,101 MB 的额外空间。
获取:1 https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu focal/main amd64 gitlab-ce amd64 16.5.0-ce.0 [1,085 MB]
已下载 1,085 MB,耗时 1分 41秒 (10.8 MB/s)                                                                       
正在选中未选择的软件包 gitlab-ce。
(正在读取数据库 ... 系统当前共安装有 260201 个文件和目录。)
准备解压 .../gitlab-ce_16.5.0-ce.0_amd64.deb  ...
正在解压 gitlab-ce (16.5.0-ce.0) ...
正在设置 gitlab-ce (16.5.0-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=16-5

配置端口及网址

# 编辑文件
vim /etc/gitlab/gitlab.rb

external_url 'http://gitlab.example.com'
# 更改为如下
external_url 'http://<本机ip>:8899'

设置存储位置

        1.  拷贝原数据到新目录下。

cp -r /var/opt/gitlab/git-data/* /media/myradi5/data/gitlab-ce/data

        2.  /etc/gitlab/gitlab.rb中找到下面的字段,去除注释符,修改“path=”

git_data_dirs({
   "default" => {
     "path" => "/media/myradi5/data/gitlab-ce/data"
    }
 })

设置文件夹权限

sudo chmod 2770 /media/myradi5/data/gitlab-ce/data/

重新配置

sudo gitlab-ctl reconfigure
# 开启应用
sudo gitlab-ctl start

验证: 输入:8899

Ubuntu自建git服务器_第1张图片

注册了用户,首次登录提示

登陆不上---------------------------------------------
 Your account is pending approval from your GitLab administrator and hence blocked. Please contact your GitLab 

首次需要在24小时内使用Root用户登录,密码在“ /etc/gitlab/initial_root_password”文件中。

授权新用户入口

Ubuntu自建git服务器_第2张图片

你可能感兴趣的:(git,运维)