GitLab can be installed using PostgreSQL or MySQL. In this recipe, I will use PostgreSQL as it is the recommended database engine.
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.
Install PostgreSQL 9.1:
sudo apt-get install -y postgresql-9.1 postgresql-client libpq-dev
Create the PostgreSQL user for GitLab:
sudo –u postgresql psql –d template1 –c "CREATE USER git CREATEDB"
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"