Welcome: Hunan Intelligent Applications Tecgnology CO.,ltd.-HNIAT.com
Language: Chinese ∷  English

Basic knowledge

Teach you how to install gitlab in source code

Speaking of GitLab, everyone who has completed the program is definitely familiar with it. GitLab is an open source project for warehouse management, using Git as a code management tool and building a web service on this basis, similar to the familiar GitHub. The difference is that if GitHub wants to use a private warehouse, it must pay a fee, while GitLab can be built on an individual server, and all database information is also on its own server. Therefore, it is suitable for collaborative development within the team, which can be seen as an individual GitHub at the time
System preparation work
#Close selinux
vim etc/sysconfig/selinux
SELINUX=disabled
Install epel source
#Download EPEL's GPG KEY and import it into the system
wget -O etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6  https://mirrors.tuna.tsinghua.edu.cn/epel/RPM-GPG-KEY-EPEL-6
rpm --import etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
#Install the 'epel release latest 6. noarch. rpm' package to enable EPEL
rpm -Uvh  http://mirrors.ustc.edu.cn/epel/epel-release-latest-6.noarch.rpm
Installation dependencies
yum groupinstall "Development tools"
yum install gcc autoconf cmake unzip vim libcurl-devel zlib-devel curl-devel expat-devel gettext-devel openssl-devel perl-devel nodejs libicu-devel wget curl
Delete the original git in the system
yum remove git
Install gitlab
#Download git
curl -O --progress  https://www.kernel.org/pub/software/scm/git/git-2.9.3.tar.gz
tar -xzf git-2.9.3.tar.gz
cd git-2.9.3
./configure
make prefix=/usr/local all
make prefix=/usr/local install
#Verify git version number
git --version
#View the git installation path
Add user variables, modify environment variables
#Modify the environment variable PATH of the git user to run as root user
visudo
#Find the following line
Defaults   secure_ path = sbin:/bin:/usr/sbin:/usr/bin
#Modify to
Defaults   secure_ path = sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
Install Ruby
#Check if the system is using installed Ruby, and if it is, use the command to remove it ('yum remove ruby ')
rpm -qa|grep ruby
#Source code installation Ruby
curl -O --progress  http://mirrors.ustc.edu.cn/ruby/2.1/ruby-2.1.8.tar.gz
tar xzf ruby-2.1.8.tar.gz
cd ruby-2.1.8
./configure --disable-install-rdoc
make && make install
##Domestic use of gems, it is best to modify the gems source to domestic
#Modify the gem installation source to domestic (using Zhongke Dayuan as an example)
gem sources --add  https://gems.ruby-china.org/  --remove  https://rubygems.org/
#Confirm that the gems source has been modified
gem sources -l
#Install bundle
gem install bundler --no-ri --no-rdoc
#Modify the source of the bundle to be domestic (using Zhongke Dayuan as an example)
sudo -u git -H bundle config mirror. https://rubygems.org   https://gems.ruby-china.org/
Install the go compiler
curl -O --progress  http://www.golangtc.com/static/go/1.5.3/go1.5.3.linux-amd64.tar.gz
tar -C usr/local -xzf go1.5.3.linux-amd64.tar.gz
sudo ln -sf usr/local/go/bin/{go,godoc,gofmt} usr/local/bin/
rm go1.5.3.linux-amd64.tar.gz
#Verify if go is installed correctly
go version
Install PostgreSQL database
#Configure PostgreSQL installation source:
https://wiki.postgresql.org/wiki/YUM_Installation#Configure_your_YUM_repository
##The specific operations are as follows
#Modify/etc/yum. repos. d/CentOS Base. repo and add the following configuration in the [base] and [update] paragraphs
exclude=postgresql*
#Install PostgreSQL source
yum localinstall  http://mirrors.ustc.edu.cn/postgresql/repos/yum/9.5/redhat/rhel-6-x86_64/pgdg-centos95-9.5-1.noarch.rpm
#Install PostgreSQL
yum install postgresql95-server postgresql95-devel postgresql95-contrib
#By default, the postgreSQL database files are stored in the
/var/lib/pgsql/9.5/data
#Initialize
mv etc/init.d/{postgresql-9.5,postgresql}
service postgresql initdb
#Start PostgreSQL
service postgresql start
#Configure PostgreSQL self start
chkconfig postgresql on
#Create a user for Gitlab with the username git
sudo -u postgres psql -d template1 -c "CREATE USER git CREATEDB;"
#Create a Gitlab production environment database and grant Git user owner permissions
sudo -u postgres psql -d template1 -c "CREATE DATABASE gitlabhq_production OWNER git;"
#Test whether you can log in to the database you just created using Git user
sudo -u git -H psql -d gitlabhq_ production
#Exit database session
gitlabhq_ production> \q
#Create pg_ Soft connection of config
ln -s usr/pgsql-9.5/bin/pg_ config usr/bin/pg_ config
#Add postgreSQL extension
sudo -u postgres -H psql -d gitlabhq_ production
gitlabhq_ production=#  CREATE EXTENSION IF NOT EXISTS pg_ trgm;
Encountered two pits here
1. The user is not authorized to log in, resulting in login verification failure
terms of settlement:
vim var/lib/pgsql/9.5/data/pg_ hba.conf
take
host    all             all             127.0.0.1/32            ident
Modify to
host    all             all             127.0.0.1/32            trust
2. The established user does not have super permissions
ERROR:  permission denied to create extension "pg_trgm"
Solution: Authorize account SUPERUSER permissions
ALTER ROLE user CREATEROLE SUPERUSER;
Install Redis
#Installation
mkdir tmp/redis && cd tmp/redis
curl -O --progress  http://download.redis.io/releases/redis-3.0.7.tar.gz
tar zxf redis-3.0.7.tar.gz
cd redis-3.0.7
make && make install
mkdir -p etc/redis
cp redis.conf etc/redis
#Configuration
cp etc/redis/redis.conf etc/redis/redis.conf.orig
#Set 'post' to 0 to disable listening on TCP ports
sed 's/^port .*/port 0/' etc/redis/redis.conf.orig | sudo tee etc/redis/redis.conf
#Enable Redis to start in socket mode
echo 'unixsocket var/run/redis/redis.sock' | sudo tee -a etc/redis/redis.conf
#Start daemon
sed -i 's/daemonize no/daemonize yes/g' etc/redis/redis.conf
#Create a directory for storing sockets
mkdir var/run/redis
sudo chown redis:redis var/run/redis
sudo chmod 755 var/run/redis
# Persist the directory which contains the socket, if applicable
if [ -d etc/tmpfiles.d ];  then
echo 'd  var/run/redis  0755  redis  redis  10d  -' | sudo tee -a etc/tmpfiles.d/redis.conf
fi
#Add git users to the Redis group
sudo usermod -aG redis git
#Download Redis init script
curl -L  http://packages.gitlab.cc/install/init-script/redis/cenots6/redis-server  -o etc/init.d/redis-server
chmod +x etc/init.d/redis-server
#Start Redis service
service redis-server start
#Adding Redis to Self Start
chkconfig redis-server on
Install GitLab-CE
#We will install gitlab to the HOME directory of git users
cd home/git
#Clone gitlab-ce source code
sudo -u git -H git clone  https://git.ustclug.org/gitlab-cc/gitlab-ce.git  -b 8-7-stable gitlab
###Configure gittab ce
#Enter the gittab directory
cd home/git/gitlab
#Copy Gitlab.yml (Gitlab's main configuration file)
sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml
#Modify gitlab.yml
sudo -u git -H vim

CONTACT US

Contact: Manager Xu

Phone: 13907330718

Tel: 0731-22222718

Email: hniatcom@163.com

Add: Room 603, 6th Floor, Shifting Room, No. 2, Orbit Zhigu, No. 79 Liancheng Road, Shifeng District, Zhuzhou City, Hunan Province

Scan the qr codeClose
the qr code