CentOS 6.5 environment installation GitLab private code hosting project management program record

888u

Last update at :2024-06-16,Edit by888u

Gitlab is an open source project management program developed using Ruby on Rails. We can use it to store code and collaborative management like GITHUB, and can access public or private project repositories through the WEB interface. If it is our personal project, it would be good to host it on GITHUB or a service provider such as GITCAFE or CODING in mainland China.

Gitlab installation environment requirements are also relatively high. If you want to achieve operational efficiency, the official recommendation is that you need more than 2GB of memory, an SSD solid-state drive, and a CPU with 2 cores or more. In this article, Snail only records its own local installation process, and some of its script projects are still hosted by third parties.

First, install the necessary system packages

yum -y install wget curl gcc libxml2-devel libxslt-devel make openssh-server libyaml-devel postfix libicu-devel libcurl-devel libcurl readline-devel readline glibc glibc-devel openssl-devel openssl mysql++-devel postgresql-devel zlib -devel git

Second, install development tools

yum -y groupinstall \\’Development Tools\\’

Third, install Redis and Nginx

yum -y install redis

yum -y install nginx

If you encounter the problem of No package redis available, use \\"Solve the problem of "No package redis available" prompt in CentOS\\" to solve the problem.

Fourth, check and start Nginx and Redis

chkconfig nginx onchkconfig redis onservice redis start

Fifth, create ruby ​​storage and settings

mkdir /tmp/ruby && cd /tmp/rubycurl –progress ftp://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.0.tar.gz | tar xzcd ruby-2.1. 0./configure –prefix=/usr/local/make && make install

Sixth, install bundler and rails

gem install bundlergem install rails

Seventh, create a GitLab user

useradd –comment \\’GitLab CI\\’ -m gitlab_ci

Eighth, grab gitlab-ci

cd /home/gitlab_ci/git clone https://github.com/gitlabhq/gitlab-ci.gitcd gitlab-ci

Ninth, check the latest version of the branch and set the permission directory

git checkout 5-0-stablemkdir -p tmp/pidsmkdir -p tmp/socketschmod -R 755 tmp/

Tenth, add database

11. Install ruby ​​development tools

bundle –without development test

12. Configuration database file

cp config/database.yml.mysql config/database.ymlvim config/database.ymlSet Database Host

and see below

production:adapter: mysql2encoding: utf8reconnect: falsedatabase: gitlab_ci_productionpool: 5username: gitlab_cipassword: \\”g1tlabc1\\”host: 10.79.0.85# socket: /tmp/mysql.sock

Thirteenth, continue to set up the main environment

cp config/application.yml.example config/application.ymlcp config/unicorn.rb.example config/unicorn.rb

Change the server URL and set HTTPS to FALSE

14. Modify the permissions of the gitlab_ci user directory

cd /homechown -R gitlab_ci:gitlab_ci gitlab_ci

Fifteenth, return to the Gitlab-CI directory and populate the MySQL table

cd gitlab_ci // User Directorycd gitlab_ci // Application Directory

16. Install Ruby

sudo -u gitlab_ci -H /usr/local/bin/bundle install –without development test postgres –deployment

Seventeenth, operation and settings

su gitlab_ci/usr/local/bin/bundle exec /usr/local/bin/rake setup RAILS_ENV=production

Eighteenth, set up cronjob

yum install -y crontabssu gitlab_cibundle exec whenever -w RAILS_ENV=productionsu

Nineteenth, install init script

cp /home/gitlab_ci/gitlab-ci/lib/support/init.d/gitlab_ci /etc/init.d/gitlab_cichmod +x /etc/init.d/gitlab_cichkconfig gitlab_ci on

Twenty, modify the init script

%s/bundle/\\\\/usr\\\\/local\\\\/bin\\\\/bundle/g%s/rake/\\\\/usr\\\\/ local\\\\/bin\\\\/rake/g

No. 21. Modify the /etc/sudoers directory to allow gitlab_ci to run

Found: Defaults requiretty modified to:Defaults:gitlab_ci !requiretty

Twenty-two, setting up Nginx

cd /etc/nginxmkdir sites-available sites-enabledwget https://raw.github.com/gitlabhq/gitlab-ci/2-2-stable/lib/support/nginx/gitlab_ci -P /etc/nginx/ sites-available/ln -s /etc/nginx/sites-available/gitlab_ci /etc/nginx/sites-enabled/gitlab_ci

vim /etc/nginx/sites-available/gitlab_ci

Modify the items as follows:

# GITLAB CI# Maintainer: @randx# App Version: 2.0

upstream gitlab_ci {server unix:/home/gitlab_ci/gitlab-ci/tmp/sockets/gitlab-ci.socket;}

server {#listen 10.79.0.88:80 default_server;                                                                                                                                                            /home/gitlab_ci/gitlab-ci/public;

access_log /var/log/nginx/gitlab_ci_access.log;error_log /var/log/nginx/gitlab_ci_error.log;

location / {try_files $uri $uri/index.html $uri.html @gitlab_ci;}

location @gitlab_ci {proxy_read_timeout 300;proxy_connect_timeout 300;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_pass http://gitlab_ci;proxy_pass http://127.0.0.1:8080;}

# adjust this to match the largest build log your runners might submit,# set to 0 to disable limitclient_max_body_size 10m;}

Twenty-three, set the conf.d directory

cp /etc/nginx/sites-available/gitlab_ci /etc/nginx/conf.d/gitlab_ci.conf

Twenty-fourth, move the default.conf file

mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.notused

Twenty-five, check configuration

nginx -t

Twenty-sixth, start gitlab and nginx

sudo gitlab_ci/etc/init.d/gitlab_ci startexitservice nginx start

Twenty-seven. Set the current user

useradd –comment \\’GitLab CI Runner\\’ -m gitlab_ci_runner

Twenty-eight, get the code

su gitlab_ci_runnercd ~/git clone https://gitlab.com/gitlab-org/gitlab-ci-runner.gitcd gitlab_ci_runner

Twenty-nine, install gems

bundle install –deployment

Thirty, set up users

bundle exec ./bin/setup

Thirty-one, enter our installation path

http://localhost:8080

32. Input background management

http://gitlabci.laozuo.org/admin/runners

Thirty-three, set up the init script

exit // get back to rootcd /home/gitlab_ci_runner/gitlab-ci-runner/cp ./lib/support/init.d/gitlab_ci_runner /etc/init.d/gitlab-ci-runnerchmod +x /etc/ init.d/gitlab-ci-runnerchkconfig gitlab-ci-runner on

34. Start

service gitlab-ci-runner start

So far, I have reluctantly installed the entire GitLab. The process is really long and it took me more than half a day. Writing tutorials is really a waste of time, and some steps have been omitted. I will add more later depending on the situation. Seeing how complicated it is, it’s better to use GITHUB.

Recommended site searches: icp filing center, filing, US free space, icp filing query system, station group server rental, overseas host, server, virtual host purchase, Korean independent server, domain name expiration query,

CentOS 6.5 environment installation GitLab private code hosting project management program record

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码