How to build gitlab on centos6

How to build gitlab on centos6

Preface

The original project was placed on the public network gitlab. For security reasons, a set was built on the intranet with a graphical interface. It can be directly imported from the external network git. I found it very convenient to use it. I recorded the installation process. Please refer to the official website: https://gitlab.com/gitlab-org/gitlab-recipes/tree/master/install/centos You can directly move there to see

Basic environment installation (git\redis\ruby\mysql...)

yum -y groupinstall 'Development Tools'
yum -y install readline readline-devel ncurses-devel gdbm-devel glibc-devel tcl-devel openssl-devel curl-devel expat-devel db4-devel byacc sqlite-devel libyaml libyaml-devel libffi libffi-devel libxml2 libxml2-devel libxslt libxslt-devel libicu libicu-devel system-config-firewall-tui redis sudo wget crontabs logwatch logrotate perl-Time-HiRes git cmake libcom_err-devel.i686 libcom_err-devel.x86_64 nodejs

yum -y install python-docutils
yum -y install postfix
git --version #Install a git version higher than 2.7.4 yum -y remove git
yum install zlib-devel perl-CPAN gettext curl-devel expat-devel gettext-devel openssl-devel
mkdir /tmp/git && cd /tmp/git
curl --progress https://www.kernel.org/pub/software/scm/git/git-2.9.0.tar.gz | tar xz
cd git-2.9.0
./configure
make
make prefix=/usr/local install

yum remove ruby ​​#Install a ruby ​​version higher than 2.1, delete the old one mkdir /tmp/ruby && cd /tmp/ruby
curl --progress https://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.9.tar.gz | tar xz
cd ruby-2.1.9
./configure --disable-install-rdoc
make
make prefix=/usr/local install
gem install bundler --no-doc
yum install redis mysql
/Data/apps/mysql/bin/mysqld_safe &
/Data/apps/mysql/bin/mysql -uroot
mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
mysql> grant all on gitlabhq_production.* to 'git'@'localhost' identified by 'git';

Configure redis

vim /etc/redis.conf

unixsocket /var/run/redis/redis.sock
unixsocketperm 0770
mkdir -p /var/run/redis
chown redis:redis /var/run/redis
chmod 755 /var/run/redis
/etc/init.d/redis start
usermod -aG redis git

Configure gitlab related

# Download git, using domestic sources. Foreign is too slow cd /home/git
sudo -u git -H git clone http://git.oschina.net/qiai365/gitlab-ce gitlab
cd /home/git/gitlab
sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml
sudo -u git -H editor config/gitlab.yml
# Change to your own host host: iaasgit1.prod.bj1
sudo -u git -H cp config/secrets.yml.example config/secrets.yml
sudo -u git -H chmod 0600 config/secrets.yml
sudo chown -R git log/
sudo chown -R git tmp/
sudo chmod -R u+rwX,go-w log/
sudo chmod -R u+rwX tmp/
sudo chmod -R u+rwX tmp/pids/
sudo chmod -R u+rwX tmp/sockets/
sudo -u git -H mkdir public/uploads/
sudo chmod 0700 public/uploads
sudo chmod ug+rwX,o-rwx /home/git/repositories/
sudo chmod -R u+rwX builds/
sudo chmod -R u+rwX shared/artifacts/
sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb
nproc
sudo -u git -H editor config/unicorn.rb
sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb
sudo -u git -H git config --global core.autocrlf input
sudo -u git -H git config --global gc.auto 0
sudo -u git -H cp config/resque.yml.example config/resque.yml
sudo -u git -H editor config/resque.yml

Configure the db part only for mysql

sudo -u git cp config/database.yml.mysql config/database.yml
sudo -u git -H editor config/database.yml #Configure the password for the production part: "password"
sudo -u git -H chmod o-rwx config/database.yml

Install gitlab related and start

# install gems
cd /home/git/gitlab
sudo -u git -H bundle install --deployment --without development test postgres aws kerberos

