• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Gitlab installation
 

Gitlab installation

on

  • 2,259 views

 

Statistics

Views

Total Views
2,259
Views on SlideShare
2,259
Embed Views
0

Actions

Likes
1
Downloads
37
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Gitlab installation Gitlab installation Document Transcript

    • GitLab Installation with Git & Gitolite on CentOS – 6.3 Raiful Hasan DIVINE IT LIMITED
    • GitLab Installation on CentOS – 6.3Preperation:The main problem with installing GitLab on CentOS is that - other than Ubuntu or Fedora - itdoesnt have the ICU(lib) installed andthats why ruby crashes/doesnt run around.We will work as root most of the time, so make sure you have the permissions to do soFirst of all we need to add the epel repo to yum to get all the packages we want.1: rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpmThen we install all required packages:1: yum -y groupinstall Development Tools Additional Development2: yum -y install readline readline-devel ncurses-devel gdbm-devel glibc-devel tcl-devel openssl-devel curl-develexpat-devel db4-devel byacc gitolite sqlite-devel gcc-c++ libyaml libyaml-devel libffi libffi-devel libxml2 libxml2-devel libxslt libxslt-devel libicu libicu-devel system-config-firewall-tui python-devel redisUp next: Downloading and extracting ruby:1: curl -O http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz2: tar xzvf ruby-1.9.3-p0.tar.gz3: cd ruby-1.9.3-p01) Configure without binary suffix1: ./configure --enable-shared --disable-pthreadNow install ruby:1: make && make installDIVINE IT LIMITED Page 2
    • GitLab Installation on CentOS – 6.3Some may need to install qt-devel qtwebkit-devel by running (Replace the 64 in the path with32 if youre running on a 32 bit box)1: yum install qt-devel qtwebkit-devel2: export PATH=$PATH:/usr/lib64/qt4/binNow we have to install all the gems GitLab needs to run:1: gem update --system2: gem update3: gem install railsNow everything is set up and we can start to configure the environment for GitLab. First wecreate a user, that will run GitLab:1: adduser --shell /bin/bash --create-home --home-dir /home/gitlab gitlabBecause this user will be the Admin of the repos on the server, we need to have a RSA key pairto authenticate:1: su gitlab2: ssh-keygen -t rsa # as gitlab userNow switch back to root account. Because GitLab is only a graphical user interface to managerepos, we need a powerfull backend. gitolite will do this for us.We also need a user for gitolite.1: adduser --system --shell /bin/sh --comment gitolite --create-home --home-dir /home/git gitGitolite needs to know one key, that it knows as admin. We will pass the key of GitLab togitolite. To do so we first copy the private key of our gitlab user to the homedirectory of our gitolite user:1: # make sure you do this as root2: cp /home/gitlab/.ssh/id_rsa.pub /home/git/gitlab.pubDIVINE IT LIMITED Page 3
    • GitLab Installation on CentOS – 6.3Now we need to initialize gitolite:1: su git2: gl-setup ~/gitlab.pub # this passes the admin key to gitoliteWhen the prompt appears edit the provided file (its in a vi-Editor) and set $REPO_UMASK to0007Switch back to root user now.We now need to give our management software (GitLab) access to the repos:1: usermod -a -G git gitlab2: chmod -R g+rwX /home/git/repositories/3: chmod 770 /home/gitBecause the gitlab user will need a password later on, we configure it right now, so we arefinished with all the user stuff.1: passwd gitlab # please choose a good password :)As next step we need to introduce GitLab to gitolite (that is, we let them change their SSH-keys)1: su gitlab2: ssh git@localhostand back to the root user, so we dont need to care about permissions.GitLab needs a few gems, we havent installed yet:1: curl http://python-distribute.org/distribute_setup.py | python2: easy_install pip3: pip install pygments4: gem install bundlerAs mentioned before, the gitlab user will have to do a bit of administration stuff, so we need toDIVINE IT LIMITED Page 4
    • GitLab Installation on CentOS – 6.3give him sudo rights. To do so, we edit the sudoers file with visudo:1: visudoAdd gitlab ALL=(ALL) ALL after root ALL=(ALL) ALL so it looks like this:1: ...2: root ALL=(ALL) ALL3: gitlab ALL=(ALL) ALL4: ...Do not edit anything else!!!After another two gems we are finished with the gem stuff:1: gem install ruby-debug192: gem install charlock_holmesWe now switch to our gitlab user and we wont use our root account anymore:1: su gitlabGet the GitLab software:1: cd && git clone git://github.com/gitlabhq/gitlabhq.git2: cd gitlabhqWere nearly done. Next we bundle our application.1: bundle installGitLab will use a MySQL database (in our case), which we need to install and start:1: yum -y install mysql-server2: /etc/init.d/mysqld startDIVINE IT LIMITED Page 5
    • GitLab Installation on CentOS – 6.3To configure the MySQL server easily we use:1: mysql_secure_installationRemember the password type in for root!We now connect to our database server to create a user for GitLab:1: mysql -u root -p # when prompted enter the root password weve chosen in mysql_secure_installationWe now have a mysql shell. Mind the trailing ; !1: mysql> CREATE DATABASE gitlab CHARACTER SET UTF8;2: mysql> GRANT ALL PRIVILEGES ON gitlab.* TO gitlabusr@localhost IDENTIFIED BY supersecret WITH GRANTOPTION;3: mysql> quitRemember the password and username (here: gitlabusr and supersecret)!To create the database a script is deployed with GitLab. However it needs an additional serviceto run:1: sudo nohup redis-server > /dev/nullEnter the password created for the gitlab user and hit CTRL+Z. Then type1: bgThe service is now running in background.DIVINE IT LIMITED Page 6
    • GitLab Installation on CentOS – 6.3We now configure GitLab by copying the configurion files from example to real:1: cp ~/gitlabhq/config/database.yml.example ~/gitlabhq/config/database.yml2: cp ~/gitlabhq/config/gitlab.yml.example ~/gitlabhq/config/gitlab.ymlIn database.yml we have to edit the production settings of database (at the very top of the file).We have to change the database-name, username and password.We will now create the database structure:1: RAILS_ENV=production rake db:setup2: RAILS_ENV=production rake db:seed_fuTo start the server we use1: bundle exec rails s -e productionThats it. Were done. All have to do now, is set up firewall and navigate to http://ip-or-domain:3000/ and log in withuser: admin@local.hostpass: 5iveL!feDIVINE IT LIMITED Page 7