Last active
November 11, 2016 22:58
-
-
Save ebarojas/e2ccd0da15c7b0d9a43c38f0a2a536ee to your computer and use it in GitHub Desktop.
Postgres Setup for Prescrypto installation, this is the old version that was replaced by a script.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get Postgres | |
sudo apt-get update | |
sudo apt-get install libpq-dev postgresql postgresql-contrib | |
Add postgres library to PATH (it's a good idea to put it in your .profile ) | |
PATH=$PATH:/usr/lib/postgresql/9.1/bin | |
export PATH | |
Set permissions for: /var/run/postgresql | |
sudo chown -R vagrant:vagrant /var/run/postgresql | |
# Initialize the database (first run only): | |
This create all the configuration files and directory postgres need to run. | |
pg_ctl -D /home/vagrant/postgres/database initdb | |
* Directory /home/vagrant/postgres/database must be empty! Once it's empty: | |
# Run postgres server automatically. | |
vagrant up --provision | |
or vagrant provision if you ran vagrant up and only want to run the provision bit | |
if you get a 'no such directory' error, run: | |
mkdir /home/vagrant/postgres/database/log | |
# Create Database (only the first time) | |
psql template1 | |
In psql terminal (template1=#) | |
CREATE DATABASE mydb; | |
# Runserver (once you finish everything, from the VM terminal under the project folder) | |
Apply migrations first: | |
python manage.py migrate | |
then: | |
python manage.py runserver [::]:8000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment