Database server setup

Server hardware setup

This is based on the use of an EeePC netbook with no CD. It should be connected to the internet via an ethernet cable (wireless can be set up but it is too much bother and not practical for a server).

Install the operating system

  1. Download Ubuntu 12.04 Server edition iso
  2. Download unetbootin for use on a windows machine
  3. Create a boot USB stick with the Ubuntu image
  4. Set the netbook's Bios to boot from the USB stick
  5. Boot and install

Software configuration

  1. Install OpenSSH so you can configure it via SSH over the network
# sudo apt-get install openssh-server

If you are connected to the LAN, you should now be able to continue configuration from a second machine over SSH. To check the IP address on the netbook

# ifconfig

Then on your main machine, use PuTTY to access the netbook at the specified address.

  1. Install Postgresql 9.1

It should be 9.2 but it is not easily available in apt, and postgis isn't available. To avoid compiling, we'll stick with 9.1

# sudo apt-get install postgresql
# sudo apt-get install postgis

Continue configuration of SMS tools as indicated in SMS server setup guide.

Configure and restore the database

Download the database from the AWS server

  1. change to the postgres user
# sudo su postgres
  1. export the entire database cluster
# pg_dumpall > /tmp/db_all_20130407.sql
  1. compress it
# gzip /tmp/db_all_20130407.sql
  1. Use your local SFTP client to download the export file.
  2. Uncompress it
# gunzip db_all_20130407.sql.gz

Set up the local database and install the backup file

# sudo su postgres
# psql postgres < db_all_20130407.sql
# exit

Set up database access

Edit pg_hba.conf

# sudo nano /etc/postgresql/9.1/main/pg_hba.conf

Add these lines

host     all             angus           192.168.0.0/16          md5
local    isikhnas        smsd                                    peer

Edit postgresql.conf

# sudo nano /etc/postgresql/9.1/main/postgresql.conf

Change the line to

Listen = '*'

Reload the configuration

#  sudo service postgresql restart