]> git.sur5r.net Git - bacula/docs/blobdiff - docs/manuals/en/main/postgresql.tex
Tweaks from Dan
[bacula/docs] / docs / manuals / en / main / postgresql.tex
index a4061fb2837fb93cee405094a4da27b2150e7437..2b2559e4137b5c265eaaa6ed2ccadb9033f05c4f 100644 (file)
@@ -192,8 +192,9 @@ PostgreSQL-directory/bin/psql --command \\dp bacula
 \normalsize
 
 Also, I had an authorization problem with the password. In the end,
-I had to modify my {\bf pg\_hba.conf} file (in /var/lib/pgsql/data on my machine)
-from:
+I had to modify my {\bf pg\_hba.conf} file (in /var/lib/pgsql/data on my machine
+in /var/lib/postgresql/8.x on others, and in /etc/postgres/8.x/main on
+still others -- what a mess!) from:
 
 \footnotesize
 \begin{verbatim}
@@ -209,7 +210,7 @@ my regression scripts without having a password.
 
 A more secure way to perform database authentication is with md5
 password hashes.  Begin by editing the {\bf pg\_hba.conf} file, and
-just prior the the existing ``local'' and ``host'' lines, add the line:
+above the existing ``local'' and ``host'' lines, add the line:
 
 \footnotesize
 \begin{verbatim}
@@ -217,14 +218,14 @@ just prior the the existing ``local'' and ``host'' lines, add the line:
 \end{verbatim}
 \normalsize
 
