Quickly install GitLab and Chinese

Reprint: http://www.jianshu.com/p/7a0d6917e009?mType=Group

source code to install GitLab The steps are cumbersome: you need to install dependent packages, Mysql, Redis, Postfix, Ruby, Nginx... After installation, you have to manually configure these one by one software. The source code installation is prone to errors. The biggest advantage of the source code is private customization. If you don't do customization, you can still use the official recommended omnibus packages to install. If the network is good, you can get it within an hour.

Referring to the official installation documentation, I installed it on Ubuntu 14 and CentOS 6 respectively. The process was very smooth and there were no errors.
Installation on Ubuntu 14

Use domestic installation source images to speed up installation. Modify /etc/apt/sources.list.d/gitlab-ce.list and add the following line

deb https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/debian jessie main

to start the installation:

# Install dependency packages
sudo apt-get install curl openssh-server ca-certificates postfix
# Install GitLab Community Edition
apt-get install gitlab-ce
# Initialize, start GitLab automatically after initialization
sudo gitlab-ctl reconfigure

Install on CentOS 6

Use domestic mirror installation, create a new /etc/yum.repos.d/gitlab-ce.repo, and add the following content

[gitlab-ce]
name=gitlab-ce
baseurl=http://mirrors.tuna.tsinghua.edu.cn/ gitlab-ce/yum/el6
repo_gpgcheck=0
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/gpg.key

Installation steps:

# Install dependencies
sudo yum install curl openssh-server openssh-clients postfix cronie
# Start postfix mail service
sudo service postfix start
# Check postfix
sudo chkconfig postfix on
# Install GitLab Community Edition
sudo yum install gitlab-ce
# Initialize GitLab
sudo gitlab-ctl reconfigure

Modify host

Add access host, modify /etc/gitlab/gitlab. rb's external_url

external_url 'http://git.home.com'

vi /etc/hosts, add host mapping

127.0.0.1 git.home.com

Every time you modify /etc/gitlab/gitlab.rb, you must run the following command to make the configuration take effect

sudo gitlab-ctl reconfigure

configure the host of this machine, such as: 192.168.113.59 git.home.com. Finally, open the URL http://git.home.com in the browser and log in. Default administrator:

    Username
    : rootPassword: 5iveL!fe

Install Chinese language pack (Chinese)

The following Chinese steps refer to this article, first confirm the current installation version

cat /opt/gitlab/embedded/service/gitlab-rails/VERSION

The current installation The version is 8.5.7, so the Chinese patch needs to hit version 8.5.

Clone GitLab source repository:

# Clone GitLab.com repository
git clone https://gitlab.com/larryli/gitlab.git
# or Gitcafe.com mirror, faster
git clone https://gitcafe.com/larryli/gitlab. Git

runs the Chinese patch:

# 8.5 version of the Chinese patch (8-5-stable is the English stable version, 8-5-zh is the Chinese version, the two diff results are the Chinese patch)
sudo git diff origin/8-5-stable..8-5 -zh > /tmp/8.5.diff
# Stop gitlab
sudo gitlab-ctl stop
# Apply Chinese patch
cd /opt/gitlab/embedded/service/gitlab-rails
git apply /tmp/8.5.diff 
# Start gitlab
sudo gitlab-ctl start

So far, the Chineseization is completed. Open the address http://git.home.com and you will see the Chinese version of GitLab. The

installation is .
Backup

If it is a production environment, a backup is a must. Files that need to be backed up: configuration files and data files.
Backup configuration files

The configuration files contain sensitive information such as passwords, so do not keep them together with the data backup files.

sh -c 'umask 0077; tar -cf $(date "+etc-gitlab-%s.tar") -C /etc/gitlab'

backup data files The

default data backup directory is /var/opt/gitlab/backups, manually Create a backup file:

# Omnibus installation Backup using the following command
sudo gitlab-rake gitlab:backup:create

Daily backup, add crontab, run crontab -e

# Perform backup at 2 o'clock every day
0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create CRON=1

To modify the backup cycle and directory, in /etc Modify the following two options in /gitlab/gitlab.rb

# Set the backup period to 7 days - 604800 seconds
gitlab_rails['backup_keep_time'] = 604800
# Backup directory
gitlab_rails['backup_path'] = '/mnt/backups'

restore

Make sure that the GitLab installed in the backup file is the same version of GitLab that you want to restore. First, restore the configuration file:

sudo mv /etc/gitlab /etc/gitlab.$(date +%s)
# Change the timestamp of the configuration backup file below to the timestamp of the file you backed up
sudo tar -xf etc-gitlab -1399948539.tar -C /

restore data files

# Copy the data backup files to the backup directory
sudo cp 1393513186_gitlab_backup.tar /var/opt/gitlab/backups/

# Stop the process of connecting to the database
sudo gitlab-ctl stop unicorn
sudo gitlab-ctl stop sidekiq

# Restoring the backup file 1393513186 will overwrite the GitLab database!
sudo gitlab-rake gitlab:backup:restore BACKUP=1393513186

# Start GitLab
sudo gitlab-ctl start

# Check GitLab
sudo gitlab-rake gitlab:check SANITIZE=true

Continuous integration (GitLab-CI)

GitLab has integrated GitLab-CI since 8.0 , so there is no need to install CI. But need to install Runner

1. Add Runner installation source

# For Debian/Ubuntu
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-ci-multi-runner/script.deb.sh | sudo bash

# For CentOS
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-ci-multi-runner/script.rpm.sh | sudo bash

install gitlab-ci-multi-runner

# For Debian/ Ubuntu
apt-get install gitlab-ci-multi-runner

# For CentOS
yum install gitlab-ci-multi-runner

2. Register Runner. Get Token: Log in to GitLab as an administrator, enter the management area, and click Runner in the sidebar, as shown in the figure below, the string after "Registration Authorization Code" is the Token.

sudo gitlab-ci-multi-runner register

Running in system-mode.

Please enter the gitlab-ci coordinator URL (eg https://gitlab.com/ci):
http://git.home.com/ci
Please enter the gitlab-ci token for this runner:
xxxx # Enter the Token
Please enter the gitlab-ci description for this runner:
[xxy-web-test-02]: test-runner # Enter the name of the runner
Please enter the gitlab-ci tags for this runner (comma separated):
test,php # Enter the label of the runner to distinguish different runners, separated by commas
Registering runner... succeeded runner=YDPz2or3
Please enter the executor: ssh, shell, parallels, docker, docker-ssh, virtualbox:
shell
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded !

After the registration is complete, you can view the Runner you registered in the above figure. At this point, all installations are completed, Runner's construction, and subsequent additions.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326227128&siteId=291194637