# install gitlab shell
sudo -u git -H bundle exec rake gitlab:shell:install[v3.3.3] REDIS_URL=unix:/var/run/redis/redis.sock RAILS_ENV=production
sudo -u git -H editor /home/git/gitlab-shell/config.yml

# install gitlab-workhorse
cd /home/git
sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-workhorse.git
cd gitlab-workhorse
sudo -u git -H git checkout v0.7.5
sudo -u git -H make

# Initialize Database and Activate Advanced Features
cd /home/git/gitlab
sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production

sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production GITLAB_ROOT_PASSWORD=yourpassword GITLAB_ROOT_EMAIL=youremail
cp lib/support/init.d/gitlab /etc/init.d/gitlab
cp lib/support/init.d/gitlab.default.example /etc/default/gitlab
chkconfig gitlab on
cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production
service gitlab start

Configure nginx

yum install nginx
cp lib/support/nginx/gitlab /Data/apps/nginx/conf/include/gitlab.conf
usermod -a -G git nginx
chmod g+rx /home/git/
/Data/apps/nginx/conf/include/gitlab.conf #Configure the server_name in this configuration

Finally check

cd /home/git/gitlab
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
# Start gitlab
/etc/init.d/gitlab restart

# Open the URL corresponding to server_name directly and find that the styles are gone. Execute sudo -u git -H bundle exec rake assets:clean assets:precompile REDIS_URL=unix:/var/run/redis/redis.sock RAILS_ENV=production

Finally, let me explain

This is just a record of the day-to-day operations. It may involve issues such as permissions. Make sure that nginx\git have permissions to each other. Also, use the check script to check. The prompts are very friendly and can usually be fixed. I wish you success.

The yum used in the middle uses a rewritten packaged rpm, so the path is different from the default. If you use the default, you can change it according to your own situation, or refer to the official website directly. This is a castrated version of the official website based on your own environment.

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Detailed tutorial on using Docker to build Gitlab based on CentOS8 system
  • Teach you the detailed process of using Docker to build the Chinese version of gitlab community
  • Two ways to build a private GitLab using Docker
  • Methods and steps for deploying GitLab environment based on Docker
  • Detailed tutorial on building Gitlab server on CentOS8.1
  • Centos7 uses docker to build gitlab server
  • How to build gitlab using Docker example
  • Steps to build your own private GitHub repository with GitLab
  • Detailed explanation of using docker to build gitlab
  • Build a local GitLab server on CentOS7

<<:  Vue implements the requirement of dragging and dropping dynamically generated components

>>:  Installation steps of mysql under linux

Recommend

Sharing ideas on processing tens of millions of data in a single MySQL table

Table of contents Project Background Improvement ...

How to start and stop SpringBoot jar program deployment shell script in Linux

Without further ado, let me give you the code. Th...

Javascript tree menu (11 items)

1. dhtmlxTree dHTMLxTree is a feature-rich Tree M...

Summary of MySQL stored procedure permission issues

MySQL stored procedures, yes, look like very rare...

How to change the password of mysql5.7.20 under linux CentOS 7.4

After MySQL was upgraded to version 5.7, its secu...

vsftpd virtual user based on MySql authentication

Table of contents 1. MySQL installation 1.2 Creat...

Code analysis of user variables in mysql query statements

In the previous article, we introduced the MySQL ...

How to install MySql in CentOS 8 and allow remote connections

Download and install. First check whether there i...

MySQL sorting principles and case analysis

Preface Sorting is a basic function in databases,...

Summary of related functions for Mysql query JSON results

The JSON format field is a new attribute added in...

How to achieve centered layout in CSS layout

1. Set the parent container to a table and the ch...

JavaScript code to implement Weibo batch unfollow function

A cool JavaScript code to unfollow Weibo users in...

MySQL stored procedure method example of returning multiple values

This article uses an example to describe how to r...

MySQL Series 7 MySQL Storage Engine

1. MyISAM storage engine shortcoming: No support ...