Commit d68c771a authored by Achilleas Pipinellis's avatar Achilleas Pipinellis

Merge branch 'doc-installation-pg_trgm' into 'master'

Add clear instructions on installing the pg_trgm extension

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/17191

See merge request !4025
parents a0ea38c3 473e653e
......@@ -157,22 +157,64 @@ Create a `git` user for GitLab:
## 5. Database
We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](database_mysql.md). *Note*: because we need to make use of extensions you need at least pgsql 9.1.
We recommend using a PostgreSQL database. For MySQL check the
[MySQL setup guide](database_mysql.md).
# Install the database packages
sudo apt-get install -y postgresql postgresql-client libpq-dev
> **Note**: because we need to make use of extensions you need at least pgsql 9.1.
# Create a user for GitLab
1. Install the database packages:
```bash
sudo apt-get install -y postgresql postgresql-client libpq-dev postgresql-contrib
```
1. Create a database user for GitLab:
```bash
sudo -u postgres psql -d template1 -c "CREATE USER git CREATEDB;"
```
1. Create the GitLab production database and grant all privileges on database:
# Create the GitLab production database & grant all privileges on database
```bash
sudo -u postgres psql -d template1 -c "CREATE DATABASE gitlabhq_production OWNER git;"
```
1. Create the `pg_trgm` extension (required for GitLab 8.6+):
```bash
sudo -u postgres psql -d template1 -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;"
```
1. Try connecting to the new database with the new user:
# Try connecting to the new database with the new user
```bash
sudo -u git -H psql -d gitlabhq_production
```
1. Check if the `pg_trgm` extension is enabled:
```bash
SELECT true AS enabled
FROM pg_available_extensions
WHERE name = 'pg_trgm'
AND installed_version IS NOT NULL;
```
If the extension is enabled this will produce the following output:
# Quit the database session
```
enabled
---------
t
(1 row)
```
1. Quit the database session:
```bash
gitlabhq_production> \q
```
## 6. Redis
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment