mirror of
https://github.com/Zeckmathederg/glfs.git
synced 2025-02-04 15:37:16 +08:00
458342f025
git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@1330 af4574ff-66df-0310-9fd7-8a98e5e911e0
38 lines
1.6 KiB
XML
38 lines
1.6 KiB
XML
<sect2>
|
|
<title>Installation of <application>Postgre<acronym>SQL</acronym></application></title>
|
|
|
|
<para>Install <application>Postgre<acronym>SQL</acronym></application> with the following commands: </para>
|
|
|
|
<screen><userinput><command>./configure --prefix=/usr &&
|
|
make &&
|
|
make install</command></userinput></screen>
|
|
|
|
<para>Initialize a database cluster with the following commands:</para>
|
|
|
|
<screen><userinput><command>mkdir -p /var/pgsql/data &&
|
|
useradd -d /var/pgsql/data postgres &&
|
|
chown postgres /var/pgsql/data &&
|
|
su - postgres -c '/usr/bin/initdb -D /var/pgsql/data'</command></userinput></screen>
|
|
|
|
<para>Start the database server with the following command:</para>
|
|
|
|
<screen><userinput><command>su - postgres -c '/usr/bin/postmaster -D /var/pgsql/data > \
|
|
/var/pgsql/data/logfile 2>&1 &'</command></userinput></screen>
|
|
|
|
<para>Now we can create a database and verify the installation:</para>
|
|
|
|
<screen><userinput><command>su - postgres -c '/usr/bin/createdb test'
|
|
echo "create table t1 ( name varchar(20), state_province varchar(20) );" \
|
|
| (su - postgres -c '/usr/bin/psql test ')
|
|
|
|
echo "insert into t1 values ('Billy', 'NewYork');" \
|
|
| (su - postgres -c '/usr/bin/psql test ')
|
|
echo "insert into t1 values ('Evanidus', 'Quebec');" \
|
|
| (su - postgres -c '/usr/bin/psql test ')
|
|
echo "insert into t1 values ('Jesse', 'Ontario');" \
|
|
| (su - postgres -c '/usr/bin/psql test ')
|
|
|
|
echo "select * from t1;" | (su - postgres -c '/usr/bin/psql test')</command></userinput></screen>
|
|
|
|
</sect2>
|