SlideShare uma empresa Scribd logo
1 de 7
Baixar para ler offline
Installing Gitlab with Gitolite and Git on CentOS




                   Md. Raiful Hasan

                   DIVINE IT LIMITED




                             www.divine-it.net | DIVINE IT LIMITED   1
Requirements: CentOS 6.3 Minimal

Updating and adding basic software and services
Add EPEL repository

  rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm



Install the required tools for gitlab and
  yum -y groupinstall 'Development Tools' 'Additional Development'

  gitoliteyum -y install readline readline-devel ncurses-devel gdbm-devel glibc-devel tcl-devel openssl-devel
  curl-devel expat-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 redis



Downloading and extracting ruby:

  curl -O http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p320.tar.gz

  tar xzvf ruby-1.9.2-p320.tar.gz

  cd ruby-1.9.2-p320



Now here are two choices.

                           1. For Single ruby user.
                           2. For Multiple ruby versions user.

1 . Configure without binary suffix

 ./configure --enable-shared --disable-pthread



2 . Configure with binary suffix (for parallel installation of ruby versions)

  ./configure --enable-shared --disable-pthread --program-suffix _n


When choosing this option, the binary ruby will be named ruby_n and gem gem_n. Also we will have to
use rake_n.




                                                               www.divine-it.net | DIVINE IT LIMITED          2
Now install ruby:
  make && make install



Replace the 64 in the path with 32 if you're running on a 32 bit box

  yum install qt-devel qtwebkit-devel

  export PATH=$PATH:/usr/lib64/qt4/bin




Now we have to install all the gems GitLab needs to run:

  gem update --system

  gem update

  gem install rails




Now everything is set up and we can start to configure the environment for GitLab. First we create a
user that will run GitLab:

  adduser --shell /bin/bash --create-home --home-dir /home/gitlab gitlab



Because this user will be the Admin of the repos on the server, we need to have a RSA key pair to
authenticate:

  su - gitlab -c "ssh-keygen -t rsa"



Now switch back to root account. Because GitLab is only a graphical user interface to manage repos, we
need a power full backend. gitolite will do this for us.
We also need a user for gitolite.

  adduser --system --shell /bin/sh --comment 'gitolite' --create-home --home-dir /home/git git




                                                            www.divine-it.net | DIVINE IT LIMITED   3
Gitolite needs to know one key that it knows as admin. We will pass the key of GitLab to gitolite. To do
so we first copy the private key of our gitlab user to the home
directory of our gitolite user:

 # make sure do this as root


  cp /home/gitlab/.ssh/id_rsa.pub /home/git/gitlab.pub



Now we need to initialize gitolite:

  su git

  gl-setup ~/gitlab.pub # this passes the admin key to gitolite




Switch back to root user now.

We now need to give our management software (GitLab) access to the repos:

  usermod -a -G git gitlab

  chmod -R g+rwX /home/git/repositories/

  chmod 770 /home/git




Because the gitlab user will need a password later on, we configure it right now, so we are finished with
all the user stuff.

  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)

  su gitlab

  ssh root@localhost



... And back to the root user.


                                                              www.divine-it.net | DIVINE IT LIMITED   4
GitLab needs a few gems, we haven't installed yet:
As mentioned before, the gitlab user will have to do a bit of administration stuff, so we need to give him
sudo rights. To do so, we edit the sudoers file with visudo:

  visudo




Add gitlab ALL=(ALL) ALL after root ALL=(ALL) ALL so it looks like this:


  ...

  root ALL=(ALL) ALL

  gitlab ALL=(ALL) ALL

  ...




After another two gems we are finished with the gem stuff:

  gem install ruby-debug19

  gem install charlock_holmes




We now switch to our gitlab user and we won't use our root account anymore:


  su gitlab


Get the GitLab software:

  cd && git clone git://github.com/gitlabhq/gitlabhq.git

  cd gitlabhq




We're nearly done. Next we bundle our application.
  bundle install



                                                           www.divine-it.net | DIVINE IT LIMITED   5
GitLab will use a MySQL database (in our case), which we need to install and start:
  yum -y install mysql-server

  /etc/init.d/mysqld start




To configure the MySQL server easily we use:

  mysql_secure_installation




Remember the password you type in for root!

We now connect to our database server to create a user for GitLab:

  mysql -u root -p




We now have a mysql shell.

 mysql> CREATE DATABASE gitlab CHARACTER SET UTF8;

 mysql> GRANT ALL PRIVILEGES ON gitlab.* TO 'gitlabusr'@'localhost' IDENTIFIED BY 'password' WITH GRANT
 OPTION;

 mysql> quit


Remember the password and username (here: gitlabusr and password)!

