1. download from http://www.postgresql.org
2. Install PostgreSQL on Ubuntu
test:/DB# tar zxf postgresql-9.1.8.tar.gz test:/DB# ls postgresql-9.1.8 postgresql-9.1.8.tar.gz test:/DB# cd postgresql-9.1.8 test:/DB/postgresql-9.1.8#./configure --without-readline mock `ln -s conf26845.file conf26845` to `cp conf26845.file conf26845` mock `ln -s conf26845.file conf26845.dir` to `cp conf26845.file conf26845.dir` checking build system type... i686-pc-linux-gnu ....
checking zlib.h usability... yes checking zlib.h presence... yes checking for zlib.h... yes .....
config.status: linking src/makefiles/Makefile.linux to src/Makefile.port mock `ln -s ../src/makefiles/Makefile.linux src/Makefile.port` to `cp ../src/makefiles/Makefile.linux src/Makefile.port` mock `ln src/makefiles/Makefile.linux src/Makefile.port` to `cp src/makefiles/Makefile.linux src/Makefile.port` test:/DB/postgresql-9.1.8#make make -C src all make[1]: Entering directory `/media/shared/DB/postgresql-9.1.8/src' make -C port all make[2]: Entering directory `/media/shared/DB/postgresql-9.1.8/src/port' gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -I../../src/port -DFRONTEND -I../../src/include -D_GNU_SOURCE -c -o strlcat.o strlcat.c ......
make -C config all make[1]: Entering directory `/media/shared/DB/postgresql-9.1.8/config' make[1]: Nothing to be done for `all'. make[1]: Leaving directory `/media/shared/DB/postgresql-9.1.8/config' All of PostgreSQL successfully made. Ready to install. test:/DB/postgresql-9.1.8#make install make -C src install make[1]: Entering directory `/media/shared/DB/postgresql-9.1.8/src' make -C port install make[2]: Entering directory `/media/shared/DB/postgresql-9.1.8/src/port' make -C ../backend submake-errcodes make[3]: Entering directory `/media/shared/DB/postgresql-9.1.8/src/backend' make[3]: Nothing to be done for `submake-errcodes'. .....
make[1]: Leaving directory `/media/shared/DB/postgresql-9.1.8/src' make -C config install make[1]: Entering directory `/media/shared/DB/postgresql-9.1.8/config' /bin/mkdir -p '/usr/local/pgsql/lib/pgxs/config' /bin/sh ../config/install-sh -c -m 755 ./install-sh '/usr/local/pgsql/lib/pgxs/config/install-sh' make[1]: Leaving directory `/media/shared/DB/postgresql-9.1.8/config' PostgreSQL installation complete. test:/DB/postgresql-9.1.8#useradd postgresuser test:/DB/postgresql-9.1.8# ls /usr/local/pgsql bin include lib share test:/DB/postgresql-9.1.8# mkdir /usr/local/pgsql/data test:/DB/postgresql-9.1.8#chown postgresuser /usr/local/pgsql/data test:/DB/postgresql-9.1.8#su -postgresuser No directory,logging in with HOME=/ $ ls /usr/local/pgsql/bin clusterdb dropdb initdb pg_ctl pg_restorereindexdb createdb droplang pg_basebackup pg_dump postgresvacuumdb createlang dropuser pg_config pg_dumpall postmaster createuser ecpg pg_controldata pg_resetxlog psql $ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data The files belonging to this database system will be owned by user "postgres". This user must also own the server process.
The database cluster will be initialized with locale en_US.UTF-8. The default database encoding has accordingly been set to UTF8. The default text search configuration will be set to "english".
fixing permissions on existing directory /usr/local/pgsql/data ... ok creating subdirectories ... ok selecting default max_connections ... 100 selecting default shared_buffers ... 24MB creating configuration files ... ok creating template1 database in /usr/local/pgsql/data/base/1 ... ok initializing pg_authid ... ok initializing dependencies ... ok creating system views ... ok loading system objects' descriptions ... ok creating collations ... ok creating conversions ... ok creating dictionaries ... ok setting privileges on built-in objects ... ok creating information schema ... ok loading PL/pgSQL server-side language ... ok vacuuming database template1 ... ok copying template1 to template0 ... ok copying template1 to postgres ... ok
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.
Success. You can now start the database server using:
/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data or /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
$ cd /usr/local/pgsql/data $ ls base pg_hba.confpg_notify pg_subtrans PG_VERSION global pg_ident.confpg_serial pg_tblspc pg_xlog pg_clog pg_multixactpg_stat_tmp pg_twophase postgresql.conf $ vi pg_hba.conf
host all all 192.168.0.0/16 trust $ ls base pg_hba.confpg_notify pg_subtrans PG_VERSION global pg_ident.confpg_serial pg_tblspc pg_xlog pg_clog pg_multixactpg_stat_tmp pg_twophase postgresql.conf $ pwd /usr/local/pgsql/data $ vi postgresql.conf
listen_addresses=’*' $ /usr/local/pgsql/bin/postmaster -i -D /usr/local/pgsql/data > logfile 2>&1 & $ cat logfile LOG: database system was shut down at 2013-02-18 17:27:54 CST LOG: database system is ready to accept connections LOG: autovacuum launcher started $ /usr/local/pgsql/bin/psql psql (9.1.8) Type "help" for help.
postgres-# ? General copyright show PostgreSQL usage and distribution terms g [FILE] or ; execute query (and send results to file or |pipe) h [NAME] help on syntax of SQL commands,* for all commands q quit psql
Query Buffer e [FILE] [LINE] edit the query buffer (or file) with external editor ef [FUNCNAME [LINE]] edit function definition with external editor p show the contents of the query buffer r reset (clear) the query buffer w FILE write query buffer to file
Input/Output copy ... perform SQL COPY with data stream to the client host echo [STRING] write string to standard output i FILE execute commands from file o [FILE] send all query results to file or |pipe qecho [STRING] write string to query output stream (see o)
.....
postgres-# q $ /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start server starting $ /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile stop waiting for server to shut down.... done server stopped $ (编辑:李大同)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|