Start of topic | Skip to actions
Installing PostgreSQL? 8.1.3 on Solaris 10There are no official Solaris binaries provided on the PostgreSQL? website. To install it, you can either compile the source yourself, or find bundles online. This guide installs PostgreSQL? using the pkg-get utility. This process is easier than compiling the source yourself.Create the postgres user# mkdir /export/home # chmod go+rx /home/ # mkdir /export/home/postgres # useradd -d /export/home/postgres postgres # chown postgres /export/home/postgres # passwd postgres New Password: Re-enter new Password: passwd: password successfully changed for postgres Install PostgreSQL? bundle# pkg-get -p postgres
Initializing and Starting the database
# cp /opt/csw/etc/postgresql.conf.csw /opt/csw/etc/postgresql.conf # vi /opt/csw/etc/postgresql.conf
PGDATA=/export/home/postgres/data SERVEROPTS="-o -i"
# su postgres $ mkdir /export/home/postgres/data $ exit # /etc/init.d/cswpostgres init Creating PostgreSQL data directory at /export/home/postgres/data... Initialising PostgreSQL database... WARNING: enabling "trust" authentication for local connections You can change this by editing pg_hba.conf or using the -A option the next time you run initdb.
# /etc/init.d/cswpostgres start Starting PostgreSQL... postmaster starting Verifying your installation
$ export PATH=$PATH:/opt/csw/postgresql/bin
$ createuser -P test_user
Enter password for new role:
Enter it again:
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) n
CREATE ROLE
$ createdb -O test_user -E UNICODE test_db
CREATE DATABASE
$ psql test_db
Welcome to psql 8.1.3, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
test_db=# create table test_table (x int, y text);
CREATE TABLE
test_db=# insert into test_table values (1, 'one');
INSERT 0 1
test_db=# insert into test_table values (2, 'two');
INSERT 0 1
test_db=# select * from test_table;
x | y
---+-----
1 | one
2 | two
(2 rows)
test_db=# \q
$ psql -U test_user test_db
Welcome to psql 8.1.3, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
test_db=>\q
$ dropdb test_db
DROP DATABASE
$ dropuser test_user
DROP ROLE
References
Edit | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r4 < r3 < r2 < r1 | More topic actions
Guides.InstallPostgreSQL moved from Guides.SolarisPostgreSQL on 04 Mar 2006 - 04:58 by JesseSuen - put it back
| |||||