NOTE: RHEL5 comes with PostgreSQL 8.1.11 rpm packages for installation from the install disks. So we need to upgrade to the version we use 8.3.3-2
First uninstall postgresql 8.1 with
rpm -e postgresql postgresql-server postgresql-python
then download the file
change the file priviledges with chmod 755 filename
run the installation program with ./filename
configure as follows:
Installation Directory [/opt/PostgreSQL/8.3]: /opt/postgres/8.3
Data Directory [/opt/postgres/8.3/data]:
database superuser (postgres).
password:
Port [5432]:
Please choose an option [1] :
pl/pgsql [Y/n]: Y
pl/Perl (trusted) [y/N]: Y
pl/Perl (untrusted) [y/N]: N
pl/Python (untrusted) [y/N]: Y
pl/Tcl (trusted) [y/N]: N
pl/Tcl (untrusted) [y/N]: N
Adding the postgres User$ su - -c "useradd postgres"
Setting Environment Variables
Initializing and Starting PostgreSQL
You will need to log in as postgres user before typing the following commands$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
Note: in RHEL5 the PostgreSQL rpm has done all of this for us if we told the installation disks to do so. If not you can run yum install postgresql postgresql-server and install it afterwards. Be warn that the $home directory for the postgres user is in /var/lib/pgsql, and it has also run for us the initdb creating the data dir under /var/lib/pgsql.
Running postmaster in the foreground$ /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data
in RHEL5 use:
/usr/bin/postmaster -D /var/lib/pgsql/data
Running postmaster in the background$ /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l /tmp/pgsql.log start
in RHEL5 use:
/usr/bin/pg_ctl -D /var/lib/pgsql/data -l logfile start
Starting PostgreSQL with the SysV script$ service postgresql start$ service postgresql stop
Creating a Database$ createdb testdb
Accessing a database with psql$ psql testdb
Login to the template1 database
To see the encoding codification of the databases
\l
to change the encoding of one database use
6 = UTF8, 8 = LATIN1
update pg_database set encoding=6 where datname='testdb';
No comments:
Post a Comment