- Download source files from here
- Upload files to the CentOS server
- Prepare the necessary files
- #yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
- #tar -zxf postgresql-8.2.23.tar.gz
- #cd postgresql*
- #./configure --prefix=/usr/local/pgsql --without-readline
- #make && make install
- Setting PostgreSQL config process
- create user: #adduser postgres
- create password: #passwd postgres
- Authorized folder/files:
- #mkdir /usr/local/pgsql/data
- #chown -R postgres /usr/local/pgsql
- login as postgres: su postgres
- initial dataset: /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
- edit config
- #vi /usr/local/pgsql/data/postgresql.conf
- find listen_addresses = ‘localhost’ to listen_addresses = '*'
- #vi /usr/local/pgsql/data/pg_hba.conf
- IPv4 local connections:
host all all 127.0.0.1/32 trust
host all all 192.168.1.0/24 password
- Update user env. parameters
- #vim /var/lib/pgsql/.bash_profile
- [ -f /etc/profile ] && source /etc/profile
PGDATA=/usr/local/pgsql/data
export PATH=/usr/local/pgsql/bin:$PATH
export PGDATA
- Start the service
- start SQL service:
- #su - postgres
- #/usr/local/pgsql/bin/pg_ctl start -i -D /usr/local/pgsql/data
- check SQL status: ps aux | grep postgres
- update postgres user
- #su - postgres
- #psql postgres
- #alter user postgres ENCRYPTED PASSWORD 'postgres';
Note that: you have a short cut to figure out:
command line: yum -y install postgresql postgresql-libs postgresql-server