Debian Sarge - Cached Copy of above link

From DocMGR

Jump to: navigation, search

Apache 1, PostgreSQL 7, PHP 5 and DocMGR installations on Debian (Sarge/Stable) Linux

COMPLETLY UPDATED in 2006, September, 25th

If you got UTF8 / accentuated characters issues: Please precisely follow the document below that explains how to use UNICODE as encoding when you create the postgres database, how to put UTF-8 in config.php and define("LANG_CHARSET","UTF-8"); in your /lang/English.php file. Then, only if you still have problems with some foreign characters like french accents in the search field box you should edit the file /app/search_function.php line 347 in function createNormalSql code and replace the $string = trim(strtolower($string)); with $string = trim($string);

Note to "experts": If you think you have locale system issues, remember you can redefine locale with this command: dpkg-reconfigure locales

About Debian GNU/Linux operating system : http://www.debian.org About DocMGR Document management system : http://docmgr.sourceforge.net

Contents

[edit] NOTES ABOUT VERSIONS

[edit] Apache 1 & 2

I will not argue about the apache 1.x versus apache 2.x war. My point is clear: If you do not really need apache 2.x for something really special (like using subversion module or developping your own apache 2 modules), there is absolutly no use to choose apache 2.x. According to this, this Howto only covers Apache 1.x.

[edit] PostgreSQL 7 & 8

There are some major changes made in the 8.0 release but Debian do not provide any official 8.0 stable package. Hopefully, nearly nothing is "8.0 only" compliant, most of the available common applications and scripts can be used with 7.4.x PostgreSQL series. Since DocMGR was tested with PostgreSQL 8, you can still choose it but this Howto only covers PostgreSQL v7.x.

[edit] PHP 4 & 5

Php 5 is a great step ahead in Php history... But unfortunatly, there is no official Debian php5 packages. Luckly, you will see that you can put your confidence in some other packages repositories.


[edit] APACHE1 INSTALLATION

Simple:

   apt-get install apache

Check that Apache is running by opening a Web Browser locally on http://127.0.0.1 or with your IP from another computer. You should see the apache welcome page.

Apache can be runned and stopped like this:

   /etc/init.d/apache start|stop|restart

If you want to make apache reload its congiguration files without breaking current connexions, you should be able to make:

   apachectl graceful

Please check the proxy configuration of your Web Browser before looking for problems that do not exist. If real problems occured, you should look into the apache error log in /var/log/apache/error.log.

[edit] POSTGRESQL 7.x INSTALLATION

Optional: To enable utf8 or other encodings, you should use dpkg-reconfigure locales.

Install the default postgresql 7.4.x server:

   apt-get install postgresql

