Set up the database for source installation

GitLab can be installed using PostgreSQL or MySQL. In this recipe, I will use PostgreSQL as it is the recommended database engine.

How to do it…

The following steps are applicable for Debian-based systems; they are also possible with RedHat. You can take a look at gitlab.com for the installation instructions.

  1. Install PostgreSQL 9.1:
    sudo apt-get install -y postgresql-9.1 postgresql-client libpq-dev
    
  2. Create the PostgreSQL user for GitLab:
    sudo –u  postgresql psql –d template1 –c "CREATE USER git CREATEDB"
    
  3. Create the database for GitLab and grant all privileges on the database:
    sudo –u postgresql psql –d template1 –c "CREATE DATABASE gitlabhq_production OWNER git"
    

Get GitLab Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.