-and restart the Postgres database server (frequently, this can be done
+then restart the Postgres database server (frequently, this can be done
 using "/etc/init.d/postgresql restart" or "service postgresql restart") to
 put this new authentication rule into effect.
 
 Next, become the Postgres administrator, postgres, either by logging
 on as the postgres user, or by using su to become root and then using
-su - postgres to become postgres.  Add a password to the bacula
-database for the bacula user using:
+{\bf su - postgres} or {\bf su - pgsql} to become postgres.  
+Add a password to the {\bf bacula} database for the {\bf bacula} user using:
 
 \footnotesize
 \begin{verbatim}
@@ -314,8 +315,8 @@ device name for your machine.
 \index[general]{Installing PostgreSQL from RPMs}
 If you are installing PostgreSQL from RPMs, you will need to install
 both the PostgreSQL binaries and the client libraries.  The client
-libraries are usually found in a devel package, so you must
-install:
+libraries are usually found in a {\bf devel} or {\bf dev} package, so you must
+install the following for rpms:
 
 \footnotesize
 \begin{verbatim}
@@ -326,6 +327,21 @@ install:
 \end{verbatim}
 \normalsize
 
+
+and the following for debs:
+
+\footnotesize
+\begin{verbatim}
+  postgresql
+  postgresql-common
+  postgresql-client
+  postgresql-client-common
+  libpq5
+  libpq-dev
+\end{verbatim}
+\normalsize
+
+
 These will be similar with most other package managers too.  After
 installing from rpms, you will still need to run the scripts that set up
 the database and create the tables as described above.
@@ -341,10 +357,10 @@ The conversion procedure presented here was worked out by Norm Dressler
 This process was tested using the following software versions: 
 
 \begin{itemize}
-\item Linux Mandrake 10/Kernel 2.4.22-10 SMP 
-\item Mysql Ver 12.21 Distrib 4.0.15, for mandrake-linux-gnu (i586) 
-\item PostgreSQL 7.3.4 
-\item Bacula 1.34.5 
+\item Linux Ubuntu Lucid
+\item Mysql Ver 5.0.83
+\item PostgreSQL 8.4.4
+\item Bacula 5.0
    \end{itemize}
 
 WARNING: Always as a precaution, take a complete backup of your databases
@@ -356,8 +372,11 @@ before proceeding with this process!
 
    \footnotesize
 \begin{verbatim}
-       mysqldump -f -t -n >bacula-backup.dmp
-    
+mysqldump -t -n -c --compatible=postgresql --skip-quote-names --skip-opt \
+          --disable-keys --lock-tables -u bacula -ppassword bacula \
+  | grep -v "INSERT INTO Status" \
+  | sed -e 's/0000-00-00 00:00:00/1970-01-01 00:00:00/g' \
+  | sed -e 's/\\0//' > bacula-backup.sql    
 \end{verbatim}
 \normalsize
 
@@ -372,7 +391,8 @@ before proceeding with this process!
 \item Start PostgreSQL on your system.  
 \item Create a bacula user in Postgres with the createuser command.  Depending on
    your Postgres install, you may have to SU to the  user who has privileges to
-   create a user.  
+   create a user, you can also have to change permissions on catalog scripts
+   to fit your situation.  
 \item Verify your pg\_hba.conf file contains sufficient permissions to  allow
    bacula to access the server. Mine has the following since  it's on a secure
    network:  
@@ -383,8 +403,7 @@ local all all trust
                 
 host all all 127.0.0.1 255.255.255.255 trust
                 
-NOTE: you should restart your postgres server if you
-      made changes
+NOTE: you should reload (or restart) your postgres server if you  made changes
       
 \end{verbatim}
 \normalsize
@@ -429,26 +448,32 @@ psql -Ubacula bacula <bacula-backup.dmp>
 \begin{verbatim}
 psql -Ubacula bacula
                 
-SELECT SETVAL('basefiles_baseid_seq', (SELECT
-MAX(baseid) FROM basefiles));
-SELECT SETVAL('client_clientid_seq', (SELECT
-MAX(clientid) FROM client));
-SELECT SETVAL('file_fileid_seq', (SELECT MAX(fileid)
-FROM file));
-SELECT SETVAL('filename_filenameid_seq', (SELECT
-MAX(filenameid) FROM filename));
-                
-SELECT SETVAL('fileset_filesetid_seq', (SELECT
-MAX(filesetid) FROM fileset));
-                
+SELECT SETVAL('basefiles_baseid_seq', (SELECT MAX(baseid) FROM basefiles));
+SELECT SETVAL('client_clientid_seq', (SELECT MAX(clientid) FROM client));
+SELECT SETVAL('file_fileid_seq', (SELECT MAX(fileid) FROM file));
+SELECT SETVAL('filename_filenameid_seq', (SELECT MAX(filenameid) FROM filename));
+SELECT SETVAL('fileset_filesetid_seq', (SELECT MAX(filesetid) FROM fileset));
 SELECT SETVAL('job_jobid_seq', (SELECT MAX(jobid) FROM job));
-SELECT SETVAL('jobmedia_jobmediaid_seq', (SELECT
-MAX(jobmediaid) FROM jobmedia));
+SELECT SETVAL('jobmedia_jobmediaid_seq', (SELECT MAX(jobmediaid) FROM jobmedia));
+SELECT SETVAL('media_mediaid_seq', (SELECT MAX(mediaid) FROM media));
+SELECT SETVAL('path_pathid_seq', (SELECT MAX(pathid) FROM path));
+SELECT SETVAL('basefiles_baseid_seq', (SELECT MAX(baseid) FROM basefiles));
+SELECT SETVAL('client_clientid_seq', (SELECT MAX(clientid) FROM client));
+SELECT SETVAL('file_fileid_seq', (SELECT MAX(fileid) FROM file));
+SELECT SETVAL('filename_filenameid_seq', (SELECT MAX(filenameid) FROM filename));
+SELECT SETVAL('fileset_filesetid_seq', (SELECT MAX(filesetid) FROM fileset));
+SELECT SETVAL('job_jobid_seq', (SELECT MAX(jobid) FROM job));
+SELECT SETVAL('jobmedia_jobmediaid_seq', (SELECT MAX(jobmediaid) FROM jobmedia));
 SELECT SETVAL('media_mediaid_seq', (SELECT MAX(mediaid) FROM media));
 SELECT SETVAL('path_pathid_seq', (SELECT MAX(pathid) FROM path));
-                
 SELECT SETVAL('pool_poolid_seq', (SELECT MAX(poolid) FROM pool));
-       
+
+SELECT SETVAL('device_deviceid_seq', (SELECT MAX(deviceid) FROM device));
+SELECT SETVAL('location_locationid_seq', (SELECT MAX(locationid) FROM location));
+SELECT SETVAL('locationlog_loclogid_seq', (SELECT MAX(loclogid) FROM locationlog));
+SELECT SETVAL('log_logid_seq', (SELECT MAX(logid) FROM log));
+SELECT SETVAL('mediatype_mediatypeid_seq', (SELECT MAX(mediatypeid) FROM mediatype));
+SELECT SETVAL('storage_storageid_seq', (SELECT MAX(storageid) FROM storage));       
 \end{verbatim}
 \normalsize