Gitlab Server Installation

Source: Internet
Author: User
Tags administrator password

1. Sample Host information:

Hostname:vm0.lansgg.com

ip:192.168.85.128

Os:centos 6.5 x64

Gitlab version: gitlab-ce-8.7.0-ce.0.el6.x86_64.rpm

Ps: Close Iptables SELinux

2, the system relies on software installation

[email protected] ~]# Yum Install Curl Openssh-server openssh-clients cronie–y

3, Installation Gitlab

[[Email protected] ~]# rpm -vhi gitlab-ce-8.7.0-ce.0.el6.x86_64.rpm preparing ...                 ############## ############################# [100%]   1:gitlab-ce               ########################################### [100%]gitlab:  thank you for installing gitlab!gitlab: to configure and start  GitLab, RUN THE FOLLOWING COMMAND:sudo gitlab-ctl reconfiguregitlab:  gitlab should be reachable at http://vm0.lansgg.comgitlab: otherwise  configure gitlab for your system by editing /etc/gitlab/gitlab.rb  filegitlab: and running reconfigure again.gitlab: gitlab: for a  comprehensive list of&Nbsp;configuration options please see the omnibus gitlab readmegitlab:  https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/readme.mdgitlab: it looks like  GitLab has not been configured yet; skipping the upgrade  Script. [[email protected] ~]#

3.1. Initialization

[Email protected] ~]# Gitlab-ctl reconfigure

To this installation success:

Address: http://192.168.85.128/

The default user name is root and the password is 5IVEL!FE

You will be prompted to modify the current administrator password after logging in

4. Set HTTPS

Create an SSL certificate directory

[[email protected] ~]# mkdir-p/etc/gitlab/ssl[[email protected] ~]# Cd/etc/gitlab/ssl/[[email protected] ssl]# ll total dosage 8- Rw-r--r--. 1 root root 1444 September 7 16:16 vm0.lansgg.com.crt-rw-r--r--. 1 root root 1704 September 7 16:16 vm0.lansgg.com.key[[email protected] ssl]#

4.1. Modify the SSL certificate file address in the GIT configuration item #/ETC/GITLAB/GITLAB.RB (#大约是477行)

External_url ' 472 nginx[' enable ' = true473 nginx[' client_max_body_size '] = ' 250m ' 474 nginx[' Redirect_http_to_https ' ] = false475 # nginx[' redirect_http_to_https_port ') = 80476 nginx[' ssl_client_certificate '] = "/etc/gitlab/ssl/ Vm0.lansgg.com.crt "477 nginx[' ssl_certificate '] ="/ETC/GITLAB/SSL/VM0.LANSGG.COM.CRT "

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/86/F5/wKioL1fPzhOS90LRAABeko6ArO4912.jpg-wh_500x0-wm_3 -wmp_4-s_38463105.jpg "title=" g1.jpg "alt=" Wkiol1fpzhos90lraabeko6aro4912.jpg-wh_50 "/>

4.2. Modify Nginx configuration file

The server {listen *:443; + SSL on; SSL_CERTIFICATE/ETC/GITLAB/SSL/VM0.LANSGG.COM.CRT Ssl_certificate_ Key/etc/gitlab/ssl/vm0.lansgg.com.key;

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/86/F7/wKiom1fPzqGwCYj2AAAps_98CtY988.jpg-wh_500x0-wm_3 -wmp_4-s_3031574535.jpg "title=" g2.jpg "alt=" Wkiom1fpzqgwcyj2aaaps_98cty988.jpg-wh_50 "/>

4.3. Configure HTTP Jump HTTPS

[Email protected] ssl]# vim/var/opt/gitlab/nginx/conf/index.conf # # #新建server {listen *:80;      server_name www.abc.com; Rewrite ^ (. *) $ https://$host $ permanent;}

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/86/F7/wKiom1fPzwyz__gqAAAnVI1TsZQ705.jpg-wh_500x0-wm_3 -wmp_4-s_3928988290.jpg "title=" g3.jpg "alt=" Wkiom1fpzwyz__gqaaanvi1tszq705.jpg-wh_50 "/>

4.4. Modify the configuration file to load index.conf

