====== How To? - PostgreSQL in SeisComP3 ======
===== PostgreSQL Server =====
First of all you need a postgreSQL server running. If you don't know how to set up a postgreSQL server, please visit: [[PostgreSQL]]\\
Create a new user/password in your postgreSQL server for Seiscomp3 to use: sysop/sysop. You also need to create a new database: seiscomp3.\\
It's time to run the SQL script which creates the tables in Seiscomp3 database. You need to copy and execute in PgAdminIII the content of this file: [[ftp://trovador/tecnico/dbpgsql.sql|dbpgsql.sql]]\\
Your database is ready for Seiscomp3 now.\\
===== Seiscomp3 Installation =====
Download the latest **tar** file from here: [[http://www.seiscomp3.org/downloader|Seiscomp3]]\\
Before set up Seiscomp3, let's install some **libs**, do this:\\
$ sudo apt-get install libboost-regex1.40.0 libboost-filesystem1.40.0 libboost-iostreams1.40.0 libboost-program-options1.40.0 libboost-signals1.40.0 libboost-thread1.40.0 libboost-wave1.40.0 libboost-serialization1.40.0
$ sudo apt-get install libncurses5 libqt4-core libxml2 python-numeric python-numpy alsa-utils libqt4-gui
Now, you should untar in your home folder the seiscomp package that you have already downloaded:\\
$ tar -zxvf seiscomp3-potsdam-2010.181.01-ubuntu10.04-x86_64.tar.gz
Ok, you had already set up the environment for the installation. You should now follow the instructions provided by the SeisComP staff in: [[http://www.seiscomp3.org/wiki/doc/installation-and-configuration#Installationprocedure|Seiscomp Documentation]] -> Attention to the following:
When the message "Initialize MySQL database on localhost [yes]:" appears, choose **"no"** -> 'cause we have a PostgreSQL server running ;-)
Then you can continue following the Seiscomp3 installation guide until trunk configuration steps.
For the database type, choose **"postgresql"** and follow the guide till the following appears:
G) Edit global parameters
A) Add/Edit network
R) Remove network
P) Add/Edit configuration profile
W) Write configuration and quit
Q) Quit without writing configuration
Command? [A]:
Type 'w', write your configuration and don't start Seiscomp yet. You have to install the PostgreSQL driver and edit some configuration files before.
Get the **PostgreSQL driver** --> [[ftp://trovador/tecnico/dbpostgresql.so|dbpostgresql.so]] and place it in "yourhomefolder"/seiscomp3/trunk/share/plugins
Now go to "yourhomefolder"/seiscomp3/trunk/templates and edit **scglobal.tpl**, replacing its last line:
core.plugins = dbmysql --> core.plugins = **dbpostgresql**
You will do the same for **global.cfg** in "yourhomefolder"/seiscomp3/trunk/config. In this folder, you also need to edit **scmaster.cfg**, replacing the 2nd line:
plugins.dbPlugin.dbDriver = mysql --> plugins.dbPlugin.dbDriver = **postgresql**
That's it. You can finally start to add your stations. Seiscomp3 is ready to be started now and also is able to use your PostgreSQL Database. Enjoy! :-)