Official Installation Documentation Reference github.com
Blog Documentation Reference Install-gitlab
First, the installation environment
Base Operating System (CentOS 6.5 minimal)
Ruby (version: 2.0.0p353+)
Create a project run user (create Git account for easy rights Management)
Gitlab Shell (version: 1.8.1)
Database, with PostgreSQL (can support MySQL and PostgreSQL)
Gitlab (version: 6-3-stable)
Web server with Nginx (support for Nginx and Apache)
Firewall, open related ports (iptables)
Second, upgrade the update system
Yum Groupinstall "Development Tools"-y
Yum Update-y
Yum Install wget vim-y
Third, configure the installation source
1, download the Epel gpg KEY
Wget-o/etc/pki/rpm-gpg/rpm-gpg-key-epel-6 Https://www.fedoraproject.org/static/0608B895.txt
RPM--import/etc/pki/rpm-gpg/rpm-gpg-key-epel-6
Rpm-qa gpg*
2, Installation Epel-release-6-8.noarch package
RPM-UVH http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
3. Create Puias installation Source
Vim/etc/yum.repos.d/puias_6_computational.repo
======================
[Puias_6_computational]
Name=puias Computational Base $releasever-$basearch
mirrorlist=http://puias.math.ias.edu/data/puias/computational/$releasever/$basearch/mirrorlist
#baseurl =http://puias.math.ias.edu/data/puias/computational/$releasever/$basearch
Gpgcheck=1
Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-puias
=======================
4, download the Puias gpg key
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
5. Check if the installation is successful
Rpm-qa gpg*
Yum Repolist
Four, the installation Gitlab need to rely on the package
Yum-y Install vim-enhanced readline readline-devel ncurses-devel gdbm-devel glibc-devel tcl-devel openssl-devel Curl-dev El expat-devel db4-devel byacc sqlite-devel gcc-c++ libyaml libyaml-devel libffi libffi-devel libxml2 libxml2-devel libxsl T libxslt-devel libicu libicu-devel system-config-firewall-tui python-devel redis sudo wget crontabs logwatch logrotate pe Rl-time-hires git
V. Installation of the required services
1, Redis
Chkconfig Redis on
Service Redis Start
2, Ruby (remember to download well, tar a backup, download thief slow)
Curl--progress ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p353.tar.gz | Tar XZ
CD ruby-2.0.0-p353
./configure--prefix=/usr/local/
Make && make install
3, check Ruby is installed successfully, and configure $path
which Ruby
/usr/local/bin/ruby
Ruby-v
Ruby 2.0.0p353 (2013-11-22 revision 43784) [X86_64-linux]
4, Bundle
Gem Install bundler--no-ri--no-rdoc
Vi. Creating Git Users
Note: git@ #命令行表示是用git用户登录执行命令, all others are executed as root user
AddUser--system--shell/bin/bash--comment ' Gitlab '--create-home--home-dir/home/git/git
Seven, configure Gitlab Shell
Note: The Gitlab shell is a software developed specifically for Gitlab to provide SSH access and versioning
1, download Gitlab-shell
Su-git
git@# git clone https://github.com/gitlabhq/gitlab-shell.git
git@# CD Gitlab-shell
git@# git checkout v1.9.4
2, modify the configuration file
git@# CP Config.yml.example CONFIG.YML
# URL to Gitlab instance. Used for API calls. Should end with a slash.
Gitlab_url: "http://yourdomain:8080/"
Note: If Gitlab is accessed using HTTPS, replace HTTP with HTTPS, Self_signed_cert in the configuration file to be modified to true, or the Gitlab shell will have an error when communicating through the API and Gitlab. Error causing project push. Because SSL is used to configure the Web server later, it is configured in SSL.
3. Installation Gitlab-shell
git@#./bin/install
Viii. installation of the PostgreSQL database
1, yum installation PostgreSQL
Yum Install Postgresql-server postgresql-devel-y
Service PostgreSQL Initdb
Service PostgreSQL Start
Chkconfig PostgreSQL on
2. Create database and corresponding user
Su-postgres
Psql-d template1
template1=# CREATE USER git with PASSWORD ' PASSWORD ';
template1=# CREATE DATABASE gitlabhq_production OWNER git;
template1=# Q
Exit
Attachment: MySQL Installation method
Yum install-y mysql-server Mysql-devel
Chkconfig mysqld on
Service mysqld Start
/usr/bin/mysql_secure_installation
Mysql-u root-p
CREATE USER ' gitlab ' @ ' localhost ' identified by ' password ';
CREATE DATABASE IF not EXISTS ' gitlabhq_production ' DEFAULT CHARACTER SET ' UTF8 ' COLLATE ' utf8_unicode_ci ';
GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER on ' gitlabhq_production '. * to ' Gitlab ' @ loca Lhost ';
Ix. installation of Gitlab
1, download the project
Su-git
git@# git clone https://github.com/gitlabhq/gitlabhq.git Gitlab
git@# Cd/home/git/gitlab
git@# git checkout 6-3-stable
2, configure the project
git@# CP Config/gitlab.yml.example CONFIG/GITLAB.YML
git@# sed-i ' s|localhost|your_domain_name|g ' config/gitlab.yml
3, create the relevant directory, and configure owner permissions
git@# chown-r git log/
git@# chown-r git tmp/
git@# chmod-r u+rwx log/
git@# chmod-r u+rwx tmp/
git@# mkdir/home/git/gitlab-satellites
git@# mkdir Tmp/pids/tmp/sockets
git@# chmod-r u+rwx tmp/pids/
git@# chmod-r u+rwx tmp/sockets/
git@# mkdir Public/uploads
git@# chmod-r u+rwx public/uploads
git@# CP Config/unicorn.rb.example CONFIG/UNICORN.RB
4. Configure UNICORN.RB
git@# Vim CONFIG/UNICORN.RB
Listen "yourdomain:8080",: Tcp_nopush => True
5. Global Configuration
git@# git config--global user.name "Gitlab"
git@# git config--global user.email "Gitlab@your_domain_name"
git@# git config--global core.autocrlf input
6, modify the database configuration file
git@# CP Config/database.yml.postgresql CONFIG/DATABASE.YML
git@# Vim Config/database.yml
git@# chmod o-rwx config/database.yml
X. Installation of Gems
Gem install charlock_holmes--version ' 0.6.9.4 '
XI. Installation of PostgreSQL package
git@# cd/home/git/gitlab/
git@# Bundle Install--deployment--without development test MySQL
Note: MySQL Package installation method
git@# Bundle Install--deployment--without Development Test Postgres AWS (MySQL package)
12, initialization of data and activation of advanced features
git@# Cd/home/git/gitlab
git@# bundle EXEC Rake Gitlab:setup rails_env=production
Generate a default admin account
Admin@local.host
5ivel!fe
13. Install Gitlab startup script
1. Download startup script
Wget-o/etc/init.d/gitlab Https://raw.github.com/gitlabhq/gitlab-recipes/master/init/sysvinit/centos/gitlab-unicorn
chmod +x/etc/init.d/gitlab
Chkconfig--add Gitlab
Chkconfig Gitlab on
2, check the status
git@# CD gitlab/
git@# bundle EXEC Rake Gitlab:env:info rails_env=production
3, Start Gitlab
Service Gitlab Start
4. Check installation Information
git@# CD gitlab/
git@# bundle EXEC Rake Gitlab:check rails_env=production
14. Install Web Service (nginx)
1. Installation Nginx
Yum-y Install Nginx
Chkconfig Nginx on
Mkdir/etc/nginx/sites-available
Mkdir/etc/nginx/sites-enabled
Wget-o/etc/nginx/sites-available/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/master/web-server/nginx/ Gitlab-ssl
Ln-sf/etc/nginx/sites-available/gitlab/etc/nginx/sites-enabled/gitlab
2, modify the configuration file
Vim/etc/nginx/nginx.conf
include/etc/nginx/conf.d/*.conf;
To
include/etc/nginx/sites-enabled/*;
Vim/etc/nginx/sites-available/gitlab
server_name git.example.com;
To
server_name youdomain.com;
3. Add Nginx to git user group
Usermod-a-G git nginx
chmod g+rx/home/git/
4. Add SSL Certificate
Mkdir/etc/nginx/ssl
Cd/etc/nginx/ssl
OpenSSL req-new-x509-nodes-days 3560-out gitlab.crt-keyout Gitlab.key
5, start Nginx
Service Nginx Start
6, to see whether the listening port to start
Nestat-nap | grep nginx
XV. Open related ports and services
Lokkit-s http-s https-s SSH
Service Iptables Restart
16, System-related configuration
1, Host hosts configuration
Vim/etc/hosts
Yourip yourdomain
2. Close SELinux
Setenforce 0
Visit Gitlab Home http://yourdomain.com/
17, Mailbox Configuration
1, later configuration, to be continued ...
18. Gitlab Windows Client
1, Tortoisegit
2, Msysgit
Problem handling:
1, Detect api-access failure
Workaround:
View three profiles
Vim gitlab/config/unicorn.rb #配置ruby提供的服务端口, IP
Listen "gitlab.test.com:8080",: Tcp_nopush => True
Vim gitlab-shell/config.yml #配置gitlab-shell API interface to invoke
Gitlab_url: "http://gitlab.test.com:8080/"
Vim gitlab/config/gitlab.yml #配置gitlab服务的端口, IP
Host:gitlab.test.com
Port:80
2, start Nginx error
Service Nginx Start
Starting Nginx:nginx: [Emerg] unknown directive "ssl_stapling" in/etc/nginx/sites-enabled/gitlab:102
Workaround:
Vim/etc/nginx/sites-available/gitlab
Note the following lines
3, Login to open the first page display is not complete
Workaround:
Vim/etc/nginx/sites-available/gitlab
Note the following lines
/etc/init.d/nginx Restart #重启nginx
4, open the home page hint bad GATEWAY
Workaround:
Setenforce 0