Profile Address:/var/opt/gitlab/nginx/conf/nginx.conf, add the following to it

include/var/opt/gitlab/nginx/conf/index.conf;include/var/opt/gitlab/nginx/conf/gitlab-http.conf;

4.5. Restart Service

After all of the above operations are complete, use gitlab-ctl Restart to restart all services and use HTTPS to access Gitlab.

https://192.168.85.128

Https://vm0.lansgg.com


5, Gitlab Backup and restore

5.1, Gitlab Backup

Installing Gitlab with the Gitlab one-click installation package is simple, and the same backup recovery and migration is simple. Use one command to create a full Gitlab backup:

[Email protected] ssl]# Gitlab-rake gitlab:backup:create

Using the command above will create a name in the/var/opt/gitlab/backups directory similar to the following:

1467362634_gitlab_backup.tar compressed package, which is the entire full part of Gitlab, where the beginning of 1473237111 is the date the backup was created.

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/86/F7/wKiom1fP0Lfyt1blAAB4iUGQjJE645.jpg-wh_500x0-wm_3 -wmp_4-s_3579822728.jpg "title=" g4.jpg "alt=" Wkiom1fp0lfyt1blaab4iugqjje645.jpg-wh_50 "/>

Gitlab Modify the backup file default directory

[Email protected] etc]# vim/var/opt/gitlab/gitlab-rails/etc/gitlab.yml

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/86/F7/wKiom1fP0TKjQ8G4AABixakT-_U893.jpg-wh_500x0-wm_3 -wmp_4-s_2977258148.jpg "title=" g5.jpg "alt=" Wkiom1fp0tkjq8g4aabixakt-_u893.jpg-wh_50 "/>

Gitlab Automatic backup

You can also use Backup commands with crontab to automate backups:

0 2 * * */opt/gitlab/bin/gitlab-rake gitlab:backup:create

5.2, the Gitlab restore


Stop related services

[[email protected] etc]# gitlab-ctl stop unicorn[[email protected] etc]# gitlab-ctl stop Sidekiq


Recovering from a backup file

Take 20160630 backup file 1467225280_gitlab_backup.tar as an example)

Put the recovered files 1467225280_gitlab_backup.tar to the Gitlab backup directory

[email protected] gitback]# CP 1467225280_gitlab_backup.tar/var/opt/gitlab/backups/

Recover by number

[Email protected] gitback]# Gitlab-rake gitlab:backup:restorebackup=1467225280


Restart

[Email protected] etc]# gitlab-ctl restart


Solution Solutions :

1 , follow the above recovery Gitlab, when you access the GIT address, you may receive a 500 error, as follows:

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M00/86/F7/wKiom1fP0ifBTLtKAAB6vu3u9TM032.jpg-wh_500x0-wm_3 -wmp_4-s_2203320516.jpg "title=" g6.jpg "alt=" Wkiom1fp0ifbtltkaab6vu3u9tm032.jpg-wh_50 "/>

View the log information as follows:

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M00/86/F7/wKiom1fP0l6CRvxJAAB5D1ujIeA751.jpg-wh_500x0-wm_3 -wmp_4-s_3166695165.jpg "title=" g7.jpg "alt=" Wkiom1fp0l6crvxjaab5d1ujiea751.jpg-wh_50 "/>

Initially thought, because the use of SSL access to decrypt the problem, check the data, try the following steps:

The temporary Solutions is:

    1. Copy the old db_key_base from the old instance to the new one.

    2. Delete imported project data is the no longer required by projects. Something like this could work:


Execute command: Gitlab-rails Runner "Project.where.not (Import_url:nil). Each {|p| P.import_data.destroyif P.import_data} "


650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/86/F6/wKioL1fP0o-h4MTpAABLzrqfCQ8125.jpg-wh_500x0-wm_3 -wmp_4-s_2756654879.jpg "title=" g8.jpg "alt=" Wkiol1fp0o-h4mtpaablzrqfcq8125.jpg-wh_50 "/>



This article is from the "Big Wind" blog, please be sure to keep this source http://lansgg.blog.51cto.com/5675165/1847370

Gitlab Server Installation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.