参考:https://docs.gitlab.com/ee/install/docker.html
1 Set up the volumes location 设置存储位置
Before setting everything else, configure a new environment variable $GITLAB_HOME pointing to the directory where the configuration, logs, and data files will reside. Ensure that the directory exists and appropriate permission have been granted.
For Linux users, set the path to /srv/gitlab:
export GITLAB_HOME=/srv/gitlab
For macOS users, use the user’s $HOME/gitlab directory:
export GITLAB_HOME=$HOME/gitlab
The GitLab container uses host mounted volumes to store persistent data:
| Local location | Container location | Usage |
|---|---|---|
| $GITLAB_HOME/data | /var/opt/gitlab | For storing application data. |
| $GITLAB_HOME/logs | /var/log/gitlab | For storing logs. |
| $GITLAB_HOME/config | /etc/gitlab | For storing the GitLab configuration files. |
本次是 wsl 的 ubuntu 20
export GITLAB_HOME=/srv/gitlab
2 安装
可以使用 docker、docker-compose 或者其它,本次选择 docker 和 docker-compose
2.1 docker 形式安装
docker run --detach --hostname gitlab.example.com --publish 443:443 --publish 80:80 --publish 22:22 --name gitlab --restart always --volume $GITLAB_HOME/config:/etc/gitlab --volume $GITLAB_HOME/logs:/var/log/gitlab --volume $GITLAB_HOME/data:/var/opt/gitlab --shm-size 256m gitlab/gitlab-ce:latest
访问地址:http://localhost
2.1.1 root 密码查看 docker exec -it containerID grep ‘Password:’ /etc/gitlab/initial_root_password
xiaohui@220200700182:/mnt/c/Users/DELL$ docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESe4a364266172 gitlab/gitlab-ce:latest "/assets/wrapper" 4 minutes ago Up 4 minutes (healthy) 0.0.0.0:22->22/tcp, 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp gitlabbc46115d86f4 sonarqube:8.9-community "bin/run.sh bin/sona…" 4 hours ago Up 3 hours 0.0.0.0:9000->9000/tcp dell_sonarqube_1d204d114a190 postgres:12 "docker-entrypoint.s…" 4 hours ago Up 3 hours 0.0.0.0:5432->5432/tcp dell_db_11b807dac92cd liferay/portal:7.4.3.8-ga8 "/usr/local/bin/life…" 9 hours ago Up 9 hours (healthy) 8000/tcp, 8009/tcp, 11311/tcp, 0.0.0.0:8080->8080/tcp optimistic_swartz543583525fab nacos/nacos-server:2.0.3 "bin/docker-startup.…" 5 months ago Up 10 hours 0.0.0.0:8848->8848/tcp, 0.0.0.0:9555->9555/tcp, 0.0.0.0:9848->9848/tcp nacos-standalone-mysql181d6e2fc256 nacos/nacos-mysql:8.0.16 "docker-entrypoint.s…" 5 months ago Up 8 hours0.0.0.0:3306->3306/tcp, 33060/tcp mysqlxiaohui@220200700182:/mnt/c/Users/DELL$xiaohui@220200700182:/mnt/c/Users/DELL$xiaohui@220200700182:/mnt/c/Users/DELL$ docker exec -it e4a364266172 grep 'Password:' /etc/gitlab/initial_root_passwordPassword: O6A1eP/1Nq6CW4wZmWqUHJOs7hPpH2BRhRVI52+Zlk4=xiaohui@220200700182:/mnt/c/Users/DELL$
2.2 docker-compose 形式安装
version: '3.6'services:web:image: 'gitlab/gitlab-ce:latest'restart: alwayshostname: 'gitlab.my.com'environment:GITLAB_OMNIBUS_CONFIG: |external_url 'http://192.168.0.187'gitlab_rails['gitlab_shell_ssh_port'] = 22ports:- '80:80'- '443:443'- '22:22'volumes:- '/config:/etc/gitlab'- '/logs:/var/log/gitlab'- '/data:/var/opt/gitlab'shm_size: '256m'
或者使用 gitlab-ee
version: '3.6'services:web:image: 'gitlab/gitlab-ee:latest'restart: alwayshostname: 'gitlab.my.com'environment:GITLAB_OMNIBUS_CONFIG: |external_url 'http://192.168.0.187'gitlab_rails['gitlab_shell_ssh_port'] = 22ports:- '80:80'- '443:443'- '22:22'volumes:- '/config:/etc/gitlab'- '/logs:/var/log/gitlab'- '/data:/var/opt/gitlab'shm_size: '256m'
执行 docker-compose -f gitlab-compose.yaml up -d
xiaohui@220200700182:/mnt/c/Users/DELL$ docker-compose -f gitlab-compose.yaml up -dWARNING: Found orphan containers (dell_db_1, dell_sonarqube_1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.Creating dell_web_1 ... donexiaohui@220200700182:/mnt/c/Users/DELL$
2.3 启动后,多等一会
2.4 external_url
external_url 该参数可以替换掉 git clone 中间的 hostname。
3 个性化设置
点击头像,preference:
进行语言设置,找到 Localization
设置完成,需要注销登录,再次进入,就是中文了。