[ Tip: Debian Woody users shouldn't use the default PostreSQL 7.2.1 woody package but a 7.4.x one like this one here. ] Tip send by "Nico".

Then edit your /etc/postgresql/pg_hba.conf to obtain:

   # TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD
   # Database administrative login by UNIX sockets
   local all postgres ident sameuser
   #
   # All other connections by UNIX sockets
   local all all ident sameuser
   #
   # All IPv4 connections from localhost
   host all all 127.0.0.1 255.255.255.255 md5
   #
   # All IPv6 localhost connections
   host all all::1 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff ident sameuser
   host all all::ffff:127.0.0.1/128 ident sameuser
   #
   # reject all other connection attempts
   host all all 0.0.0.0 0.0.0.0 reject


   At the end of the file you can optionnally add commentary lines like:
   #
   # Below here are our own accounts
   #

Now you should edit /etc/postgresql/postgresql.conf and verify that those three lines are uncommented :

   tcpip_socket = true

and...

   port = 5432

and...

   password_encryption = true

Warning: You should verify that files in your /etc/postgresql are all owned by postgres to avoid strange problems. You can force this by using cd /etc/postgresql then chown postgres:postgres *

Then restart apache with:

   /etc/init.d/postgresql restart

[edit] PHP5 INSTALLATION WITH POSTGRESQL LIBRARY

[edit] PHP5 installation

Now... let's install php5 with the standard command:

   apt-get install php5

If you play too much with php packages, you REALLY should verify that the installation makes these two things: First, it should have add this line to your /etc/apache/modules.conf

   LoadModule php5_module /usr/lib/apache/1.3/libphp5.so

Then, verify that there are some lines in your /etc/apache/httpd.conf to "activate" the php files extensions... something like:

   <IfModule mod_php5.c>
   AddType application/x-httpd-php .php .php3 .php4 .php5
   DirectoryIndex index.php index.php3 index.php4 index.php5
   </IfModule>

This default php5 installation will not install the command line interpreter that you will need later. Install it now:

   apt-get install php5-cli

Then restart apache with:

   /etc/init.d/apache restart

[edit] Make a PHPINFO page to test & print PHP configuration

The standard homepage of apache is in /var/www. To test the complete PHP configuration, create a subbfolder called php , and in this subfolder, create a file called index.php (/var/www/php/index.php) and edit this to only this:

   <?php
   phpinfo();
   ?>

Now you can check the PHP entire configuration by opening a Web Browser locally on http://127.0.0.1/php or http://your_IP/php/ from another computer. You should see a rather big page that prints the whole php configuration. If everything seems ok then delete this file (/var/www/php/index.php) now: it gives to many informations to everyone, it was just usefull to check the configuration.

[edit] Install PostgreSQL library

Now you should install the php library for mysql

   apt-get install php5-pgsql

Then restart apache again with:

   /etc/init.d/apache restart

[edit] SOME OTHER PACKAGES USED BY DOCMGR

DocMGR mail features mainly needs:

   apt-get install php5-imap

If you do not have any local main server, you should consider read documentation about the Postfix mail server. By the way, you can make an easy standard local installation with:

   apt-get install postfix

Then, to make DocMGR recognize that the sendmail command compatibility is present:

   cd /bin
   ln -s /usr/sbin/sendmail sendmail

Then install those other packages:

   apt-get install xpdf-reader
   apt-get install xpdf-utils
   apt-get install gocr
   apt-get install zip
   apt-get install gs
   apt-get install enscript
   apt-get install antiword
   apt-get install metamail
   apt-get install libtiff-tools
   apt-get install clamav

During the clamav installation, do not forget to enter your proxy info if you need it or your clamav antivirus will be quickly useless.

Then restart apache with:

   /etc/init.d/apache restart

[edit] DOCMGR FILES INSTALLATION

[edit] Take and extract the tar.gz

You should go to the official website and take the last release of docmgr-x.xx.tar.gz archive then extract sources:

   tar zxvf docmgr-x.xx.tar.gz

This should extract a big/doc folder. We prefer renaming this folder to "docmgr":

   mv doc docmgr

Move this renamed folder to the public html directory of your choice. By default, the apache root directory is /var/www, so if you have no domains/virtual servers of any kind you should do a simple:

   mv docmgr /var/www

If you already setup several apache virtual hosts/domains and want to use a specific domain, you should probably use a path like: /home/yourdomain_com/public_html

[edit] Prepare the docmgr files directory

Move the /files subdirectory of your docmgr folder to a directory that can't be reached from the web (outside your public html folder). In our example, we choose /opt/docmgr/files:

   cd /opt
   mkdir docmgr
   cd /path/to/your/docmgr_main_directory
   mv files /opt/docmgr

Then make apache (www-data user) the owner of this files directory and its subfolders:

   chown -R www-data:www-data /opt/docmgr/files

[edit] DOCMGR POSTGRESQL USER & DATABASE

[edit] DocMGR PostgreSQL user creation

If you follow the official short documentation, only the postgres user ("postgresql root user") will be able to fully create/access/import/use the DocMGR database. For security reasons, we will use here a special new postgresql user to isolate this user and database from other scripts and applications. Please remember we will allow the new DocMGR user to create databases/users to temporally become superuser and successfully create/import DocMGR database. After the complete DocMGR installation, you'll be able to restrict this user, but not now. User creation can be done with: (do not forget the ";")

   su postgres
   createuser docmgruser
   Shall the new user be allowed to create databases? (y/n) y
   Shall the new user be allowed to create more new users? (y/n) y
   CREATE USER
   psql template1
   template1=# alter user docmgruser password 'your_password';
   ALTER USER
   template1=# \q
   exit

[edit] Empty database creation

Database creation is done with this command (If you want to use special encodings, remember to add --encoding='the_one_you_choose' if it is not your default one): You really should create the database with UNICODE (UTF8) encoding like this:

   createdb -h localhost --encoding=UNICODE -W -U docmgruser docmgrbase

[edit] Access rights creation

Users rights are made through the edition of /etc/postgresql/pg_hba.conf. To give docmgruser access (with TCP/IP sockets) to docmgrbase from localhost, you'll have to add this line at the end of the file:

   host docmgrbase docmgruser 127.0.0.1 255.255.255.255 md5

Then restart the database engine:

   /etc/init.d/postgresql restart

Remember that if you want to access the newly created database from shell, you'll have to use the -h option to use TCP/IP sockets and not Unix ones. This should give something like: psql -h localhost -U docmgruser -W docmgrbase

[edit] Import database structure

Go to the /scripts subfolder of docmgr. There should be a docmgr.pgsql file. You should edit this file to replace every "postgres" by the name of the user you choosed for the DocMGR database and save this new file to new.pgsql. In our example this means replacing postgres by docmgruser. You can do this with the sed command like this:

   sed 's/postgres/docmgruser/g' docmgr.pgsql >> new.pgsql

Then import the database structure from this file:

   psql -h localhost -W -U docmgruser -d docmgrbase -f new.pgsql

Remember you need at least PostgreSQL 7.4.x to use DocMGR. With old PostgreSQL releases, errors like "psql:new.pgsql:12: ERROR: parser: parse error at or near "public"" will happen. Debian Woody users should read this tip.

[edit] DocMGR PostgreSQL user access restriction

We'll have to edit the docmgruser rights to not allow him to create users and databases anymore: (do not forget the ";")

   su postgres
   psql template1
   template1=# alter user docmgruser NOCREATEUSER NOCREATEDB;
   ALTER USER
   template1=# \q
   exit

[edit] DOCMGR CONFIGURATION

[edit] Config files edition

In the /config subfolder of your main docmgr folder, edit the config.php file:

   //connection settings
   define("DBHOST","127.0.0.1");
   define("DBUSER","docmgruser");
   define("DBPASSWORD","your_password");
   define("DBPORT","5432");
   define("DBNAME","docmgrbase");
   //the directory you want the import module to look at (no trailing slash)
   define("IMPORT_DIR","/import");
   //absolute or relative path to the docmgr files directory (no trailing slash)
   define("FILE_DIR","/opt/docmgr/files");
   //administrator email (also return address for outgoing emails
   define("ADMIN_EMAIL","your@email.here");
   //site url for emailing links to files in event and task notifications
   define("SITE_URL","http://your_server_name/docmgr/");
   //set this if you are using postgresql 8.0.x or EARLIER
   define("USE_OID","1");

DO NOT FORGET TO UNCOMMENT THE LAST define("USE_OID","1"); LINE. Later in the same config file you must have something like this:

   //encoding of your database. you probably don't need to change this
   //if changed, make sure you use the value iconv (http://www.php.net/iconv)
   //recognizes for your encoding, not the encoding name postgresql uses define("DBENCODING","UTF-8");
   //set this if nobody can delete objects except adminstrators //define("RESTRICTED_DELETE","1");
   //site theme
   define("SITE_THEME","default");
   /*****************************************************
   these are only needed it you are running two installs on one server under
   the same domain name. If you set these, you HAVE to access DocMGR
   using this url, instead of by an ip address or WINS addres.
   ******************************************************/
   //domain of your server
   define("SITE_DOMAIN","www.your_server_name.com");
   //url path to your server (not filesystem path)
   define("SITE_COOKIE_PATH","/docmgr");


   In this same config.php file, you already have something like:
   /*****************************************************************
                Optional Settings
   *****************************************************************/
   //set the default language for users
   define("DEFAULT_LANG","English");

This means DocMGR will use the file called English.php in the /lang subfolder. You can translate this file, rename it and change the DEFAULT_LANG line... but let's assume that we want to keep the default English language, you still have to edit this English.php file to put the exact right UTF-8 CharSet.

This can be done by editing /lang/English.php like this:

   //language charset for the browser
   define("LANG_CHARSET","UTF-8");

[edit] First Admin web access

Now, you can access DocMGR with a web browser with: http://your_server/docmgr/ You will have to use the default admin login and password that are admin / admin.

First, you should immediatly change you admin password ! Do this by clicking the "Profile" link on the left, then "Change password". You should change your email too.

Then, choose Admin section link in the upper left of your DocMGR web page and click "External Applications" to verify that every tools are well installed (All lines should be green).

From now, you are on your own, the DocMGR installation is finished.

Let's end with the optional WEBDAV Access to the files but you really should not use this feature.

[edit] OPTIONAL WEBDAV ACCESS (You really should not use this feature)

[edit] You should NOT use WebDAV

GLOBAL WEBDAV WARNING: WebDav sucks. Not only in docmgr but nearly everywhere. And that's not the only one problem: read carefully before loosing time like I already did.

I made the following tutorial months ago but since that day, I learnt painfully that all WebDAV Windows clients are unstable and full of bugs and problems. By the way, even when it seems to work, performances are not good at all.

You should understand too that DocMGR is a great way to deal with documents if people are using the great Web DocMGR interface. By experience, when people ask for WebDAV access, all they want is to keep their bad habits: Edit directly from a windows share, never look the documents details, never add or change documents details and properties, never mark a real new document release and lots of stupid things that make DocMGR totally useless.

Please remember why you needed a real Documents Server! If some folks in your company still only want to have a quick and dirty documents sharing system, you really should make a separate documents space for them with a standard Windows file server or with a Samba Linux server but my real advice is clearly:

MY FINAL ADVICE : DO NOT USE WEBDAV ACCESS AT ALL

[edit] Server side configuration

In the /webdav subfolder of your main docmgr folder, edit your client.php to enter your absolute docmgr path in WEBDAV_PATH. Do not include /webdav or any "/" at the end of the path.

   //define absolute path to docmgr.
   define("WEBDAV_PATH","/the_absolute_path_to_your/docmgr");
   If you do not use any virtual servers... this path could be: /var/www/docmgr/

[edit] Upload one text file to DocMGR

Before doing any client, you should upload at least one text file from your DocMGR web interface. To do that, click on the browse section, then use the "Add New..." list button and choose "Uploaded File" then upload a common text file. Do not use a file with space in the filename or the webdav access won't work. I presume it is a Docmgr bug that will be soon fixed.

[edit] Windows client side setup (Netdrive)

Windows XP has a strange webdav client implementation that Microsoft called "Webfolder". I do not recommend using this at all and I will not cover this WebFolder thing.

Anyway, there not so many WebDAV windows clients and all I know are really full of bugs and problems.

There is a complete webdav client software (but still with some bugs) that can be used freely on Windows 2000 and XP: Novel Netdrive (The commercial Webdrive software is based on it). The latest release can be downloaded here:

Netdrive v4.1 build 883 (4.1.2 v2004) (The Netdrive setup.exe needs some times to start... and you should close other programs before launching it. After the installation, there is no problem of that kind anymore.)

When installation is complete, make a right button click on the Netdrive trayicon and choose Program Settings.

You can change this later if you want to play with Netdrive features but for our first tests I recommend not to use any cache systems. It will be slower to navigate in your webdav folder but you will not have any strange errors this way. Uncheck all in Cache tab.

Remember to enter your proxy informations in the Proxy-HTTP tab if you need it.

Then, make a right button click on the trayicon and choose Open Netdrive.

Then fill the fields with your DocMGR server informations:

Your site URL should end with client.php/ (do not forget the final "/" ). Remember you changed the default admin password. You can make Netdrive to automatically connect at login/startup if you want, and you can choose the drive letter that will be used to mount the distant Webdav folder.

Now your distant DocMGR webdav folder should be mounted to the new Drive letter you entered and you should be able to access DocMGR files:

You should be able to read, rename, overwrite files (if user is allowed to do so). Remember that webdav access is an optional feature that seems to be stable now but even, you should consider pushing people to use the standard docmgr web interface to take the real profits of DocMGR web main features.

That's all folks for the installation but as I said in 9.0 section: all you'll get with WebDAV access is a lot of problems, you'd rather not use WebDAV access at all.

[edit] DOCMGR UPGRADE

[edit] Rename the current DocMGR folder

Go to your apache root directory (this should be something like /var/www or something like /home/domain_com/public_html) and rename the DocMGR like this:

   mv docmgr docmgr_old

[edit] Take and extract the tar.gz of the new release

You should go to the official website and take the last release of docmgr-x.xx.tar.gz archive then extract sources from the tar.gz archive:

   tar zxvf docmgr-x.xx.tar.gz

This should extract a big/doc folder. We prefer renaming this folder to "docmgr":

   mv doc docmgr

Move this renamed folder to the public html directory of your choice. By default, the apache root directory is /var/www, so if you have no domains/virtual servers of any kind you should do a simple:

   mv docmgr /var/www

if you already setup many apache domains and want to use DocMGR on a specific domain it would have been something like: mv docmgr /home/yourdomain_com/public_html

[edit] Copy the configuration data

Now you should have one folder called /docmgr_old that contains your old working DocMGR installation and anotehr fodler called /docmgr containing your new release that needs to be configured.

To do so you'll have to edit your /docmgr/config/config.inc.php file to reflect the configuration data that was in your /docmgr_old/config/config.inc.php file.

[edit] Run the upgrade php file if needed

You should read the file called INSTALL.HTML in the /DOCS subfolder of your main docmgr folder to see if you need to run the upgrade script file or/and if you need to do something else before or/and after running the upgrade script.

If you can not exactly know if you need to run the upgrade.php script and if you try to run the upgrade script anyway, you will probably have an error about something that already exist in your database. This hould mean that you did not need to run the upgrade script because your database structure was already uptodate. (In fact, I hope so...:) )

How to run this upgrade script: In the /scripts subfolder of your docmgr main folder you have a file called upgrade.php that you'll need to edit to comment the protection line number 15 like this:

   //die("You must comment me out first\n");

Then you'll have to use the php command line interpreter to launch the upgrade. If you already well followed this Howto you can do this now:

   php5 upgrade.php

When done, your DocMGR upgrade is now complete. If you got something like php5: command not found, it is probably that you did not install the php5 command line interpreter. In this case do a simple: apt-get install php5-cli.

I recommend to edit the upgrade.php script again... You should uncomment and edit the line number 15 to something like that:

   die("You must comment me out first, but I think this update was already done\n");
Personal tools