🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
gitlab安装与配置 [TOC] # 第1章 普通安装gitlab ## 1.1 安装链接 清华源安装地址 https://mirror.tuna.tsinghua.edu.cn/help/gitlab-ce/ 官方安装地址 https://about.gitlab.com/installation/ ## 1.2 安装步骤 因为网络原因,建议从清华源安装gitlab,步骤基本和官网一样. ### 1.2.1 添加GitLab的GPG公钥 ``` curl https://packages.gitlab.com/gpg.key 2> /dev/null | apt-key add - &>/dev/null ``` ### 1.2.2 编辑源 根据自己的版本进行选择,我这里时debian8 ``` deb http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/debian jessie main ``` ### 1.2.3 安装gitlab ``` apt-get update apt-get install gitlab-ce ``` ### 1.2.4 修改配置 修改gitlab地址为ip地址或者域名 ``` [root@gitlab ~]# cat /etc/gitlab/gitlab.rb |grep "^external_url" external_url 'http://192.168.56.71' ``` ### 1.2.5 生效配置并启动 这个步骤时间可能比较长 ``` [root@gitlab ~]# gitlab-ctl reconfigure ``` ### 1.2.6 查看启动的服务 ``` [root@gitlab ~]# gitlab-ctl service-list gitaly* gitlab-monitor* gitlab-workhorse* logrotate* nginx* node-exporter* postgres-exporter* postgresql* prometheus* redis* redis-exporter* sidekiq* unicorn* ``` # 第2章 docker安装gitlab ## 2.1 相关链接 官方地址: ``` https://docs.gitlab.com/omnibus/docker/README.html#gitlab-docker-images https://hub.docker.com/r/gitlab/gitlab-ce/ ``` ## 2.2 安装docker环境 ## 2.3 docker获取gitla镜像 ``` docker pull gitlab/gitlab-ce ``` ## 2.4 docker启动gitlab镜像 ``` docker run --detach \ --hostname 192.168.47.70 \ --publish 11443:443 --publish 11180:80 --publish 11122:22 \ --name new_gitlab \ --restart always \ --volume /data/new_gitlab_data/config:/etc/gitlab \ --volume /data/new_gitlab_data/logs:/var/log/gitlab \ --volume /data/new_gitlab_data/data:/var/opt/gitlab \ gitlab/gitlab-ce:latest ``` ## 2.5 备份恢复命令 ``` gitlab-rake gitlab:backup:create gitlab-rake gitlab:backup:restore BACKUP=1517993292_2018_02_07_10.4.2 ``` ## gitlab配置 ## 第4章 gitlab常用命令 ``` [root@gitlab ~]# gitlab-ctl I don't know that command. omnibus-ctl: command (subcommand) deploy-page Put up the deploy page diff-config Compare the user configuration with package available configuration remove-accounts Delete *all* users and groups used by this package upgrade Run migrations after a package upgrade General Commands: cleanse Delete *all* gitlab data, and start from scratch. help Print this help message. reconfigure Reconfigure the application. show-config Show the configuration that would be generated by reconfigure. uninstall Kill all processes and uninstall the process supervisor (data will be preserved). Service Management Commands: graceful-kill Attempt a graceful stop, then SIGKILL the entire process group. hup Send the services a HUP. int Send the services an INT. kill Send the services a KILL. once Start the services if they are down. Do not restart them if they stop. restart Stop the services if they are running, then start them again. service-list List all the services (enabled services appear with a *.) start Start services if they are down, and restart them if they stop. status Show the status of all the services. stop Stop the services, and do not restart them. tail Watch the service logs of all enabled services. term Send the services a TERM. usr1 Send the services a USR1. usr2 Send the services a USR2. Database Commands: pg-password-md5 Generate MD5 Hash of user password in PostgreSQL format pg-upgrade Upgrade the PostgreSQL DB to the latest supported version revert-pg-upgrade Run this to revert to the previous version of the database set-replication-password Set database replication password Container Registry Commands: registry-garbage-collect Run Container Registry garbage collection. ```