CentOS 6.5 Installation Gitlab Installation
1 , install the operating system
a , install wget ( the system version is 6.5 )
#yum-y Install wget
b , add Epel installation source
EPEL , extra Packages for Enterprise Linux, this software warehouse has a lot of very common software, and is specifically designed for Rhel, the Rhel standard yum Source is a good supplement, completely free to use, by the Fedora Project maintenance, So if you are using Rhel, or centos,scientific and other Rhel-system Linux, you can use Epel's Yum source with great ease.
Download and install 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
Installing the Epel-release-6-8.noarch Package
# RPM-UVH http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
C , add puias installation source
Puias Linux is the complete operating system for desktops and servers, which is created by compiling the source code package for red Hat Enterprise Linux. In addition to these upstream packages, the project also provides a number of other repositories: "Addons" contains additional packages that are not included in the usual Red Hat release, "Computational" for software specifically designed for scientific computing, " Unsupported "is a variety of test packages. The issue is maintained by the Institute of Advanced Studies at Princeton University in the United States.
Create the/etc/yum.repos.d/puias_6_computational.repo and add the following:
[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
Download and install GPG key
#wget-O/etc/pki/rpm-gpg/rpm-gpg-key-puiashttp://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 the installation is successful
# Rpm-qa gpg*
Tips : After installing Epel and puias two sources, the following can be detected:
#yum repolist
D , installing Gitlab's required dependencies and tools
# yum-y Groupinstall ' development Tools '
# yum-y Install vim-enhanced readline readline-devel ncurses-devel gdbm-devel glibc-devel tcl-devel openssl-devel curl-de Vel expat-devel db4-devel byacc sqlite-devel gcc-c++ libyaml libyaml-devel libffi libffi-devel libxml2 libxml2-devel Libxs Lt Libxslt-devel Libicu libicu-devel system-config-firewall-tui python-devel redis sudo wget crontabs logwatch logrotate p Erl-time-hires git
Rhel Tips
If some packages cannot be installed, for example: eg. Gdbm-devel, Libffi-devel Andlibicu-devel, then increase the RHEL6 installation source.
# Yum-config-manager--enable Rhel-6-server-optional-rpms
E, configure Redis (Redis installation See notes)
remark:
#tar ZXVF redis-3.0.0.tar.gz
#cd redis-3.0.0
#make && make install
Configure Redis to boot at boot time:
# sudo chkconfig redis on
# sudo service Redis start
F, configure mail server (do not set here)
2. Install Ruby
Download and compile:
# Mkdir/tmp/ruby && Cd/tmp/ruby
# 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
After the installation is complete, log in to the terminal to ensure that the $path is in effect and that the installation of Ruby is successful:
# which Ruby
/usr/local/bin/ruby
# cd/usr/local/bin/
# ruby-v
Ruby 2.0.0p353 (2013-11-22 revision 43784) [X86_64-linux]
Install Bundles:
# sudo gem install bundler--no-ri--no-rdoc
If prompted Sudo:gem:command NotFound, use the root account to log in to execute the command.
[email protected]]# geminstall bundler--no-ri--no-rdoc
ERROR: could not find a valid gem ' bundler ' (>=0), her E is why:unable to download data from https://rubygems.org/-errno::etimedout:connection timed Out-connect (2) (https:// rubygems.org/latest_specs.4.8.gz)
is because the domestic network causes rubygems.org to be stored on Amazon S3 the resource file intermittently failed to connect, with a domestic rubygems mirror (see HTTP// ruby.taobao.org/) Replace the official image by the following method:
[[email protected]]# gemsources--remove https://rubygems.org/
https:// rubygems.org/removed from sources
[[email protected]]# gemsources-a https://ruby.taobao.org/
https:// ruby.taobao.org/added to sources
[[email protected]]# gemsources-l
* * * * Current sources***
https:// ruby.taobao.org/
[[email protected]]# geminstall bundler--no-ri--no-rdoc
Fetching:bundler-1.7.6.gem ( 100%)
successfullyinstalled bundler-1.7.6
1 gem installed
3. System users
Create User git
#adduser--system--shell/bin/bash--comment ' GitLab '--create-home--home-dir/home/git/git
Because git users don't need to sign in, there's no need to set up a git password.
4. Configure Gitlab Shell
Gitlabshell is a software developed specifically for Gitlab that provides access to SSH and version management.
Use root to log in, then switch to git
# Su-git
Cloning Gitlab Shell
$ git clone https://github.com/gitlabhq/gitlab-shell.git
$ CD Gitlab-shell
Switch to 1.8.0 Version and edit configuration
$ git checkout v1.8.0
$ CP config.yml.example CONFIG.YML
The most important thing here is to change the Gitlab_url into a gitlab access domain name. Shaped like: http://test.gitlab.com/
I note: If Gitlab is using HTTPS access, you need to replace HTTP to HTTPS, the configuration file Self_signed_cert to be modified to true, otherwise gitlab shell in the API and Gitlab to communicate the error occurs, Cause a project push error. Because SSL is used to configure the Web server later, it is configured in the same way as SSL.
Tips: Also if the domain name used is a test domain name, do not forget to do domain mapping in the system's/etc/hosts.
Install some required directories and files
$./bin/install
5. Install the database
MSYQL is used here, (Cmake+mysql see Remarks)
remark:
CMake Installation
#tar ZXVF cmake-3.0.0.tar.gz
#cd cmake-3.0.0
#./configure--prefix=/usr/local/cmake
#make && make Install
Setting environment variables
#vi/etc/profile
Add the following
Path=/usr/local/cmake/bin: $PATH
wq!
To make the configuration effective:
#source/etc/profile
MySQL Installation
Groupadd MySQL
useradd-g MySQL mysql-s/bin/false
Mkdir-p/data/mysql
Chown-r Mysql:mysql/data/mysql
Mkdir-p/usr/local/mysql
Tar zxvf mysql-5.5.17.tar.gz
CD mysql-5.5.17
CMake. -dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/data/mysql-dsysconfdir=/etc
Make && make install
Cp-r/usr/local/mysql/support-files/my-large.cnf/etc/my.cnf
Sed-i ' 25a datadir =/data/mysql '/etc/my.cnf
cd/usr/local/mysql/
./scripts/mysql_install_db--user=mysql
Cp-r/usr/local/mysql/support-files/mysql.server/etc/rc.d/init.d/mysqld
Sed-i "46s#basedir= #basedir =/usr/local/mysql#g"/etc/rc.d/init.d/mysqld
Sed-i "47s#datadir= #datadir =/data/mysql#g"/etc/rc.d/init.d/mysqld
chmod 755/etc/init.d/mysqld
Chkconfig mysqld on
Echo-e "Export path=\ $PATH:/usr/local/mysql/bin" >>/etc/profile
Ln-s/usr/local/mysql/lib/mysql/usr/lib/mysql
Ln-s/usr/local/mysql/include/mysql/usr/include/mysql
Service mysqld Start
# chkconfig Mysqld on
# service Mysqld Start
to set the password for the MySQL root account:
# mysqladmin-u root password ' 123456 '
Create new users and databases for Gitlab use
# Log in to database
# mysql-u Root-p
# Enter root password
# Create a user with Gitlab
CREATE USER ' gitlab ' @ ' localhost ' identified by ' 123456 ';
# Create a database used by Gitlaba
CREATE DATABASE IF not EXISTS ' gitlabhq_production ' DEFAULT CHARACTER SET ' UTF8 ' COLLATE ' utf8_unicode_ci ';
# Give Gitlab user rights
GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER on ' gitlabhq_production '. * to ' gitlab ' @ ' Loca Lhost ';
# Log out of the database
\q
6, Installation Gitlab
Install Gitlab in Git's home directory:
#su-git
A. Clone gitlab and switch branches to 6-3-stable
# clone Gitlab
$ git clone https://github.com/gitlabhq/gitlabhq.git Gitlab
# Enter the Gitlab directory
$ cd/home/git/gitlab
# Switch to 6-3-stable branch
$ git checkout 6-3-stable
B. Configuration Items
Copying a configuration file
$ CP config/gitlab.yml.example CONFIG/GITLAB.YML
Modify the configuration file
$ Sed-i ' s|localhost|192.169.1.171|g ' config/gitlab.yml
Note: 192.168.1.171 is the machine I want to install
setting log and TMP directory owners and permissions
$ chown-r git log/
$ chown-r git tmp/
$ chmod-r u+rwx log/
$ chmod-r u+rwx tmp/
Create a gitlab-satellites directory
$ mkdir/home/git/gitlab-satellites
Create tmp/pids/and tmp/sockets/directories to ensure that Gitlab has the appropriate permissions
$ mkdir tmp/pids/
$ mkdir tmp/sockets/
$ chmod-r u+rwx tmp/pids/
$ chmod-r u+rwx tmp/sockets/
Create a public/uploads directory
$ mkdir Public/uploads
$ chmod-r u+rwx public/uploads
Replication Unicorn Configuration
$ CP config/unicorn.rb.example CONFIG/UNICORN.RB
Edit RESQUE.YML Configuration
$ vim Config/resque.yml
development:redis://192.168.1.171:6379
test:redis://192.168.1.171:6379
production:redis://192.168.1.171:6379
Configure users and messages for Git
$ git config--global user.name "GitLab"
$ git config--global user.email "[Email protected]" (fill in your real domain)
$ git config--global core.autocrlf input
C. Configure database Access files
$ CP Config/database.yml.mysql CONFIG/DATABASE.YML
Edit Config/database.yml, set the account password of the connection database, the author's configuration section is as follows:
# PRODUCTION
#
Production
Adapter:mysql2
Encoding:utf8
Reconnect:false
Database:gitlabhq_production
Pool:10
Username:gitlab
Password: "123456"
# Host:localhost
# Socket:/tmp/mysql.sock
Modify the username and password, where the password is the password for the Gitlab user created in the database step above.
Make sure that the file only has permission to read from the GIT account.
$ chmod o-rwx config/database.yml
D, install Gems
$ Su-
# gem install charlock_holmes--version ' 0.6.9.4 '
# exit
Installing the MySQL Package
$ su-git
$ cd/home/git/gitlab/
$ bundle Install--deployment--without Development Test Postgres Puma AWS
remark:
Go Could not find modernizr-2.6.2 in any of the sources solution:
[Email protected] gitlab]$ VI gemfile
SOURCE "https://rubygems.org" changed to Source "http://rubygems.org"
[[Email protected] gitlab]$ Bundle install--deployment--without development test Postgres
Fetching Source Indexfrom http://rubygems.org/
Fetchinghttps://github.com/gitlabhq/grit.git
Could not findmodernizr-2.6.2 in any of the sources
#出现错误: Could not find modernizr-2.6.2 in any of thesources
#解决办法:
[Email protected] gitlab]$ VI gemfile
114th line Gem "Modernizr", "2.6.2"
Change to read:
114th line Gem "Modernizr-rails", "2.7.1"
[Email protected] gitlab]$ VI gemfile.lock
Line No. 252 Modernizr (2.6.2)
Change to read:
Line No. 252 modernizr-rails (2.7.1)
Line No. 523 Modernizr (= 2.6.2)
Change to read:
Line No. 523 modernizr-rails (= 2.7.1)
#重新执行:
[Email protected] gitlab]$ Bundleinstall--deployment--without Development Test Postgres Puma AWS
E, initialize data and activate advanced features
$ cd/home/git/gitlab
$ bundle EXEC Rake Gitlab:setup rails_env=production
When this is done, a default administrator account will be born:
[Email protected]
5ivel!fe
F. Install the startup script
# Cd/home/git/gitlab
# CP Lib/support/init.d/gitlab/etc/init.d/
# chmod +x/etc/init.d/gitlab
Set Logarate
# Cd/home/git/gitlab
# CP Lib/support/logrotate/gitlab/etc/logrotate.d/gitlab
# chkconfig--add Gitlab
Start up at boot time
# Chkconfig Gitlab on
G. Detecting Application Status
$ su-git
$ CD gitlab/
$ bundle EXEC Rake Gitlab:env:info rails_env=production
$ exit
You can view versions and other information for systems, Ruby, Gitlab, and Gitlabshell.
Launch Gitlab Instance
$ service Gitlab Start
H, view the application for more detailed information
$ su-git
$ CD gitlab/
$ bundle EXEC Rake Gitlab:check rails_env=production
7. Install the Web server
The choice is Nginx,
$ Su-
# yum-y Install Nginx
# chkconfig Nginx on
# mkdir/etc/nginx/sites-available
# mkdir/etc/nginx/sites-enabled
#cd/home/git/gitlab# CP lib/support/nginx/gitlab/etc/nginx/sites-available/# ln-s/etc/nginx/sites-available/ Gitlab/etc/nginx/sites-enabled/gitlab
Modify a domain name
Vim/etc/nginx/sites-enabled/gitlab
server_name 192.168.1.171;
Modify Nginx configuration file where
# Load configfiles from THE/ETC/NGINX/CONF.D directory
# The Defaultserver is in conf.d/default.conf
# include/etc/nginx/conf.d/*.conf;
include/etc/nginx/sites-enabled/*;
}
Restart Service
/etc/init.d/nginx restart
8 Testing
Access:http://192.168.1.171/
This article is from the "My Accumulation" blog, please make sure to keep this source http://xiexinmiao.blog.51cto.com/1093543/1696758
CentOS 6.5 Installation Gitlab Installation