GitLab安装

184 阅读1分钟

gitlab about.gitlab.com/gitlab-com/

docker安装gitlab

docs.gitlab.com/omnibus/doc…

1、准备数据目录

gitlab/gitlab-ce容器需要先创建三个目录 #分别存放应用数据、日志和配置文件

  • 宿主机上/gitlab/data对应容器中/var/opt/gitlab
  • 宿主机上/gitlab/logs对应容器中/var/log/gitlab
  • 宿主机上/gitlab/config对应容器中/etc/gitlab
sudo mkdir -p /srv/gitlab/data
sudo mkdir -p /srv/gitlab/logs
sudo mkdir -p /srv/gitlab/config
sudo chmod -R 777 /srv/gitlab

2.运行容器

sudo docker run --detach \
    --hostname gitlab.dtp.com \
    --publish 443:443 --publish 80:80  --publish 2289:22\
    --env GITLAB_OMNIBUS_CONFIG="external_url 'http://gitlab.llla.com/';gitlab_rails['gitlab_ssh_host'] = '10.20.48.224'; gitlab_rails['gitlab_shell_ssh_port'] = 2289;" \
    --name gitlab \
    --restart always \
    --volume /srv/gitlab/config:/etc/gitlab \
    --volume /srv/gitlab/logs:/var/log/gitlab \
    --volume /srv/gitlab/data:/var/opt/gitlab \
    gitlab/gitlab-ce:latest

客户端配置:

sudo vim /home/user/.ssh/config

# dtp
Host gitlab.dtp.com
    HostName gitlab.llla.com
    Port 2289
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/id_rsa

添加hosts

sudo vim /etc/hosts
10.20.48.224 gitlab.llla.com

浏览器访问:gitlab.llla.com
初次访问,会要求设置root账号的密码

本机安装

about.gitlab.com/installatio…

www.jianshu.com/p/92f97939e…

sudo apt-get update
sudo apt-get install -y curl openssh-server ca-certificates

curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash

sudo EXTERNAL_URL="http://gitlab.llla.com" apt-get install gitlab-ce