<commit_before># Ripple Gateway Installation Instructions

The following instructions are for a clean build of OSX 10.9.4. If you have any problems please create an issue.

All of these commands assume your are in the base of the cloned project directory (e.g. ~/gatewayd).

## Install

### [Xcode](https://developer.apple.com/xcode/downloads/)

### Install gatewayd's dependencies using NPM:

    sudo npm install -g git
    sudo npm install -g pm2 --unsafe-perm
    sudo npm install --global pg grunt grunt-cli forever db-migrate jshint
    npm install --save

### Configure [Postgres](https://help.ubuntu.com/community/PostgreSQL)

Open postgres and take note of the role name with the 'Superuser' attribute:

    psql
    \dg
    \q

For consistency, let's call the Superuser role 'superuser' in the next couple of steps.

Create the postgres user for gatewayd:

    sudo psql -U superuser -c "create user gatewayd_user with password 'password'"

Create the database and grant the created user as owner:

    sudo psql -U superuser -c "create database gatewayd_db with owner gatewayd_user encoding='utf8'"

### Add the created postgres credentials to config/config.js.

    ...
    {
      'DATABASE_URL': 'postgres://gatewayd_user:password@localhost:5432/gatewayd_db'
    }
    ...

### Copy lib/data/database.example.json to lib/data/database.json and put your database configuration there. ( your DATABASE_URL )

    ...
    'development': {
      'ENV': 'postgres://gatewayd_user:password@localhost:5432/gatewayd_db'
    }
    ...

### Use Grunt to configure the postgres database

    grunt migrate

## Running gatewayd

The executable is located at bin/gateway:

    bin/gateway start

## Configure gatewayd

Once gatewayd is installed, [configure your gateway](./setup.md) wallets and server

### [Postgres basics](http://jazstudios.blogspot.com/2010/06/postgresql-login-commands.html)

<commit_msg>[DOC] Add step to create postgres role<commit_after># Ripple Gateway Installation Instructions

The following instructions are for a clean build of OSX 10.9.4. If you have any problems please create an issue.

All of these commands assume your are in the base of the cloned project directory (e.g. ~/gatewayd).

## Install

### [Xcode](https://developer.apple.com/xcode/downloads/)

### Install gatewayd's dependencies using NPM:

    sudo npm install -g git
    sudo npm install -g pm2 --unsafe-perm
    sudo npm install --global pg grunt grunt-cli forever db-migrate jshint
    npm install --save

### Configure [Postgres](https://help.ubuntu.com/community/PostgreSQL)

Create the postgres user for gatewayd:

    sudo psql -U postgres -c "create user gatewayd_user with password 'password'"

If the "postgres" role doesn't exist, you can create one:

    psql
    CREATE USER postgres;

Create the database and grant the created user as owner:

    sudo psql -U postgres -c "create database gatewayd_db with owner gatewayd_user encoding='utf8'"

### Add the created postgres credentials to config/config.json.

    ...
    {
      'DATABASE_URL': 'postgres://gatewayd_user:password@localhost:5432/gatewayd_db'
    }
    ...

### Copy lib/data/database.example.json to lib/data/database.json and put your database configuration there. ( your DATABASE_URL )

    ...
    'development': {
      'ENV': 'postgres://gatewayd_user:password@localhost:5432/gatewayd_db'
    }
    ...

### Use Grunt to configure the postgres database

    grunt migrate

## Running gatewayd

The executable is located at bin/gateway:

    bin/gateway start

## Configure gatewayd

Once gatewayd is installed, [configure your gateway](./setup.md) wallets and server

### [Postgres basics](http://jazstudios.blogspot.com/2010/06/postgresql-login-commands.html)


{'fraction_non_alphanumeric': 0.09818569903948772, 'fraction_numerical': 0.010672358591248666, 'mean_word_length': 3.566382460414129, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1409123', 'n_tokens_mistral': 1209, 'n_tokens_neox': 1102, 'n_words': 392}