Home IT Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Gitlab installation under CentOS 7     - Linux using TCP-Wrapper Service Management (Linux)

- The istgt PSD on ported to Mac OS X (Linux)

- NaSC using simple mathematical operations on Ubuntu and Elementary OS (Linux)

- ORA-00600: internal error code, arguments: [keltnfy-ldmInit], [46], [1], [], [], [], [], [] (Database)

- init level settings for Linux / etc / inittab file into six (restart) or does not support the level of solution (Linux)

- Use the Find command to help you find those files that need to be cleaned (Linux)

- Source code is installed MySQL 5.6.28 (Database)

- Linux command to view the system status (Linux)

- Linux system security configuration (Linux)

- Docker build their own private warehouses (Linux)

- OpenSSL Introduction and compilation steps on Windows, Linux, Mac systems (Linux)

- The method of Linux into the rescue mode (Linux)

- Linux / Unix: chroot command examples to explain (Linux)

- Nodejs command-line program development tutorial (Programming)

- 10 Best Swift Tutorial examples (Programming)

- Use Ansible installation NGINX and NGINX Plus (Server)

- Linux operating system security tools of the Logs (Linux)

- Debian Stable (Jessie 8.1) of normal.mod not found (Linux)

- The relationship between UNIX and Linux (Linux)

- Repair CentOS 6.4 Grub boot (Linux)

 
         
  Gitlab installation under CentOS 7
     
  Add Date : 2018-11-21      
         
       
         
  GitLab, is a use of Ruby on Rails development of open source applications to achieve a self-hosted Git repository project, accessible public or private projects through a Web interface.

It has similar features with Github, you can browse the source code, management deficiencies and comments. The management team can access to the repository, it is very easy to navigate and offers submitted version history of a document library. Team members can use the built-in simple chat program (Wall) to communicate. It also provides a snippet collection functions can easily achieve code reuse easy when there is a need in the future to find out.

Open source projects address: https: //github.com/gitlabhq/gitlabhq

installation steps

1, to provide some package must provide epel, turn off the firewall and selinux and other operations;

2, gitlab more dependent python function, you need to upgrade to python 2.7.X;

3, install redis memory database;

4, install MySQL relational database;

5, to provide environmental support gitlab of ruby;

6, to provide gitlab-shell to manage the git repository;

7, the installation gitlab system;

8, install nginx web service, to do the reverse proxy.

First, install the extended source and dependencies

# Install extensions source
rpm -ivh epel-release-7-5.noarch.rpm # modify /etc/yum.repo.d/epel.repo
# Increase puias source
wget -O /etc/yum.repos.d/PUIAS_6_computational.repo
wget -O / etc / pki / rpm-gpg / RPM-GPG-KEY-puias http://springdale.math.ias.edu/data/puias/6/x86_64/os/RPM-GPG-KEY-puias
rpm --import / etc / pki / rpm-gpg / RPM-GPG-KEY-puias
# Verify successful
rpm -qa gpg *

See warehouse source

yum repolist
It is loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * PUIAS_6_computational: www.puias.princeton.edu
 * Epel: ftp.sjtu.edu.cn
Warehouse Warehouse identifies the name of the state
PUIAS_6_computational PUIAS computational Base 6 - x86_64 2,638
base CentOS-6 - Base - 163.com 6,518
* Epel Extra Packages for Enterprise Linux 6 - x86_64 11,148
extras CentOS-6 - Extras - 163.com 36
updates CentOS-6 - Updates - 163.com 727
repolist: 21,067

If this list does not epel and PUIAS_6_computational, execute the following command

yum-config-manager --enable epel --enable PUIAS_6_computational

Second, the installation dependencies

yum -y update
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 libcom_err-devel

Third, install Git

yum -y remove git
yum -y install zlib-devel perl-CPAN gettext curl-devel expat-devel gettext-devel openssl-devel
mkdir / tmp / git && cd / tmp / git
wget
tar zxvf git-2.6.0.tar.gz
cd git-2.6.0
./configure --prefix = / usr / local
make && make install

Verify Git

git --version

Fourth, the installation Ruby

yum -y remove ruby
cd / tmp / git
wget
tar zxvf ruby-2.2.3.tar.gz
cd ruby-2.2.3
 ./configure --prefix = / usr / local / ruby --disable-install-rdoc
 make && make install

Verify Ruby

ruby -v
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]

Modify RubyGames mirror Taobao, increase download speed

  vim / home / git / gitlab / Gemfile
  source "# replace Taobao

Install bundler

gem install bundler --no-doc

Fifth, create a system user

adduser --system --shell / bin / bash --comment 'GitLab' --create-home --home-dir / home / git / git

