Gitlab CE 安装
1. Detecting your platform
CentOS / Ubuntu is OK.
2. Install GitLAB (CE) (CIincluded)
Pay Attention: This gitlab-ce binarydistribution mirror only supports x86-64 Architecture
Ubuntu 16.04
Trustthe GPG key of gitlab.com
curl https://packages.gitlab.com/gpg.key 2> /dev/null | sudo apt-key add -&>/dev/null
Write the following line into/etc/apt/sources.list.d/gitlab-ce.list
deb https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu xenial main
Installgitlab-ce:
sudo apt-get update
sudo apt-get installgitlab-ce
RHEL/CentOS
Create a file as/etc/yum.repos.d/gitlab-ce.repo,with following content:
[gitlab-ce]
name=Gitlab CERepository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
gpgcheck=0
enabled=1
Then execute these following command:
sudo yum makecache
sudo yum installgitlab-ce
3. Configure The Gitlab Service
GitLab wouldn’t be able to detect a valid hostname automatically, hence : Configure a URL for your GitLab instance by setting `external_url`configuration in /etc/gitlab/gitlab.rb file.
Then,you canstart your GitLab instance by runningthe following command:
sudo gitlab-ctlreconfigure
Fora comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
4. Install a Gitlab Runner Service
Add APT Repository
Create a file under /etc/apt/sources.list.d/gitlab-runner.listcontaining the following line:
deb https://mirrors.tuna.tsinghua.edu.cn/gitlab-runner/ubuntu xenial main
Install gitlab-runner:
sudo apt-get update
sudo apt-get installgitlab-runner
Acquire a URL and token from GitLAB installation (AdminPanel)
Consider what runner would you like to use
(docker/virtualbox/parallel/shell/ssh …)
If you are intending to use gitlab-runnerwith docker, please go through the following
sudo apt-get install apt-transport-https ca-certificates curlgnupg2 software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg |sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64]https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian \
$(lsb_release-cs) \
stable"
sudo apt-get update
sudo apt-get install docker-ce
Running register process
Eitheras a root user (Configuration will be put under /root/.gitlab)
sudo gitlab-runnerregister
oras a non-root user (for security or other reasons, )
gitlab-runner register
Duringthe process, you will need to configure on whether to build any task orspecifically ‘tagged’ task.
For running as a Service
sudo useradd --comment 'GitLab Runner' --create-homegitlab-runner --shell /bin/bash
sudo gitlab-runner install --user=gitlab-runner--working-directory=/home/gitlab-runner
sudo gitlab-runner start
Ifgitlab-runner is installed and run as service (what is described in this page),it will run as root, but will execute jobs as user specified by the installcommand. This means that some of the job functions like cache and artifactswill need to execute/usr/local/bin/gitlab-runnercommand, therefore the user under which jobs are run, needs to have access tothe executabl
5. Consider FurtherAuto-Management Service
It will be available by now, should therebe futher need to customize Gitlab, this document will soon grow longer ……