gitlab - [02] 安裝部署

HOUHUILIN發表於2024-05-27

安裝部署篇

一、5分鐘搭建私人程式碼倉庫

(1)設定環境變數:export GITLAB_HOME=/src/gitlab

(2)編寫docker-compose.yml

mkdir -p /opt/docker-compose/gitlab
vim /opt/docker-compose/gitlab/docker-compose.yml

(3)docker-compose.yml內容如下

version: '3.8'
services:
  gitlab:
    hostname: '192.168.2.131'
    images: 'gitlab/gitlab-ce:14.2.4-ce.0'
    restart: always
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        external_url 'http://192.168.2.131:9080'
        gitlab_rails['gitlab_shell_ssh_port'] = 9022
        gitlab_rails['time_zone'] = 'Asia/Shanghai'
    ports: 
      - '9080:9080'
      - '9443:443'
      - '9022:22'
    volumes:
      - '$GITLAB_HOME/config:/etc/gitlab'
      - '$GITLAB_HOME/logs:/var/log/gitlab'
      - '$GITLAB_HOME/data:/var/opt/gitlab'

(4)啟動gitlab

cd /opt/docker-compose/gitlab && docker-compose up -d

(5)檢視初始密碼

cat /srv/gitlab/config/initial_root_password

(6)瀏覽器訪問:192.168.2.131:9080/users/sign_in 即可登入GitLab

二、標題

嗷嗷待“補”

三、標題

嗷嗷待“補”

— 業精於勤荒於嬉,行成於思毀於隨 —

相關文章