I’ve started two drupal courses through P2PU and want to keep my work on each separated.
To achieve this I need:
- Two separate drupal folders
- Two separate drupal databases
- Two separate virtual sites for apache
I made the first site “drupalintro” in the same manner as outlined in my earlier post P2PU: Drupal Social Web Application #1 with the following changes.
- The drupal directory was named /var/www/drupalintro
- $ mysqladmin –u root –p create drupalintro
- mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON drupalintro.* TO ‘<drupaluser>’@’localhost’ IDENTIFIED BY ‘<drupalpass>’;
- mysql> FLUSH PRIVILEGES;
- mysql> \q
- $ vim /var/www/drupalintro/sites/default/settings.php
- edit: $db_url = ‘mysql://<drupaluser>:<drupalpass>@localhost/drupalintro’;
- $ cp /etc/apache2/sites-available/default /etc/apache2/sites-available/drupalintro
- $ vim /etc/apache2/sites-available/drupalintro
- edit: DocumentRoot /var/www/drupalintro
- edit: Directory /var/www/drupalintro
Now to make the second site called “openhippel” I did the same again with the following changes:
- The drupal directory was named /var/www/openhippel
- $ mysqladmin –u root –p create openhippel
- mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON openhippel.* TO ‘<drupaluser>’@’localhost’ IDENTIFIED BY ‘<drupalpass>’;
- mysql> FLUSH PRIVILEGES;
- mysql> \q
- $ vim /var/www/openhippel/sites/default/settings.php
- edit: $db_url = ‘mysql://<drupaluser>:<drupalpass>@localhost/openhippel;
- $ cp /etc/apache2/sites-available/default /etc/apache2/sites-available/openhippel
- $ vim /etc/apache2/sites-available/openhippel
- edit: DocumentRoot /var/www/openhippel
- edit: Directory /var/www/openhippel
Now to change between the two virtual sites I simply use the following (shown for selecting drupalintro)
- $ sudo a2dissite openhippel && sudo a2ensite drupalintro
- $ sudo /etc/init.d/apache2 reload
Then I can browse to my localhost address and see the home page for the desired site.