CentOS-6.6-x86_64-minimal.iso environment
Install LNMP (Nginx, MySQL, redis, and PHP are required). For more information, see lnmp one-key installation package.
Add an epel repository
Cat>/etc/yum. repos. d/epel. repo <EOF
[Epel]
Name = Extra Packages for Enterprise Linux 6-\ $ basearch
# Baseurl = http://download.fedoraproject.org/pub/epel/6/\$basearch
Using list = https://mirrors.fedoraproject.org/metalink? Repo = epel-6 & arch =\$ basearch
Failovermethod = priority
Enabled = 1
Gpgcheck = 0
EOF
Add PUIAS Computational reference (the built-in git version is 1.7 incompatible with gitlab)
Cat>/etc/yum. repos. d/PUIAS_6_computational.repo <EOF
[PUIAS_6_computational]
Name = PUIAS computational Base \ $ releasever-$ basearch
Pipeline list = pipeline
# Baseurl = http://puias.math.ias.edu/data/puias/computational/?#releasever/##basearch
Enabled = 1
Gpgcheck = 0
EOF
Install dependency packages
Yum-y install vim-enhanced readline-devel ncurses-devel \
Gdbm-devel glibc-devel tcl-devel openssl-devel curl-devel expat-devel \
Db4-devel byacc sqlite-devel gcc-c ++ libyaml-devel libffi \
Libffi-devel libxml2 libxml2-devel libxslt-devel libicu-devel \
System-config-firewall-tui python-devel crontabs logwatch \
Logrotate perl-Time-HiRes git
Ruby installation
Cd lnmp/src
Wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.5.tar.gz
Tar xzf ruby-2.1.5.tar.gz
Cd ruby-2.1.5
./Configure -- prefix =/usr/local/ruby
Make & make install
Cd ..
Add to environment variable
Vi/etc/profile
Export PATH =/usr/local/ruby/bin: $ PATH
./Etc/profile
Install Bundler Gem
Gem install bundler -- no-ri -- no-rdoc
Create a git User for GitLab
Adduser -- system -- shell/bin/bash -- comment 'gitlab '-- create-home -- home-dir/home/git
Su-git
GitLab shell installation
Git clone https://github.com/gitlabhq/gitlab-shell.git
Cd gitlab-shell
Git checkout v1.8.0
Cp config. yml. example config. yml
Sed-I's @ http: // localhost/@ http://git.linuxeye.com/@'config. yml
Sed-I's @/usr/bin/redis-cli @/usr/local/redis/bin/redis-cli @ 'config. yml
./Bin/install
Database/MySQL
$ Mysql-uroot-p
Mysql> create database gitlabhq_production;
Mysql> quit;
Redis. sock path specified
Su-
Service redis-server stop
Mkdir/var/run/redis; chown-R redis. redis/var/run/redis
Vi/usr/local/redis/etc/redis. conf
Unixsocket/var/run/redis. sock
Service redis-server start
Ls-l/var/run/redis. sock
GitLab
Su-git
Wget https://github.com/gitlabhq/gitlabhq/archive/v7.4.5.tar.gz
Tar xzvf v7.4.5.tar.gz
Music gitlabhq-7.4.5 gitlab
Cd gitlab
Cp config/gitlab. yml. example config/gitlab. yml
Sed-I's @ localhost@git.linuxeye.com @ G' config/gitlab. yml
Chown-R git log/
Chown-R git tmp/
Chmod-R u + rwX log/
Chmod-R u + rwX tmp/
Mkdir/home/git/gitlab-satellites
Mkdir tmp/pids/
Mkdir tmp/sockets/
Chmod-R u + rwX tmp/pids/
Chmod-R u + rwX tmp/sockets/
Mkdir public/uploads
Chmod-R u + rwX public/uploads
Cp config/unicorn. rb. example config/unicorn. rb
Git config -- global user. name "GitLab"
Git config-global user. email "gitlab@linuxeye.com"
Git config -- global core. autocrlf input
Cp config/resque. yml. example config/resque. yml
GitLab Database configuration
Cp config/database. yml {. mysql ,}
Cat config/database. yml
Production:
Adapter: mysql2
Encoding: utf8
Collation: utf8_general_ci
Reconnect: false
Database: gitlabhq_production
Pool: 10
Username: root
Password: "password"
# Host: localhost
# Socket:/tmp/mysql. sock
Chmod o-rwx config/database. yml
Gems installation
Su-
Gem install charlock_holmes -- version '0. 6.9.4'
Exit
Cd/home/git/gitlab/
Bundle install -- deployment -- without development test Uma S puma aws postgres
GitLab shell installation
Bundle exec rake gitlab: shell: install [v2.1.0] REDIS_URL = unix:/var/run/redis. sock RAILS_ENV = production
Vi/home/git/gitlab-shell/config. yml
Modify the correct path, for example, redis-cli. Change the path to "/usr/local/bin/redis-cli"
Restorecon-Rv/home/git/. ssh
Initialize the database and activate advanced functions
Git init
Bundle exec rake gitlab: setup RAILS_ENV = production # yes
Login ...... root
Password... 5 iveL! Fe
GitLab initialization script
Su-
Https://raw.github.com/gitlabhq/gitlab-recipes/master/init/sysvinit/centos/gitlab-unicorn wget-O/etc/init. d/gitlab
Chmod + x/etc/init. d/gitlab
Chkconfig -- add gitlab
Chkconfig gitlab on
Exit # switch back to git User
Check application status
Cd/home/git/gitlab/
Bundle exec rake gitlab: env: info RAILS_ENV = production
Compile assets
Bundle exec rake assets: precompile RAILS_ENV = production
Start GitLab
Su-
Service gitlab start
Nginx configuration
Usermod-a-G git www
Chmod 770/home/git
Mkdir/usr/local/nginx/conf/vhost
Cd/usr/local/nginx/conf/vhost
Wget-O git.linuxeye.com. conf https://gitlab.com/gitlab-org/gitlab-ce/raw/master/lib/support/nginx/gitlab-ssl
Vi git.linuxeye.com. conf # Modify the configuration item
Root/home/git/gitlab/public;
Server_name
Access_log
Error_log
Ssl_certificate gitlab. crt;
Ssl_certificate_key gitlab. key;
Ps: the certificate generation method is as follows (it is recommended to use a third-party signature to enable the browser to identify the generated public key in the formal environment ):
Cd/usr/local/nginx/conf
Openssl genrsa-out gitlab. key 2048
Openssl req-new-x509-days 36500-key gitlab. key-out gitlab. crt-subj "/C = CN/ST = Shanghai/L = Shanghai/O = LinuxEye Ltd. /OU = LinuxEye"
Restart nginx
Service nginx restart