Provisioning an ubuntu server for Django, Postgres, NGINX

February 27, 2017 | Posted in NGINX | Ajoy Oommen

  1. Install virtualenv

     sudo apt-get install python-pip
     sudo pip install virtualenv
    
  2. Install NGINX

     sudo apt-get install nginx
     sudo rm /etc/nginx/sites-available/default
     sudo rm /etc/nginx/sites-enabled/default
    
  3. Generate SSH public key

     ssh-keygen
     cat .ssh/id_rsa.pub
    

Install and configure PostgreSQL

  1. Install Postgres

     sudo apt-get install postgresql
    
  2. Change postgres auth to trust.

     sudo nano /etc/postgresql/9.5/main/pg_hba.conf
    

    Modify this line

     local   all             postgres                                peer
    

    to

     local   all             postgres                                trust
    

    Restart postgres

     sudo service postgresql restart
    
  3. Set password for user postgres

     psql -U postgres
     alter user postgres with password 's3cretPass';
     \q
    
  4. Change auth for postgres to md5

     sudo nano /etc/postgresql/9.5/main/pg_hba.conf
    

    Modify

     local   all             postgres                                trust
    

    to

     local   all             postgres                                md5
    
     sudo service postgresql restart
    

Configure extra packages

  1. Install libpq-dev (for psycopg2)

     sudo apt-get install libpq-dev
    
PostgreSQL Ubuntu AWS AWS EC2 NGINX Django

Related Posts

04 Feb 2020 » From WordPress and Django to Jekyll

24 Jan 2017 » Stats from NGINX logs using Goaccess

15 Jul 2016 » Using Signals in Django

11 Jul 2016 » Installing PostgreSQL

24 Mar 2016 » Configuring SSH servers on Ubuntu

01 Sep 2015 » Redirecting with NGINX

01 May 2015 » Supervisor in Elastic Beanstalk

21 Apr 2015 » Uploading a file to Django

20 Apr 2015 » Postgres backup and recovery

02 Apr 2015 » PostgreSQL module ltree