To create the database a script is deployed with GitLab. However it needs an additional service to run:

  sudo nohup redis-server > /dev/null




Enter the password you created for the gitlab user and hit CTRL+Z. Then type
  bg

The service is now running in background.




                                                        www.divine-it.net | DIVINE IT LIMITED     6
We now configure GitLab by copying the configurion files from example to real:

  cp ~/gitlabhq/config/database.yml.mysql ~/gitlabhq/config/database.yml

  cp ~/gitlabhq/config/gitlab.yml.example ~/gitlabhq/config/gitlab.yml




In database.yml you have to edit the production settings of your database (at the very top of the file).
You have to change the database-name, username and password.

We will now create the database structure:

 RAILS_ENV=production rake db:setup

 RAILS_ENV=production rake db:seed_fu




To start the server we use

  bundle exec rails s -e production



We're done. All us have to do now, is set up firewall and navigate to http://ip-or-domain:3000/ and log
in with

user: admin@local.host
pass: 5iveL!fe




                                                           www.divine-it.net | DIVINE IT LIMITED   7

Mais conteúdo relacionado

Mais procurados

Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615
Brian K. Vagnini
 
Set up Hadoop Cluster on Amazon EC2
Set up Hadoop Cluster on Amazon EC2Set up Hadoop Cluster on Amazon EC2
Set up Hadoop Cluster on Amazon EC2
IMC Institute
 

Mais procurados (20)

Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615
 
Dev ninja -> vagrant + virtualbox + chef-solo + git + ec2
Dev ninja  -> vagrant + virtualbox + chef-solo + git + ec2Dev ninja  -> vagrant + virtualbox + chef-solo + git + ec2
Dev ninja -> vagrant + virtualbox + chef-solo + git + ec2
 
Docker use dockerfile
Docker use dockerfileDocker use dockerfile
Docker use dockerfile
 
Helm @ Orchestructure
Helm @ OrchestructureHelm @ Orchestructure
Helm @ Orchestructure
 
Set up Hadoop Cluster on Amazon EC2
Set up Hadoop Cluster on Amazon EC2Set up Hadoop Cluster on Amazon EC2
Set up Hadoop Cluster on Amazon EC2
 
Intro to Git for Drupal 7
Intro to Git for Drupal 7Intro to Git for Drupal 7
Intro to Git for Drupal 7
 
docker build with Ansible
docker build with Ansibledocker build with Ansible
docker build with Ansible
 
Exploring the Future of Helm
Exploring the Future of HelmExploring the Future of Helm
Exploring the Future of Helm
 
Docker
DockerDocker
Docker
 
Cookbook testing with KitcenCI and Serverrspec
Cookbook testing with KitcenCI and ServerrspecCookbook testing with KitcenCI and Serverrspec
Cookbook testing with KitcenCI and Serverrspec
 
Into to Docker (Central PA Java User Group - 8/14/2017)
Into to Docker (Central PA Java User Group - 8/14/2017)Into to Docker (Central PA Java User Group - 8/14/2017)
Into to Docker (Central PA Java User Group - 8/14/2017)
 
Infrastructure = Code
Infrastructure = CodeInfrastructure = Code
Infrastructure = Code
 
Boulder dev ops-meetup-11-2012-rundeck
Boulder dev ops-meetup-11-2012-rundeckBoulder dev ops-meetup-11-2012-rundeck
Boulder dev ops-meetup-11-2012-rundeck
 
Python virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesPython virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutes
 
Undoing Things in Git
Undoing Things in GitUndoing Things in Git
Undoing Things in Git
 
Ansible, best practices
Ansible, best practicesAnsible, best practices
Ansible, best practices
 
SkySQL & MariaDB What's all the buzz?
SkySQL & MariaDB What's all the buzz?SkySQL & MariaDB What's all the buzz?
SkySQL & MariaDB What's all the buzz?
 
Introduction to bower
Introduction to bowerIntroduction to bower
Introduction to bower
 
Apache Hadoop & Hive installation with movie rating exercise
Apache Hadoop & Hive installation with movie rating exerciseApache Hadoop & Hive installation with movie rating exercise
Apache Hadoop & Hive installation with movie rating exercise
 
Ansible best practices
Ansible best practicesAnsible best practices
Ansible best practices
 

Destaque

Basics About Git & GitHub
Basics About Git & GitHubBasics About Git & GitHub
Basics About Git & GitHub
Raiful Hasan
 
Introduction to Gitlab
Introduction to GitlabIntroduction to Gitlab
Introduction to Gitlab
Julien Pivotto
 

Destaque (14)

Nway-Project, Git, github & opensource
Nway-Project, Git, github & opensourceNway-Project, Git, github & opensource
Nway-Project, Git, github & opensource
 
Basics About Git & GitHub
Basics About Git & GitHubBasics About Git & GitHub
Basics About Git & GitHub
 
Git Rápido e Fácil
Git Rápido e FácilGit Rápido e Fácil
Git Rápido e Fácil
 
git 101
git 101git 101
git 101
 
Introdução ao Git
Introdução ao Git   Introdução ao Git
Introdução ao Git
 
Git para iniciantes v1.3.0 @ PHP Conference Brasil 2012
Git para iniciantes v1.3.0 @ PHP Conference Brasil 2012Git para iniciantes v1.3.0 @ PHP Conference Brasil 2012
Git para iniciantes v1.3.0 @ PHP Conference Brasil 2012
 
Fluxo de desenvolvimento de software utilizando Git
Fluxo de desenvolvimento de software utilizando GitFluxo de desenvolvimento de software utilizando Git
Fluxo de desenvolvimento de software utilizando Git
 
GIT Introduction
GIT IntroductionGIT Introduction
GIT Introduction
 
Controle de versão utilizando git
Controle de versão utilizando gitControle de versão utilizando git
Controle de versão utilizando git
 
Gitlab flow
Gitlab flowGitlab flow
Gitlab flow
 
Gitlab flow solo
Gitlab flow soloGitlab flow solo
Gitlab flow solo
 
Up GitLab Presentation 2015
Up GitLab Presentation 2015Up GitLab Presentation 2015
Up GitLab Presentation 2015
 
Introduction to Gitlab
Introduction to GitlabIntroduction to Gitlab
Introduction to Gitlab
 
Aprendendo Git
Aprendendo GitAprendendo Git
Aprendendo Git
 

Semelhante a Git lab installation guide

Semelhante a Git lab installation guide (20)

How To Install GitLab As Your Private GitHub Clone
How To Install GitLab As Your Private GitHub CloneHow To Install GitLab As Your Private GitHub Clone
How To Install GitLab As Your Private GitHub Clone
 
GIT in a nutshell
GIT in a nutshellGIT in a nutshell
GIT in a nutshell
 
FOSDEM 2017: GitLab CI
FOSDEM 2017:  GitLab CIFOSDEM 2017:  GitLab CI
FOSDEM 2017: GitLab CI
 
Gitlab Training with GIT and SourceTree
Gitlab Training with GIT and SourceTreeGitlab Training with GIT and SourceTree
Gitlab Training with GIT and SourceTree
 
5 Things I Wish I Knew About Gitlab CI
5 Things I Wish I Knew About Gitlab CI5 Things I Wish I Knew About Gitlab CI
5 Things I Wish I Knew About Gitlab CI
 
Matt Gauger - Git & Github web414 December 2010
Matt Gauger - Git & Github web414 December 2010Matt Gauger - Git & Github web414 December 2010
Matt Gauger - Git & Github web414 December 2010
 
The Secrets of The FullStack Ninja - Part A - Session I
The Secrets of The FullStack Ninja - Part A - Session IThe Secrets of The FullStack Ninja - Part A - Session I
The Secrets of The FullStack Ninja - Part A - Session I
 
Git for a newbie
Git for a newbieGit for a newbie
Git for a newbie
 
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHPHands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
 
Git github
Git githubGit github
Git github
 
Gitlab ci, cncf.sk
Gitlab ci, cncf.skGitlab ci, cncf.sk
Gitlab ci, cncf.sk
 
Gitlab and Lingvokot
Gitlab and LingvokotGitlab and Lingvokot
Gitlab and Lingvokot
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
 
Docker at Digital Ocean
Docker at Digital OceanDocker at Digital Ocean
Docker at Digital Ocean
 
Git hooks
Git hooksGit hooks
Git hooks
 
Git intro hands on windows with msysgit
Git intro hands on windows with msysgitGit intro hands on windows with msysgit
Git intro hands on windows with msysgit
 
Introduction to git and Github
Introduction to git and GithubIntroduction to git and Github
Introduction to git and Github
 
Os dev tool box
Os dev tool boxOs dev tool box
Os dev tool box
 
Basic Rails Training
Basic Rails TrainingBasic Rails Training
Basic Rails Training
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 

Git lab installation guide

  • 1. Installing Gitlab with Gitolite and Git on CentOS Md. Raiful Hasan DIVINE IT LIMITED www.divine-it.net | DIVINE IT LIMITED 1
  • 2. Requirements: CentOS 6.3 Minimal Updating and adding basic software and services Add EPEL repository rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm Install the required tools for gitlab and yum -y groupinstall 'Development Tools' 'Additional Development' gitoliteyum -y install readline readline-devel ncurses-devel gdbm-devel glibc-devel tcl-devel openssl-devel curl-devel expat-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 redis Downloading and extracting ruby: curl -O http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p320.tar.gz tar xzvf ruby-1.9.2-p320.tar.gz cd ruby-1.9.2-p320 Now here are two choices. 1. For Single ruby user. 2. For Multiple ruby versions user. 1 . Configure without binary suffix ./configure --enable-shared --disable-pthread 2 . Configure with binary suffix (for parallel installation of ruby versions) ./configure --enable-shared --disable-pthread --program-suffix _n When choosing this option, the binary ruby will be named ruby_n and gem gem_n. Also we will have to use rake_n. www.divine-it.net | DIVINE IT LIMITED 2
  • 3. Now install ruby: make && make install Replace the 64 in the path with 32 if you're running on a 32 bit box yum install qt-devel qtwebkit-devel export PATH=$PATH:/usr/lib64/qt4/bin Now we have to install all the gems GitLab needs to run: gem update --system gem update gem install rails Now everything is set up and we can start to configure the environment for GitLab. First we create a user that will run GitLab: adduser --shell /bin/bash --create-home --home-dir /home/gitlab gitlab Because this user will be the Admin of the repos on the server, we need to have a RSA key pair to authenticate: su - gitlab -c "ssh-keygen -t rsa" Now switch back to root account. Because GitLab is only a graphical user interface to manage repos, we need a power full backend. gitolite will do this for us. We also need a user for gitolite. adduser --system --shell /bin/sh --comment 'gitolite' --create-home --home-dir /home/git git www.divine-it.net | DIVINE IT LIMITED 3
  • 4. Gitolite needs to know one key that it knows as admin. We will pass the key of GitLab to gitolite. To do so we first copy the private key of our gitlab user to the home directory of our gitolite user: # make sure do this as root cp /home/gitlab/.ssh/id_rsa.pub /home/git/gitlab.pub Now we need to initialize gitolite: su git gl-setup ~/gitlab.pub # this passes the admin key to gitolite Switch back to root user now. We now need to give our management software (GitLab) access to the repos: usermod -a -G git gitlab chmod -R g+rwX /home/git/repositories/ chmod 770 /home/git Because the gitlab user will need a password later on, we configure it right now, so we are finished with all the user stuff. 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) su gitlab ssh root@localhost ... And back to the root user. www.divine-it.net | DIVINE IT LIMITED 4
  • 5. GitLab needs a few gems, we haven't installed yet: As mentioned before, the gitlab user will have to do a bit of administration stuff, so we need to give him sudo rights. To do so, we edit the sudoers file with visudo: visudo Add gitlab ALL=(ALL) ALL after root ALL=(ALL) ALL so it looks like this: ... root ALL=(ALL) ALL gitlab ALL=(ALL) ALL ... After another two gems we are finished with the gem stuff: gem install ruby-debug19 gem install charlock_holmes We now switch to our gitlab user and we won't use our root account anymore: su gitlab Get the GitLab software: cd && git clone git://github.com/gitlabhq/gitlabhq.git cd gitlabhq We're nearly done. Next we bundle our application. bundle install www.divine-it.net | DIVINE IT LIMITED 5
  • 6. GitLab will use a MySQL database (in our case), which we need to install and start: yum -y install mysql-server /etc/init.d/mysqld start To configure the MySQL server easily we use: mysql_secure_installation Remember the password you type in for root! We now connect to our database server to create a user for GitLab: mysql -u root -p We now have a mysql shell. mysql> CREATE DATABASE gitlab CHARACTER SET UTF8; mysql> GRANT ALL PRIVILEGES ON gitlab.* TO 'gitlabusr'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION; mysql> quit Remember the password and username (here: gitlabusr and password)! To create the database a script is deployed with GitLab. However it needs an additional service to run: sudo nohup redis-server > /dev/null Enter the password you created for the gitlab user and hit CTRL+Z. Then type bg The service is now running in background. www.divine-it.net | DIVINE IT LIMITED 6
  • 7. We now configure GitLab by copying the configurion files from example to real: cp ~/gitlabhq/config/database.yml.mysql ~/gitlabhq/config/database.yml cp ~/gitlabhq/config/gitlab.yml.example ~/gitlabhq/config/gitlab.yml In database.yml you have to edit the production settings of your database (at the very top of the file). You have to change the database-name, username and password. We will now create the database structure: RAILS_ENV=production rake db:setup RAILS_ENV=production rake db:seed_fu To start the server we use bundle exec rails s -e production We're done. All us have to do now, is set up firewall and navigate to http://ip-or-domain:3000/ and log in with user: admin@local.host pass: 5iveL!fe www.divine-it.net | DIVINE IT LIMITED 7