Ticket #148: postgres.patch
File postgres.patch, 12.6 KB (added by , 22 years ago) |
---|
-
content.ent
diff -Naur --exclude=CVS ./content.ent /home/billy/NEWBLFS/BOOK/content/content.ent
old new 4 4 <!ENTITY content-databases SYSTEM "databases/databases.xml"> 5 5 <!ENTITY % db SYSTEM "databases/db/db.ent"> 6 6 <!ENTITY % mysql SYSTEM "databases/mysql/mysql.ent"> 7 <!ENTITY % postgres SYSTEM "databases/postgres/postgres.ent"> 7 8 %db; 8 9 %mysql; 10 %postgres; 9 11 10 12 <!-- Web server software --> 11 13 <!ENTITY content-web SYSTEM "web/web.xml"> -
databases/databases.xml
diff -Naur --exclude=CVS ./databases/databases.xml /home/billy/NEWBLFS/BOOK/content/databases/databases.xml
old new 4 4 5 5 &db; 6 6 &mysql; 7 &postgres; 7 8 8 9 </chapter> -
databases/postgres/postgres-config.xml
diff -Naur --exclude=CVS ./databases/postgres/postgres-config.xml /home/billy/NEWBLFS/BOOK/content/databases/postgres/postgres-config.xml
old new 1 <sect2> 2 <title>Configuring PostgreSQL</title> 3 4 <sect3> 5 <title>Config files</title> 6 7 <para><userinput> 8 $PGDATA/pg_ident.con, $PGDATA/pg_hba.conf, $PGDATA/postgresql.conf 9 </userinput></para> 10 11 <para>The PGDATA environment variable is used to distinguish database 12 clusters from one another by setting it to the value of the directory 13 which contains the cluster desired. The three configuration files 14 exist in every PGDATA/ directory. Details on the format of the files 15 and the options that can be set in each can be found in :</para> 16 <para> 17 <ulink url="file:///usr/share/doc/postgresql/html/tutorial.html" /> 18 </para> 19 20 <para>postgres init.d script</para> 21 22 <para>Create the postgres, boot script with the following : </para> 23 24 <screen><userinput> 25 cat > /etc/rc.d/init.d/postgres << "EOF"</userinput> 26 27 #!/bin/bash 28 # Begin $rc_base/init.d/postgres 29 30 # Based on sysklogd script from LFS-3.1 and earlier. 31 # Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org 32 33 source /etc/sysconfig/rc 34 source $rc_functions 35 36 case "$1" in 37 start) 38 echo "Starting PostgreSQL daemon..." 39 su - postgres -c '/usr/bin/postmaster -D \ 40 /var/pgsql/data > /var/pgsql/data/logfile 2>&1 &' 41 evaluate_retval 42 ;; 43 44 stop) 45 echo "Stopping PostgreSQL daemon..." 46 killproc postmaster 47 ;; 48 49 restart) 50 $0 stop 51 sleep 1 52 $0 start 53 ;; 54 55 status) 56 statusproc /usr/sbin/postmaster 57 ;; 58 59 *) 60 echo "Usage: $0 {start|stop|restart|status}" 61 exit 1 62 ;; 63 esac 64 65 # End $rc_base/init.d/ 66 <userinput>EOF 67 chmod 755 /etc/rc.d/init.d/postgres</userinput></screen> 68 69 <para>Create the symbolic links to this file in the relevant rc.d directory 70 with the following commands:</para> 71 72 <screen><userinput> 73 cd /etc/rc.d/init.d && 74 ln -sf ../init.d/mysql ../rc0.d/K28postgres && 75 ln -sf ../init.d/postgres ../rc1.d/K28postgres && 76 ln -sf ../init.d/postgres ../rc2.d/K23postgres && 77 ln -sf ../init.d/postgres ../rc3.d/S35postgres && 78 ln -sf ../init.d/postgres ../rc4.d/S35postgres && 79 ln -sf ../init.d/postgres ../rc5.d/S35postgres && 80 ln -sf ../init.d/postgres ../rc6.d/K23postgres 81 </userinput></screen> 82 83 </sect3> 84 85 </sect2> 86 -
databases/postgres/postgres-desc.xml
diff -Naur --exclude=CVS ./databases/postgres/postgres-desc.xml /home/billy/NEWBLFS/BOOK/content/databases/postgres/postgres-desc.xml
old new 1 <sect2> 2 <title>Contents</title> 3 4 <para>The PostgreSQL RDBMS contains 5 <userinput>createdb</userinput>, 6 <userinput>createlang</userinput>, 7 <userinput>createuser</userinput>, 8 <userinput>dropdb</userinput>, 9 <userinput>droplang</userinput>, 10 <userinput>dropuser</userinput>, 11 <userinput>ecpg</userinput>, 12 <userinput>initdb</userinput>, 13 <userinput>initlocation</userinput>, 14 <userinput>ipcclean</userinput>, 15 <userinput>pg_config</userinput>, 16 <userinput>pg_ctl</userinput>, 17 <userinput>pg_dump</userinput>, 18 <userinput>pg_dumpall</userinput>, 19 <userinput>pg_passwd</userinput>, 20 <userinput>pg_restore</userinput>, 21 <userinput>pgaccess</userinput>, 22 <userinput>pgtclsh</userinput>, 23 <userinput>pgtksh</userinput>, 24 <userinput>postgres</userinput>, 25 <userinput>postmaster</userinput>, 26 <userinput>psql</userinput> and 27 <userinput>vacuumdb</userinput>. 28 </para> 29 30 </sect2> 31 32 <sect2><title>Description</title> 33 34 <sect3><title>createdb</title> 35 <para>createdb creates a new PostgreSQL database.</para></sect3> 36 37 <sect3><title>createlang</title> 38 <para>createlang defines a new PostgreSQL procedural 39 language.</para></sect3> 40 41 <sect3><title>createuser</title> 42 <para>createuser defines a new PostgreSQL user account.</para></sect3> 43 44 <sect3><title>dropdb</title> 45 <para>dropdb removes a PostgreSQL database.</para></sect3> 46 47 <sect3><title>droplang</title> 48 <para>droplang removes a PostgreSQL procedural 49 language.</para></sect3> 50 51 <sect3><title>dropuser</title> 52 <para>dropuser removes a PostgreSQL user account.</para></sect3> 53 54 <sect3><title>ecpg</title> 55 <para>ecpg is the embedded SQL preprocessor.</para></sect3> 56 57 <sect3><title>initdb</title> 58 <para>initdb create a new database cluster.</para></sect3> 59 60 <sect3><title>initlocation</title> 61 <para>initlocation creates a secondary database storage 62 area.</para></sect3> 63 64 <sect3><title>ipcclean</title> 65 <para>ipcclean removes share memory and semaphores left over by an 66 aborted database server.</para></sect3> 67 68 <sect3><title>pg_config</title> 69 <para>pg_config retrieves PostgreSQL version 70 information.</para></sect3> 71 72 <sect3><title>pg_ctl</title> 73 <para>pg_ctl controls stopping and starting the database 74 server.</para></sect3> 75 76 <sect3><title>pg_dump</title> 77 <para>pg_dump dumps database data and metadata into scripts which are 78 used to recreate the database.</para></sect3> 79 80 <sect3><title>pg_dumpall</title> 81 <para>pg_dumpall recursively calls pg_dump for each database in a 82 cluster.</para></sect3> 83 84 <sect3><title>pg_passwd</title> 85 <para>pg_passwd is a secondary password file utility, for controlling 86 access to databases.</para></sect3> 87 <sect3><title>pg_restore</title> 88 <para>pg_restore creates databases from dump files created by 89 pg_dump.</para></sect3> 90 91 <sect3><title>pgaccess</title> 92 <para>pgaccess is a graphical client for PostgreSQL, written in 93 Tk/tcl.</para></sect3> 94 95 <sect3><title>pgtclsh</title> 96 <para>pgtclsh is a tcl shell for PostgreSQL.</para></sect3> 97 98 <sect3><title>pgtksh</title> 99 <para>pgtksh is a wish style shell for PostgreSQLL.</para></sect3> 100 101 <sect3><title>postgres</title> 102 <para>postgres is a single user database server, generally used for 103 debugging.</para></sect3> 104 105 <sect3><title>postmaster</title> 106 <para>postmaster is the multiuser database daemon.</para></sect3> 107 108 <sect3><title>psql</title> 109 <para>psql is a console based database shell.</para></sect3> 110 111 <sect3><title>vacuumdb</title> 112 <para>vacuumdb compacts databases and generates statistics for the 113 query analyzer.</para></sect3> 114 115 </sect2> -
databases/postgres/postgres-exp.xml
diff -Naur --exclude=CVS ./databases/postgres/postgres-exp.xml /home/billy/NEWBLFS/BOOK/content/databases/postgres/postgres-exp.xml
old new 1 <sect2> 2 <title>Command explanations</title> 3 4 <para><userinput>useradd -d /var/pgsql/data postgres : </userinput> 5 Add an unprivileged user to run the database server. Running the 6 server as root is dangerous, and moreover simply will not work.</para> 7 8 <para><userinput> 9 su - postgres -c '/usr/bin/initdb -D /var/pgsql/data' : </userinput> 10 Initialize the database tablespace. This command may not be executed 11 by root.</para> 12 13 <para><userinput> 14 su - postgres -c '/usr/bin/postmaster -D /var/pgsql/data > \ 15 /var/pgsql/data/logfile 2>&1 &' : </userinput> 16 Start the database server. User postgres must execute this command as 17 well.</para> 18 19 <para><userinput> 20 createdb test, create table t1 , insert into t1 values..., select * 21 from t1 : </userinput> 22 Create a database, add a table to it, insert some rows into the table 23 and select them to verify that the installation is working 24 properly.</para> 25 26 </sect2> -
databases/postgres/postgres-inst.xml
diff -Naur --exclude=CVS ./databases/postgres/postgres-inst.xml /home/billy/NEWBLFS/BOOK/content/databases/postgres/postgres-inst.xml
old new 1 <sect2> 2 <title>Installation of PostgreSQL</title> 3 4 <para>Install PostgreSQL with the following commands: </para> 5 6 <para><screen><userinput> 7 ./configure --prefix=/usr && 8 make && 9 make install && 10 </userinput></screen></para> 11 12 <para> 13 Initialize a database cluster with the following commands: </para> 14 15 <para><screen><userinput> 16 mkdir -p /var/pgsql/data && 17 useradd -d /var/pgsql/data postgres && 18 chown postgres /var/pgsql/data && 19 su - postgres -c '/usr/bin/initdb -D /var/pgsql/data' 20 </userinput></screen></para> 21 22 <para>Start the database server with the following command: </para> 23 24 <para><screen><userinput> 25 su - postgres -c '/usr/bin/postmaster -D /var/pgsql/data > \ 26 /var/pgsql/data/logfile 2>&1 &' 27 </userinput></screen></para> 28 29 <para>Now we can create a database and verify the installation: </para> 30 31 <para><screen><userinput> 32 su - postgres -c '/usr/bin/createdb test' 33 echo "create table t1 ( name varchar(20), city varchar(20) );" \ 34 | (su - postgres -c '/usr/bin/psql test ') 35 36 echo "insert into t1 values ('billy', 'NewYork');" \ 37 | (su - postgres -c '/usr/bin/psql test ') 38 echo "insert into t1 values ('Evanidus', 'Quebec');" \ 39 | (su - postgres -c '/usr/bin/psql test ') 40 echo "insert into t1 values ('Jesse', 'Ottowa');" \ 41 | (su - postgres -c '/usr/bin/psql test ') 42 43 echo "select * from t1;" | (su - postgres -c '/usr/bin/psql test ') 44 45 </userinput></screen></para> 46 47 </sect2> -
databases/postgres/postgres-intro.xml
diff -Naur --exclude=CVS ./databases/postgres/postgres-intro.xml /home/billy/NEWBLFS/BOOK/content/databases/postgres/postgres-intro.xml
old new 1 <sect2> 2 <title>Introduction to PostgreSQL&postgres-version;</title> 3 4 <screen> 5 Download location (HTTP): <ulink url="&postgres-download-http;" /> 6 7 Version used: &postgres-version; 8 Package size: &postgres-size; 9 Estimated Disk space required: &postgres-buildsize;</screen> 10 11 <para>The PostgreSQL package contains the PostgreSQL RDBMS, client 12 utilites and language bindings.</para> 13 14 </sect2> -
databases/postgres/postgres.ent
diff -Naur --exclude=CVS ./databases/postgres/postgres.ent /home/billy/NEWBLFS/BOOK/content/databases/postgres/postgres.ent
old new 1 <!ENTITY postgres SYSTEM "../postgres.xml"> 2 <!ENTITY postgres-intro SYSTEM "postgres-intro.xml"> 3 <!ENTITY postgres-inst SYSTEM "postgres-inst.xml"> 4 <!ENTITY postgres-exp SYSTEM "postgres-exp.xml"> 5 <!ENTITY postgres-config SYSTEM "postgres-config.xml"> 6 <!ENTITY postgres-desc SYSTEM "postgres-desc.xml"> 7 <!ENTITY postgres-version "7.2.2"> 8 <!ENTITY postgres-download-http 9 "http://www.ca.postgresql.org/ftpsite/v7.2.2/postgresql-7.2.2.tar.gz"> 10 <!ENTITY postgres-size "9.2 MB"> 11 <!ENTITY postgres-buildsize "54 MB"> -
databases/postgres.xml
diff -Naur --exclude=CVS ./databases/postgres.xml /home/billy/NEWBLFS/BOOK/content/databases/postgres.xml
old new 1 <sect1 id="postgres" xreflabel="Postgres-&postgres-version;"> 2 <?dbhtml filename="postgres.html" dir="content"?> 3 <title>PostgreSQL-&postgres-version;</title> 4 5 &postgres-intro; 6 &postgres-inst; 7 &postgres-exp; 8 &postgres-config; 9 &postgres-desc; 10 11 </sect1>