PostgreSQL on Linux Server (RedHat/Fedora/CentOS)

 

Source Installing PostgreSQL on RedHat/Fedora/CentOS Linux

** Please Note: All steps are done as 'root'

First, make sure the following packages are installed.

yum install -y yum-fastestmirror bison-devel readline-devel zlib-devel openssl-devel wget
yum groupinstall -y 'Development Tools'

 

 Make a directory to contain the source files.  This directory may already exist.

mkdir -p /usr/local/src

 

Change into the source directory.

cd /usr/local/src

 

Download PostgreSQL 8.3.7 from postgresql.org.

wget http://wwwmaster.postgresql.org/redir/198/h/source/v8.3.7/postgresql-8.3... -O /usr/local/src/

 

 Extract the source code.

tar zxvf postgresql-8.3.7.tar.gz

 

Change into to postgres source directory

cd postgresql-8.3.7

 

Configure postgres with OpenSSL support

./configure --prefix=/usr/local/pgsql --with-openssl --with-pgport=5432

 

Run make.

make

 

Run make install.

make install

 

Change into the contrib directory to make additional items.

cd /usr/local/src/postgresql-8.3.7/contrib/

 

Run make all.

make all

 

Run make install.

make install

 

Copy the startup script to the proper location.

cp /usr/local/src/postgresql-8.3.7/contrib/start-scripts/linux /etc/init.d/postgresql

 

Make the startup script executable.

chmod 775 /etc/init.d/postgresql

 

Add a postgres user.

adduser postgres

 

Add the path information to the shell, so postgres commands can be more readily accessed.

echo 'PATH=$PATH:/usr/local/pgsql/bin' > /etc/profile.d/postgresql.sh
echo 'export PATH;' >> /etc/profile.d/postgresql.sh

 

Make it executable.

chmod 775 /etc/profile.d/postgresql.sh

 

Make a logging directory.

mkdir -p /var/log/pgsql

 

Make a file to log to.

touch /var/log/pgsql/pgsql.log

 

Make sure postgres can read/write to it.

chown -R postgres:postgres /var/log/pgsql/

 

Make a data directory, this can be named anything, but 'data' is most common.  This is your postgres database cluster.

mkdir /usr/local/pgsql/data

 

Change ownership of the data directory to postgres.

chown -R postgres:postgres /usr/local/pgsql/data

 

Execute the initdb script.  This prepares the cluster for use.

sudo -u postgres /usr/local/pgsql/bin/initdb -U postgres -E=UTF8 /usr/local/pgsql/data

 

Modify your /usr/local/pgsql/data/postgresql.conf to allow you installation to listen for remote connections.
Change the listen_addresses and port parameters to:
Remove the leading '#' marks also.

listen_addresses = '*'
port = 5432

 

Add postgres to the startup routine.

chkconfig --add postgresql

 

Start postgres.

service postgresql start

 

Load some additional functions into template1 of the postgres install.

/usr/local/pgsql/bin/psql -U postgres -p 5432 template1 < /usr/local/pgsql/share/contrib/adminpack.sql
/usr/local/pgsql/bin/psql -U postgres -p 5432 template1 < /usr/local/pgsql/share/contrib/pgcrypto.sql
/usr/local/pgsql/bin/psql -U postgres -p 5432 template1 < /usr/local/pgsql/share/contrib/pgstattuple.sql
/usr/local/pgsql/bin/psql -U postgres -p 5432 template1 < /usr/local/pgsql/share/contrib/sslinfo.sql

DONE.

 

 

 

 
gherzog's picture
Offline
Joined: 05/06/2009
Ubuntu Linux, Windows,and Postgres

Firstly, I found that trying to first use the Postgres as provided in Ubuntu Linux's Synaptic Package Manager created conflicts with later using XTuple-3.2.2-linux-installer.bin. In theory, items can be installed piecemeal, but I can't quite figure out how.

Installing via the Windows installer is much easier as Windows does require less expertise to install. Windows is also less rigorous about network security and that makes installation easier. I did have to provide Postgres Ports in the Windows Firewall.

I had to remove all of the original Ubuntu installation [which isn't hard] to start afresh with the installer from XTuple or I ended up with two installations of Postgres using different Port #s. A Good search of how to install .bin Linux files was quite helpful. One merely has to 'chmod +x filename.bin' and then 'sudo ./filename.bin' to get your binary installer saying 'Hello' to you.

Having gotten the Demo, Empty, and Quickstart databases working in Localhost on an XP machine, a Vista machine, and a Ubuntu Linux 64bit machine, I am still not 100% operational. I've explored dozens of permutations in the *.conf files, but nothing is quite there yet. The PostgreSQL manual is helpful, but at 2000 pages it is quite a tome.

Status report.

1. I cannot seem to Backup and Restore databases, even in Localhost.
2. Though I am on a firewalled LAN, I cannot quite figure out how to use my XP computer as the Postgres Server and my Ubuntu Linux or Vista as the XTuple client.
3. PG Admin III doesn't seem to show up with the XTuple installation in my Ubuntu Linux menus. It may be available, but I've not located it as of yet.

Localhost mode works fine on all three machines, but the idea here is to have a 'proof of concept' that I can eventually have a PostBooks Linux Server being used by several Window clients in a small office. Optionally, a Windows Server and several Windows Clients may be fine, though I personally trust Linux to be a more reliable server.

PostBooks is idea for small Taiwanese trading companies and I am trying to demonstrate this to a friend/client. Currently, they are evaluting the Demo database. But without proven Backup, Restore, and full LAN; they won't go forward.