Installation Environment:
Operating system: Ubuntu 12.4 LTS English
Database: PostgreSQL
Webserver:nginx
When it comes to 7.x, Gitlab's documentation is quite intact! This article is used as a translation and part of the FAQ.
1. Install the dependency pack (1) Set the default text editor
Use VIM as the default text editor
sudo apt-get install-y vimsudo update-alternatives--set editor/usr/bin/vim.basic
(2) Installation dependency
sudo apt-get install-y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev Libreadline-dev Libncurses5-dev Lib Ffi-dev Curl Openssh-server redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev logrotate Python-docutils Pkg-config CMake
(3) Install Git
sudo apt-get install-y git-core
Attention:
In the 12.4 version number, the default git version number is 1.7.9.5
So, we're going to install git manually.
I. Removing GIT with a version number on the system
sudo apt-get remove Git-core
Ii. installing a git-dependent package
sudo apt-get install-y libcurl4-openssl-dev libexpat1-dev gettext libz-dev libssl-dev build-essential
III. Download and install
We can use the browser to see the version number of git below Https://www.kernel.org/pub/software/scm/git, select the latest download.
Cd/tmpcurl-l--progress https://www.kernel.org/pub/software/scm/git/git-2.1.2.tar.gz | Tar xzcd git-2.1.2/make prefix=/usr/local All
Installation Location:/usr/local/(the installation position of the active installation is:/usr/bin/)
sudo make prefix=/usr/local install
The document specifically mentions that when we configure GITLAB.YML, we must change the git path problem!
Install the email tool
sudo apt-get install-y postfix
2. Install Ruby (1) Remove V1.8
sudo apt-get remove ruby1.8
(2) Download and install
Mkdir/tmp/ruby && cd/tmp/rubycurl-l--progress ftp://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz | Tar xzcd ruby-2.1.2./configure--disable-install-rdocmakesudo make install
(3) Install Gem
sudo gem install bundler--no-ri--no-rdoc
3. Add Gitlab Users
sudo adduser--disabled-login--gecos ' GitLab ' git
This user is dedicated to Gitlab, with no other action.
4. Setting up the database (1) Installing PostgreSQL
sudo apt-get install-y PostgreSQL postgresql-client Libpq-dev
(2) Build libraries and add users
Sudo-u postgres psql-d template1template1=# create USER git createdb;template1=# create DATABASE gitlabhq_production OWN ER git;template1=# \q
(3) test user
Sudo-u git-h psql-d gitlabhq_production
5. Installing Redis
sudo apt-get install Redis-serversudo cp/etc/redis/redis.conf/etc/redis/redis.conf.origsed ' s/^port. */port 0/'/etc/ Redis/redis.conf.orig | sudo tee/etc/redis/redis.confecho ' unixsocket/var/run/redis/redis.sock ' | sudo tee-a/etc/redis/redis.confsudo service redis-server restartsudo usermod-ag redis git
6. Configure Gitlab to enter the Git user root folder
Cd/home/git
(1) Synchronization
Sudo-u git-h git clone https://gitlab.com/gitlab-org/gitlab-ce.git-b 7-3-stable Gitlab
(2) Configure him
I. File operations
Cd/home/git/gitlabsudo-u git-h cp config/gitlab.yml.example config/gitlab.ymlsudo chown-r git log/sudo chown-r git TM P/sudo chmod-r u+rwx log/sudo chmod-r u+rwx tmp/sudo-u git-h mkdir/home/git/gitlab-satellitessudo chmod u+rwx,g=rx,o- Rwx/home/git/gitlab-satellitessudo chmod-r u+rwx tmp/pids/sudo chmod-r u+rwx tmp/sockets/sudo chmod-r U+rwX public /uploadssudo-u git-h CP config/unicorn.rb.example config/unicorn.rbsudo-u git-h CP config/initializers/rack_attack.rb . Example Config/initializers/rack_attack.rbsudo-u git-h CP config/resque.yml.example CONFIG/RESQUE.YML
II. Configure the Git path
Sudo-u git-h Editor Config/gitlab.yml
III. Configuring Gitlab Global Variables
Sudo-u git-h git config--global user.name "GitLab" sudo-u git-h git config--global user.email "[email protected]" sudo -u git-h git config--global core.autocrlf input
(3) Configuring the database used by the Gitlab
We take PostgreSQL for example;
Sudo-u git cp config/database.yml.postgresql config/database.yml
Change Database.yml file
Sudo-u git-h Editor Config/database.yml
Remove the user from the production section and the "#" in front of the passwor.
Only git users can use the Database.yml file
Sudo-u git-h chmod o-rwx config/database.yml
(4) Installation Gems
We take PostgreSQL for example;
Sudo-u git-h Bundle Install--deployment--without development test MySQL AWS
Note: Because of the domestic network control problem, we need to constantly retry! Error message that appears-ignore it, and then try again (run the above command again).
(5) Installing the 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
(6) Initializing the database
Sudo-u git-h bundle exec Rake Gitlab:setup rails_env=production
(7) Boot up
sudo cp lib/support/init.d/gitlab/etc/init.d/gitlabsudo CP lib/support/init.d/gitlab.default.example/etc/default/ Gitlabsudo UPDATE-RC.D Gitlab Defaults 21
(8) Setting logrotate
sudo cp Lib/support/logrotate/gitlab/etc/logrotate.d/gitlab
(9) Checking application status
Sudo-u git-h bundle exec Rake Gitlab:env:info rails_env=production
(10) Compiling assets
Sudo-u git-h bundle exec Rake assets:precompile rails_env=production
(11) Start Gitlab
sudo service Gitlab start
7. Configure Nginx (1) to install Nginx
sudo apt-get install-y nginx
(2) Configure site
I. Copying template files to Nginx
sudo cp lib/support/nginx/gitlab/etc/nginx/sites-available/gitlabsudo ln-s/etc/nginx/sites-available/gitlab/etc/ Nginx/sites-enabled/gitlab
II. Replace "Your_server_fqdn"
sudo editor/etc/nginx/sites-available/gitlab
Internal network: localhost
(3) test and restart Nginx
sudo nginx-tsudo service nginx restart
8. Finished (1) test the application status again
Sudo-u git-h bundle exec Rake Gitlab:check rails_env=production
(2) initial user and password
root5iveL!fe
FAQ:
1.502 Questions
Because of the use of the old version of Git, such as V1.7.9.5, so in the "Install gems" step, download the old version number of rate, such as V10.1.0;
This article "Ubuntu 1204 Assembly GitLab appeared 502", overcomes this problem.
sudo gem install rake-v ' 10.3.2 '--source http://rubygems.orgsudo-u git-h bundle exec Rake assets:precompile rails_env= Production
Installing gitlab7.x on Ubuntu 12.04