Sixth, modify sudo file, allowing users to use sudo git

visudo
Defaults secure_path = / sbin: / bin: / usr / sbin: / usr / bin: / usr / local / bin # replace this
# Add a line under the root ALL = (ALL) ALL
  git ALL = (ALL) ALL

Seven, install MySQL

# Uninstall CentOS7 comes MaraiaDB
rpm -qa | grep maraiadb
yum -y remove maraiadb
# Install dependencies
yum -y install make gcc-c ++ cmake bison-devel ncurses-devel
# Download MySQL
cd / tmp / git
wget wget
tar zxvf mysql-5.6.20.tar.gz
cd /mysql-5.6.20
# Compile MySQL
cmake \
-DCMAKE_INSTALL_PREFIX = / Usr / local / mysql \
-DMYSQL_DATADIR = / Usr / local / mysql / data \
-DSYSCONFDIR = / Etc \
-DWITH_MYISAM_STORAGE_ENGINE = 1 \
-DWITH_INNOBASE_STORAGE_ENGINE = 1 \
-DWITH_MEMORY_STORAGE_ENGINE = 1 \
-DWITH_READLINE = 1 \
-DMYSQL_UNIX_ADDR = / Var / lib / mysql / mysql.sock \
-DMYSQL_TCP_PORT = 3306 \
-DENABLED_LOCAL_INFILE = 1 \
-DWITH_PARTITION_STORAGE_ENGINE = 1 \
-DEXTRA_CHARSETS = All \
-DDEFAULT_CHARSET = Utf8 \
-DDEFAULT_COLLATION = Utf8_general_ci
#installation
make && make install
# Configure MySQL user
groupadd mysql
useradd -g mysql mysql
# Modify / usr / local / mysql
chown -R mysql: mysql / usr / local / mysql
# Initialize MySQL
cd / usr / local / mysql
# Execute initialization script
scripts / mysql_install_db --basedir = / usr / local / mysql --datadir = / usr / local / mysql / data --user = mysql
# Add service, set boot
cp support-files / mysql.server /etc/init.d/mysql
chkconfig mysql on
service mysql start - start MySQL
# Configuration Variables
vim / etc / profile
  PATH = / usr / local / mysql / bin: $ PATH
  export PATH
source / etc / profile

Create a database, and the database user and authorization

