1. create an IPVs user, set its HOME directory to/usr/local/pgsqlgroupadd-g88postgresuseradd-u88-g88-d/usr/local/pgsql1_schmod755/usr/local/pgsqlpasswdpostgres ################# ############## 1. create a postgres user and set its HOME directory to/usr/local/pgsql
Groupadd-g 88 postgres
Useradd-u 88-g 88-d/usr/local/pgsql postgres
Chmod 755/usr/local/pgsql
Passwd IPVS
######################################## ##################
2. log in with the postgres user, upload the source code to its HOME directory, and then start compilation and installation:
Tar-xvf postgresql-9.3.4.tar.bz2
Cd postgresql-9.3.4
./Configure -- without-readline
Make & make install
######################################## ##################
3. initialize the database
Cd ~
Mkdir data
Chown-R postgres data
Su IPVs # use postgres users to initialize databases
Cd bin
./Initdb-D ../data-E UTF8
######################################## ##################
5. modify the configuration file
Cd ~
Vi. bash_profile
# Append the following six lines to the end of the file (first press the I key, then paste the following content, then press the insert key, and enter: wq)
Export PATH = "$ PATH":/usr/local/pgsql/bin
Export POSTGRES_HOME =/usr/local/pgsql
Export PGLIB = $ s_s_home/lib
Export PGDATA = $ s_s_home/data
Export MANPATH = "$ MANPATH": $ POSTGRES_HOME/man
Export LD_LIBRARY_PATH = "$ LD_LIBRARY_PATH": "$ PGLIB"
# Re-read
Source ~ /. Bash_profile
Verify
Echo $ s_s_home
######################################## ##################
6. open a remote client connection
Cd ~
Cd data
Vi postgresql. conf
Modify # listen_addresses = "localhost"
Changed to listen_addresses = "*"
Remove the comment (#) before port = 5432
Vi pg_hba.conf
Add the following in IPv4 local connections:
Host all 192.168.1.88/24 md5
######################################## ##################
7. start the database and set the super user's postgres and password
Cd ~
Cd bin
./Pg_ctl-D ../data-l logfile start
./Psql-d postgres
Alter user login S with password '123 ';
\ Q # log out of the PostgreSQL console
######################################## ##################
Note:
######################################## ##################
START database
Cd ~
Cd bin
./Pg_ctl-D ../data-l logfile start
Stop Database
Cd ~
Cd bin
./Pg_ctl stop-D ../data-w
If you cannot remotely connect to the database, disable the firewall with the root permission and try again (/etc/init. d/iptables stop)