"Gitlab" Gitlab Quick Deploy tutorial

Source: Internet
Author: User

Gitlab Rapid Deployment Tutorial Deployment environment
    • Ubuntu 16.04 (pro-Test available)
Start Deployment Installation Dependencies
sudo apt-get install curl openssh-server ca-certificates postfix

When the execution is complete, the mail configuration appears, select the Internet item (without smarthost)

Download package

Download page: https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu/pool/xenial/main/g/gitlab-ce/

You can choose the version you want to deploy and download it using commands curl

curl -O https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu/pool/xenial/main/g/gitlab-ce/gitlab-ce_11.3.6-ce.0_amd64.deb
Install packages
sudo dpkg –i gitlab-ce_11.3.6-ce.0_amd64.deb

If the installation process error, you need to resolve the dependencies and other issues (I install all normal)

Configuration generation
sudo gitlab-ctl reconfigure

Initial installation use be sure to remember the build configuration

Check

Enter the following command to check if the installation is correct

sudo gitlab-ctl status

A result similar to the following appears, indicating that it is functioning properly

run: gitlab-workhorse: (pid 1148) 884s; run: log: (pid 1132) 884s  run: logrotate: (pid 1150) 884s; run: log: (pid 1131) 884s run: nginx: (pid 1144) 884s; run: log: (pid 1129) 884s run: postgresql: (pid 1147) 884s; run: log: (pid 1130) 884srun: redis: (pid 1146) 884s; run: log: (pid 1133) 884s run: sidekiq: (pid 1145) 884s; run: log: (pid 1128) 884s   run: unicorn: (pid 1149) 885s; run: log: (pid 1134) 885s
Use

When using, the system administrator account name is root , you need to set up an root account password first.

If a 502 error occurs, the Read permission for the following file is opened

sudo chmod -R o+x /var/opt/gitlab/gitlab-rails
Configure tuning Deployment Domain name adjustments

Editing a configuration file

sudo nano /etc/gitlab/gitlab.rb

Modify the internal external_url to your own deployment domain name, for example:

    • If it is local area network direct IP access, set to http://xxx.xxx.xxx.xxx
    • If the extranet is accessed through a domain name, set tohttp://your.domain-name.com

Then, rebuild the configuration

sudo gitlab-ctl reconfigure
Use Nginx Deployment yourself

In fact, this fast-deployment package is self-bringing nginx , but the actual server deployment, we often need to deploy on the system's native nginx , we can operate in this way:

To nginx add a configuration to the configuration file:

# Gitlab Socket file address upstream Gitlab {# 7.x version in this location # server unix:/var/opt/gitlab/gitlab-rails/tmp/sockets/gitlab.socket; # 8.0+ Version location (11.x version Pro-Test available) server Unix://var/opt/gitlab/gitlab-rails/sockets/gitlab.socket;}  server {Listen *:80;   server_name gitlab.liaohuqiu.com;     # Please modify server_tokens off for your domain name;  # don ' t show the version number, a security best practice root/opt/gitlab/embedded/service/gitlab-rails/public; # Increase this if you want to upload large attachments # Or if your want to accept large git objects over HTTP client_ma  X_body_size 250m;  # individual Nginx logs for this gitlab vhost Access_log/var/log/gitlab/nginx/gitlab_access.log;  Error_log/var/log/gitlab/nginx/gitlab_error.log;    Location/{# serve static files from defined root folder;.  # @gitlab is a named location for the upstream fallback, see below Try_files $uri $uri/index.html $uri. html @gitlab; # If a file, which is isn't found in the root folder was requested, # then the proxy pass thE Request to the Upsteam (Gitlab Unicorn) location @gitlab {# If you use HTTPS make sure you disable gzip compression # to is safe against BREACH attack Proxy_read_timeout 300;    # Some requests take more than seconds. Proxy_connect_timeout 300;    # Some requests take more than seconds.    Proxy_redirect off;    Proxy_set_header X-forwarded-proto $scheme;    Proxy_set_header Host $http _host;    Proxy_set_header X-real-ip $remote _addr;    Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for;    Proxy_set_header x-frame-options Sameorigin;  Proxy_pass Http://gitlab; } # Enable gzip compression as per Rails Guide:http://guides.rubyonrails.org/asset_pipeline.html#gzip-compression # WAR Ning:if you is using relative URLs do remove the block below # see config/application.rb under ' Relative URL support ' F or the list of # Other files, need to being changed for relative URLs support location ~ ^/(assets)/{root/opt/Gitlab/embedded/service/gitlab-rails/public; # gzip_static on;    # to serve pre-gzipped version expires Max;  Add_header Cache-control public; } error_page 502/502.html;}

Edit Gitlab configuration file

sudo nano /etc/gitlab/gitlab.rb

Disable out of the band nginx (if you do not have this sentence to add)

nginx['enable'] = false

Restart Nginx, restart Gitlab service

sudo /usr/local/nginx/sbin/nginx -s reloadsudo gitlab-ctl reconfigure

Similarly, if the 502 error occurs again, you need to modify the configuration

sudo chmod -R o+x /var/opt/gitlab/gitlab-rails

"Gitlab" Gitlab Quick Deploy tutorial

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.