mysql -u root -p
mysql> CREATE USER 'git' @ 'localhost' IDENTIFIED BY '123.com';
mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET` utf8` COLLATE `utf8_unicode_ci`;
. Mysql> GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production` * TO 'git' @ 'localhost';

Test success landing

mysql -ugit -p123.com -D gitlabhq_production

Eight, configure Redis

chkconfig redis on
  
cp /etc/redis.conf /etc/redis.conf.orig
  
# Modify the listening port
sed 's / ^ port * / port 0 /.' /etc/redis.conf.orig | tee /etc/redis.conf
  
# Add content
echo 'unixsocket /var/run/redis/redis.sock' | tee -a /etc/redis.conf
  
echo -e 'unixsocketperm 0770' | tee -a /etc/redis.conf

Create a directory to change permissions

mkdir / var / run / redis
  
chown redis: redis / var / run / redis
  
chmod 755 / var / run / redis

Start Service

service redis restart

Add git to redis group

usermod -aG redis git

Nine, installation GitLab

cd / home / git
  
Download Source #
sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 7-4-stable gitlab

Modify the configuration

cd gitLab /
  
sudo -u git -H cp config / gitlab.yml.example config / gitlab.yml
  
sudo -u git -H vim config / gitlab.yml
gitlab:
    ## Web server settings (note: host is the FQDN, do not include http: //)
    host: localhost
    port: 80
    https: false

Modify directory permissions

chown -R git log /
chown -R git tmp /
chmod -R u + rwX log /
chmod -R u + rwX tmp /
chmod -R u + rwX tmp / pids /
chmod -R u + rwX tmp / sockets /
chmod -R u + rwX public / uploads

Create a directory

sudo -u git -H mkdir / home / git / gitlab-satellites
chmod u + rwx, g = rx, o-rwx / home / git / gitlab-satellites

Edit the configuration file unicorn.rb

sudo -u git -H cp config / unicorn.rb.example config / unicorn.rb
  
# Display the number of cores
nproc
1
  
# Edit Configuration
sudo -u git -H vim config / unicorn.rb
worker_processes 1

Copy the configuration file

sudo -u git -H cp config / initializers / rack_attack.rb.example config / initializers / rack_attack.rb

Define global users and mailboxes

sudo -u git -H git config --global user.name "GitLab"
sudo -u git -H git config --global user.email "example@example.com"
sudo -u git -H git config --global core.autocrlf input

Edit Connection configuration redis

# Copy the configuration
sudo -u git -H cp config / resque.yml.example config / resque.yml
  
# Redis connection configuration, the default configuration, unmodified
sudo -u git -H vim config / resque.yml

X. GitLab database configuration file

sudo -u git cp config / database.yml.mysql config / database.yml
  
# Edit the configuration file
sudo -u git -H vim config / database.yml
production:
  adapter: mysql2
  encoding: utf8
  collation: utf8_general_ci
  reconnect: false
  database: gitlabhq_production
  pool: 10
  username: git
  password: "gitpwd"
  host: localhost
  socket: /var/lib/mysql/mysql.sock
  
# Modify file permissions, user-readable only git
sudo -u git -H chmod o-rwx config / database.yml

XI installed gem

cd / home / git / gitLab
  
sudo -u git -H bundle install --deployment --without development test postgres aws

XII installation GitLab-shell

sudo -u git -H bundle exec rake gitlab: shell: install [v2.0.1] REDIS_URL = unix: /var/run/redis/redis.sock RAILS_ENV = production
# Edit Configuration
sudo -u git -H vim /home/git/gitlab-shell/config.yml
---
user: git
gitlab_url: https: // localhost /
http_settings:
  self_signed_cert: true
repos_path: "/ home / git / repositories /"
auth_file: "/home/git/.ssh/authorized_keys"
redis:
  bin: "/ usr / bin / redis-cli"
  namespace: resque: gitlab
  socket: "/var/run/redis/redis.sock"
log_level: INFO
audit_usernames: false

XIII, initialize the database

sudo -u git -H bundle exec rake gitlab: setup RAILS_ENV = production

XIV script download service

wget -O /etc/init.d/gitlab
chmod + x /etc/init.d/gitlab
  
chkconfig --add gitlab
  
chkconfig gitlab on
  
# Set logrotate
cp lib / support / logrotate / gitlab /etc/logrotate.d/gitlab
  
# Detection application state
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
 
# To bin / web bin / background_jobs Directory Permissions
chmod 755 / home / git / gitlab / bin / web
 
chmod 755 / home / git / gitlab / bin / background_jobs
  
# Start Service
service gitlab start

Fifth, configure Web Services

I am using nginx #
yum -y install nginx
  
chkconfig nginx on
  
wget -O /etc/nginx/conf.d/gitlab.conf https://gitlab.com/gitlab-org/gitlab-ce/raw/master/lib/support/nginx/gitlab-ssl

Add to git group nginx

usermod -a -G git nginx
  
chmod g + rx / home / git /

Modify the configuration, modify server_name

1
2
3
4
5
6 vim /etc/nginx/conf.d/gitlab.conf
 # Two server_name If no domain name, change your IP address
 
# Comment nginx.conf the monitor port, or start behind nginx, will complain
 vim /etc/nginx/nginx.conf
  listen [::]: 80 default_server; commented

Adding SSL

mkdir / etc / nginx / ssl
 
Executive openssl req -newkey rsa: 2048 -x509 -nodes -days 3560 -out gitlab.crt -keyout gitlab.key # just fill in on the line, the last generation gitlab.crt gitlab.key
 
cp gitlab.crt gitlab.key / etc / nginx / ssl

Start nginx service

service nginx start
     
         
       
         
  More:      
 
- Linux Command - ps: a snapshot of the current process (Linux)
- Ubuntu 14.04 Nvidia graphics driver installation and settings (Linux)
- How to use OpenVPN and PrivacyIDEA build two-factor authentication for remote access (Server)
- MySQL replication master and slave structure built (Database)
- Upgrading to Debian 7.6 glibc 2.15 (Linux)
- Change the kernel boot sequence after CentOS 7 kernel upgrade (Linux)
- Oracle 11g em start newspaper site's security certificate has a solution to the problem (Database)
- CV: Linux command displays the progress of the run command (Linux)
- First start with Kali Linux 2.0 (Linux)
- Installation Strongswan: on a Linux IPsec-based VPN tool (Linux)
- Multipath configuration under Linux (Linux)
- Apple Mac computer to install Windows 10 Concise Guide (Linux)
- Linux PXE unattended installation PXE-E32: TFTP OPen timeout the solution (Linux)
- Ubuntu install perfectly handsome terminal Guake 0.8.1 (Linux)
- Linux command execution judge sentences -;, &&, || (Linux)
- Teach you self-built Linux firewall free (Linux)
- To share some very useful Vim command (Linux)
- Linux account management add relevant directives (Linux)
- Using Maven to download Spring (Linux)
- CentOS 6.5 install VNC-Server (Linux)
     
           
     
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.