2012-12-05 11:53:24 -05:00
|
|
|
# Setup Database
|
2012-10-25 04:13:11 -04:00
|
|
|
|
2012-12-05 11:53:24 -05:00
|
|
|
GitLab supports the following databases:
|
|
|
|
|
|
|
|
* MySQL (preferred)
|
|
|
|
* PostgreSQL
|
2012-10-25 04:13:11 -04:00
|
|
|
|
|
|
|
|
|
|
|
## MySQL
|
|
|
|
|
2012-12-05 11:53:24 -05:00
|
|
|
# Install the database packages
|
2012-10-25 04:13:11 -04:00
|
|
|
sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev
|
|
|
|
|
|
|
|
# Login to MySQL
|
|
|
|
$ mysql -u root -p
|
|
|
|
|
2012-12-05 11:53:24 -05:00
|
|
|
# Create a user for GitLab. (change $password to a real password)
|
|
|
|
mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY '$password';
|
|
|
|
|
2012-10-25 04:13:11 -04:00
|
|
|
# Create the GitLab production database
|
|
|
|
mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
|
|
|
|
|
2012-12-05 11:53:24 -05:00
|
|
|
# Grant the GitLab user necessary permissopns on the table.
|
2012-10-25 04:13:11 -04:00
|
|
|
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost';
|
|
|
|
|
2012-12-05 11:53:24 -05:00
|
|
|
# Quit the database session
|
|
|
|
mysql> \q
|
|
|
|
|
|
|
|
# Try connecting to the new database with the new user
|
|
|
|
sudo -u gitlab -H mysql -u gitlab -p -D gitlabhq_production
|
2012-10-25 04:13:11 -04:00
|
|
|
|
|
|
|
## PostgreSQL
|
|
|
|
|
2012-12-05 11:53:24 -05:00
|
|
|
# Install the database packages
|
2012-12-05 12:18:09 -05:00
|
|
|
sudo apt-get install -y postgresql-9.1 libpq-dev
|
2012-10-25 04:13:11 -04:00
|
|
|
|
2012-12-05 11:53:24 -05:00
|
|
|
# Login to PostgreSQL
|
2012-10-25 04:13:11 -04:00
|
|
|
sudo -u postgres psql -d template1
|
|
|
|
|
2012-12-05 11:53:24 -05:00
|
|
|
# Create a user for GitLab. (change $password to a real password)
|
2012-10-25 04:13:11 -04:00
|
|
|
template1=# CREATE USER gitlab WITH PASSWORD '$password';
|
|
|
|
|
2012-10-30 07:58:10 -04:00
|
|
|
# Create the GitLab production database & grant all privileges on database
|
|
|
|
template1=# CREATE DATABASE gitlabhq_production OWNER gitlab;
|
2012-10-25 04:13:11 -04:00
|
|
|
|
2012-12-05 11:53:24 -05:00
|
|
|
# Quit the database session
|
2012-10-25 04:13:11 -04:00
|
|
|
template1=# \q
|
|
|
|
|
2012-12-05 11:53:24 -05:00
|
|
|
# Try connecting to the new database with the new user
|
|
|
|
sudo -u gitlab -H psql -d gitlabhq_production
|
2012-10-25 04:13:11 -04:00
|
|
|
|