<commit_before># Preliminaries for Ubuntu 16.04

Installation for other distros may be slightly different. This assumes nodejs 8 and npm are already installed. All of this is done in the lamassu-server directory.

## Packages

```
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib postgresql-server-dev-9.5 libpq-dev git
```

## Set up PostgreSQL

```
sudo -u postgres createdb lamassu
sudo -u postgres psql postgres
```

In ``psql``, run the following and set password to ``<PASSWORD>``:

```
\password postgres
ctrl-d
```

# Preliminaries for MacOS

## Postgres

Use Postgres.app: https://postgresapp.com/

**psql** is automatically installed. You won't need to set up users.

## NodeJS

```
curl -L https://git.io/n-install | bash -s -- -y lts
. ~/.bash_profile
```

# Installation

## Install node modules

Make sure you're running the LTS version of NodeJS. Ignore any warnings.

```
npm install
```

## Generate certificates

```
bash bin/cert-gen.sh
```

Note: This will create a ``.lamassu`` directory in your home directory.

## Set up database

Important: lamassu-migrate currently gripes about a QueryResultError. Ignore this, it works anyway. Also, ignore Debug lines from lamassu-apply-defaults.

```
node bin/lamassu-migrate
node bin/lamassu-apply-defaults
```

## Register admin user
<commit_msg>Update INSTALL.md (#158)<commit_after># Preliminaries for Ubuntu 16.04

Installation for other distros may be slightly different. This assumes NodeJS 8.3 or higher and npm 5.6 are already installed. All of this is done in the lamassu-server directory.

## Packages

```
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib postgresql-server-dev-9.5 libpq-dev git
```

## Set up PostgreSQL

```
sudo -u postgres createdb lamassu
sudo -u postgres psql postgres
```

In ``psql``, run the following and set password to ``<PASSWORD>``:

```
\password postgres
ctrl-d
```

# Preliminaries for MacOS

## Postgres

Use Postgres.app: https://postgresapp.com/

**psql** is automatically installed. You won't need to set up users.

## NodeJS

```
curl -L https://git.io/n-install | bash -s -- -y lts
. ~/.bash_profile
```

# Installation

## Install node modules

Make sure you're running NodeJS 8.3 or higher. Ignore any warnings.

```
npm install
```

## Generate certificates

```
bash bin/cert-gen.sh
```

Notes: 
  - This will create a ``.lamassu`` directory in your home directory.
  - The script uses the current openssl LTS version (1.0.2g) and will not work on v1.1.
  
## Set up database

Important: lamassu-migrate currently gripes about a QueryResultError. Ignore this, it works anyway. Also, ignore Debug lines from lamassu-apply-defaults.

```
node bin/lamassu-migrate
node bin/lamassu-apply-defaults
```

## Register admin user

{'fraction_non_alphanumeric': 0.11322789360172537, 'fraction_numerical': 0.009705248023005032, 'mean_word_length': 3.9256637168141593, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4167672', 'n_tokens_mistral': 976, 'n_tokens_neox': 893, 'n_words': 333}