Database server setup
Daftar isi
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
- Download Ubuntu 12.04 Server edition iso
- Download unetbootin for use on a windows machine
- Create a boot USB stick with the Ubuntu image
- Set the netbook's Bios to boot from the USB stick
- Boot and install
Software configuration
- 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.
- 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
- change to the postgres user
# sudo su postgres
- export the entire database cluster
# pg_dumpall > /tmp/db_all_20130407.sql
- compress it
# gzip /tmp/db_all_20130407.sql
- Use your local SFTP client to download the export file.
- 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