Friday, August 24, 2007

Be The Media 2: Database-driven websites

Database-driven websites with Drupal CMS and Postgresql DBMS
CMS is content management system. DBMS is data-base management system

=== Install Postgresql 8.2 ===
$ sudo aptitude install postgresql-8.2
$ sudo su postgres

## Create user and database for Drupal on Postgresql
$ createuser -D -A -P drupaluser
$ createdb -O drupaluser drupaldb

## Remove user and database for Drupal on Postgresql
$ dropuser drupaluser
$ dropdb drupaldb

## Modify the pg_hba.conf file
$ sudo nano /etc/postgresql/8.2/main/pg_hba.conf
## comment out this line
# "local" is for Unix domain socket connections only
# local all all ident sameuser
## add the following lines
# TYPE DATABASE USER IP-ADDRESS IP-MASK $
host drupaldb drupaluser 127.0.0.1 255.255.255.25$
## save the file (Ctrl + x, y) and restart the postgresql database server engine
$ sudo /etc/init.d/postgresql* restart
## Check your database connection:
$ psql -h 127.0.0.1 -p 5432 -U drupaluser -W drupaldb
Password for user drupaluser:

INSTALL DRUPAL-5.2
## install drupal dependencies
# sudo aptitude install libapache2-mod-php5 php5-imagick imagemagick php5-ldap $

## download the drupal core files
$ sudo wget http://ftp.osuosl.org/pub/drupal/files/projects/drupal-5.2.tar.gz
tar xvzf drupal-5.2.tar.gz
## you can read the install file on creating postgresql database and user (alre$
# sudo nano drupal-5.2/INSTALL.pgsql.txt
## make a folder for your drupal installation.
sudo mkdir /var/www/drupal
## make the drupal directory writeable
sudo chown -R www-data:www-data /var/www/drupal
## move your drupal files into the drupal folder
sudo mv drupal-5.2/* drupal-5.2/.htaccess /var/www/drupal
## create a /storage folder for things like files, images, etc
$ sudo mkdir /var/www/drupal/storage
## make the data storage writeable
sudo chown -R www-data:www-data /var/www/drupal/storage
## Edit the settings.php file so that drupal can know what user, password and $
sudo nano /var/www/drupal/sites/default/settings.php
* Database URL format:
$db_url = 'pgsql://username:password@localhost/databasename';
where username = drupaluser password = drupaluserpass databasename = $
## save the file (Ctrl + x, y)
## Edit the amount of memory PHP can use to run scripts. The default 8mb is no$
sudo nano /etc/php5/apache2/php.ini file
; Resource Limits ;
memory_limit = 180M

; Example lines:
;extensions=pgsql.so
## save the file (Ctrl + x, y) and restart apache
sudo /etc/init.d/apache2 restart

### In a browser, enter: http://localhost/drupal/install.php

CONFIGURATION

## File System
## If you created a /storage folder, rather than a /files folder.
change the name of File System Path from 'files' to 'storage'
## Change the Download Method from public to private
## Select 'save configuration'

## Cron
## Click on 'You can run manually'

For further configuration, please refer to:
http://drupal.org/node/260

No comments: