Install Postgresql 9.3 on centos 6.5

I used to have Mysql installed on my webserver, however recently I came across some examples where the worst side of mysql was shown. And I was convinced I should be using postgresql instead.

Therefor underneath you’ll find a short guide on howto install postgresql.

 wget http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm
rpm -ivh pgdg-centos93-9.3-1.noarch.rpm
chkconfig postgresql-9.3 --levels 2345 on
service postgresql-9.3 initdb
service postgresql-9.3 start

Spotweb on Centos 6.5

Disclaimer: This is not my product, nor do I maintain it. I merely had some struggles getting this to work for testing purposes and setup a simple guide for future reference.

Spotweb is a web utility which indexes various posts on usenet.

Prerequisites:
– Make sure your /var (or wheve-ever your www folder is located has at least 15GB)
– Have apache2, php5 and mysql 5 installed (standard repo is good): This guide will not handle the installation of a webserver with php and mysql.
– Your server / vm should have 2 cores and at least 1GB of RAM

Step 1: Installing software + deploying spotweb

yum install git
cd /var/www/html/ -your own folder-
git clone https://github.com/spotweb/spotweb.git
cd spotweb/
mkdir cache
chmod 777 cache/

Step 2: Installing spotweb
Navigate in your browser to either localhost or . For example: http://10.0.0.143/install.php
Check if everything is OK.
The following two items may be NOT OK:
– PostgresqlDB
– Own settings file

If everything is oke, click next.

Step 3: Setting the db settings
In this screen leave everything as is, except for the password. Change it to something you seem fit.
Click next

Step 4: Configuring usenet provider & admin user
In this screen fill in your own usenet provider
Hint: I prefer to use custom (at the bottom) and port 119. SSL seems to have troubles with retrieving from time to time.

In the next screen you can create your own admin user.
Admin /admin/ administrator etc are forbidden.
Just choose your own nickname and strong password!
Fill in the rest of the details (I wouldnt recommend using your real name and email).

Press next for the last step in the web install phase.

Step 5: Creating db file
Go back to the command line

vim dbsettings.inc.php
copy / paste the settings as shown into this file and save it.

Don’t forget to check if the url works! 🙂

Step 6: Install.php
To make sure nobody can ruin your installation or hijack it we’re going to move the install.php
Either remove it, or move it to your home directory

mv install.php /home/<username>spotweb
OR
rm -f install.php

Step 7: Backing up the folder in tar.gz for future use

cd .. (make sure u are one level above the spotweb folder)
tar -cvf spotweb.tar.gz spotweb/
mv spotweb.tar.gz /home/<user>/spotweb/

Step 8: Creating a database for spotweb

mysql -u root -p
CREATE DATABASE spotweb;
CREATE USER 'spotweb'@'localhost' IDENTIFIED BY '<your own password>';
GRANT ALL PRIVILEGES ON spotweb.* TO spotweb @'localhost' IDENTIFIED BY '<your own password>';
quit;

Step 9: Making a cronjob for retrieving the spots

crontab -e */30 * * * * cd /path/to/spotweb && /usr/bin/php retrieve.php > /dev/null
service crond restart
crontab -l Now this rule should be shown:
crontab -e */30 * * * * cd /path/to/spotweb && /usr/bin/php retrieve.php > /dev/null

Step 10: Login to spotweb
Use the credentials u choose during installation.
In the top right corner press config > settings > retrieve
Check with your usenet provider how much retention you have and fill in the correct number.

I am still toying around with the other settings. Check back later to see what I used.

Tips and tricks:
– Git pull can be used inside the spotweb directory to update to a newer version (backup before you do!)
– php upgrade-db.php can be used to check the database when applying a newer version of spotweb.