1. download the latest version of postgresql: http://www.postgresql.org/ftp/source/
2. decompress the file:
Tar zxvf postgresql-8.3.7.tar.gz
CD postgresql-8.3.7
3. Configuration:
./Configure -- prefix =/usr/local/pgsql
4. Compile:
Make
5. installation:
Make install
6. create user groups and users:
Groupadd Postgres
Useradd-G Postgres
7. Create a database file storage directory and grant permissions to ipvs:
Mkdir/usr/local/pgsql/Data
CD/usr/local/pgsql
Chown Postgres. Postgres data
8. initialize the database directory:
Switch user
Su-PostgreSQL
Initialize data
/Usr/local/pgsql/bin/initdb-D/usr/local/pgsql/Data
Start Database
/Usr/local/pgsql/bin/postmaster-D/usr/local/pgsql/Data
9. Configure the listening address and port:
VI/usr/local/pgsql/data/PostgreSQL. conf
Uncomment the following two rows
Listen_addresses = '*'
Port = 5432
10. Allow remote connection:
VI/usr/local/pgsql/data/pg_assist.conf
Add
Host All all 192.168.1.0/24 Trust
The specific meaning of each item is described in the configuration file.
Configure iptables for remote host access:
VI/etc/sysconfig
Add
-A RH-Firewall-1-INPUT-M state -- state new-m tcp-p tcp -- dport 5432-J accept
Service iptables restart
11. Enable the PostgreSQL database to start with the system startup:
Copy the startup script to the/etc/init. d/directory and execute the following command:
CD/etc/rc. d/init. d
CP (First Step unzipping the installation file directory)/postgresql-8.3.7/contrib/start-scripts/Linux PostgreSQL
Chmod + x PostgreSQL
VI PostgreSQL
Prefix =/usr/local/pgsql
Pgdata = "/usr/local/pgsql/Data"
Pguser = Postgres
Pglog = "/var/log/pgsql. log"
Chkconfig -- add PostgreSQL
Start the database:
Service PostgreSQL start