Install GitLab on Ubuntu12.04

Source: Internet
Author: User
We need a set of tools that can host git on our own, similar to GitHub, but require hosts to be on our own server. After reading the GitEnterprise version, the annual authorization fee for 20 people is USD 5000, it's too expensive. I can only look for similar open-source tools. I used Redmine + Git and Trac + Git/Subversion to manage lab projects, which is a bit tricky, I heard from a friend that GitLab is very useful and based on Rails & amp; Gi

We need a set of tools that can host git on our own, similar to GitHub, but require hosts to be on our own server. Let's take a look at the Git Enterprise version. The annual authorization fee for 20 people is USD 5000, it's too expensive. I can only look for similar open-source tools. I used Redmine + Git and Trac + Git/Subversion to manage lab projects, which is a bit tricky, I heard from a friend that GitLab is quite useful, based on Rails & Gitolite, and community active each month, it has release, which is easier to install than Gitorious. I tried it in the afternoon. It feels pretty good. An important feature is to support LDAP authentication, which can be easily connected to our LDAP server, in this way, you do not need to create additional users in GitLab to use GitLab. The official GitLab installation documentation is very detailed. You can complete the installation by following the steps.

Install GitLab

After installing curl, download and install the GitLab automatic installation script debian_Ubuntu.sh:

$ sudo apt-get install curl$ sudo curl https://raw.github.com/gitlabhq/gitlab-recipes/master/install/debian_ubuntu.sh | sh

The above installation script only completes part of the work. Next, install some libraries and packages, download the gitlab source code, and copy the configuration file:

$ Sudo gem install charlock_holmes -- version '0. 6.8 '$ sudo pip install pygments $ sudo gem install bundler $ cd/home/gitlab # download gitlab source code $ sudo-H-u gitlab git clone-B stable https://github.com/gitlabhq/gitlabhq.git gitlab $ cd gitlab # copy the configuration file $ sudo-u gitlab cp config/gitlab. yml. example config/gitlab. yml

Install the Database Engine (optional SQLite, MySQL, Postgres), copy the corresponding configuration file according to the corresponding database engine (here select SQLite), follow the corresponding gem, and finally install the database table:

$ sudo apt-get install -y sqlite3 libsqlite3-dev$ sudo -u gitlab cp config/database.yml.sqlite config/database.yml$ sudo -u gitlab -H bundle install --without development test mysql postgres  --deployment$ sudo -u gitlab bundle exec rake gitlab:app:setup RAILS_ENV=production

Configure gitlab hooks:

$ sudo cp ./lib/hooks/post-receive /home/git/.gitolite/hooks/common/post-receive$ sudo chown git:git /home/git/.gitolite/hooks/common/post-receive

Test the program status and check whether all the configuration files are available:

$ sudo -u gitlab bundle exec rake gitlab:app:status RAILS_ENV=production

Run gitlab and resque:

$ sudo -u gitlab bundle exec rails s -e production$ sudo -u gitlab bundle exec rake environment resque:work QUEUE=* RAILS_ENV=production BACKGROUND=yes

Download the gitlab STARTUP script and set it to Automatic startup:

$ sudo wget https://raw.github.com/gitlabhq/gitlab-recipes/master/init.d/gitlab -P /etc/init.d/$ sudo chmod +x /etc/init.d/gitlab$ sudo update-rc.d gitlab defaults 21

Now you can start, disable, and restart the gitlab service through/etc/init. d/gitlab:

$ sudo /etc/init.d/gitlab restart
Configure LDAP support (optional)

If you need to configure LDAP authentication login, modify the 2. Auth settings section of the gitlab. yml file:

$ sudo vi config/gitlab.yml## 2. Auth settings# ==========================ldap:  enabled: true  host: 'ldap.vpsee.com'  base: 'dc=vpsee,dc=com'  port: 636  uid: 'uid'  method: 'ssl' # plain  bind_dn: 'cn=admin,dc=vpsee,dc=com'  password: 'password'
Install and configure Nginx + Unicorn

GitLab can run independently with the server that comes with Rails, but in the production environment we choose to use Nginx + Unicorn:

# Configure Unicorn $ cd/home/gitlab $ sudo-u gitlab cp config/unicorn. rb. example config/unicorn. rb $ sudo-u gitlab bundle exec unicorn_rails-c config/unicorn. rb-E production-D # install nginx $ sudo apt-get install nginx # Add nginx configuration file for gitlab $ sudo wget https://raw.github.com/gitlabhq/gitlab-recipes/master/nginx/gitlab-P/etc/nginx/sites-available/$ sudo ln-s/etc/nginx/sites-available/gitlab/etc/nginx/sites-enabled/gitlab # modify ** YOUR_SERVER_IP ** and ** YOUR_SERVER_FQDN ** $ sudo vi/ etc/nginx/sites-enabled/gitlab # restart nginx $ sudo/etc/init. d/nginx restart
Test

Open your browser to access this machine domain name or IP address, the default user name is admin@local.host password is 5 iveL! Fe. The following page is displayed after login:

GitLab details: Click here
GitLab's: Click here

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.