Convert Microsoft to LINUX: Drupal


If you want to install a content manage system that everybody can add to try Drupal. It is built into most distributions. To get it you also have to have php5, mysql (client and Server), httpd/Apache2 installed. Here is how to do it using Ubuntu. Type as root in a terminal window:
apt-get install apache2 php5 mysql-client mysql-server php5-mysql
Restart Apache2 to be safe with the command:
/etc/init.d/apache2 reload
Fetch the tarred file with the command below:
wget http://drupal.org/files/projects/drupal-6.14.tar.gz
Note, your version may be newer, at the time of this writing 6.14 was the most recent version.
tar -zxvpf drupal-6.14.tar.gz
After untaring using the above command, this will create a new directory drupal-6.14/ Now, type:
mv drupal-6.14/* drupal-6.14/.htaccess /var/www/html
to move all the drupal files and the .htaccess file to the web directory above. Note, you may have to create the html directory underneath the /var/www/ directory. You should now see a directory:
/var/www/html/sites/default
Copy the default settings file to settings.php with the commands:
cd /var/www/html/sites/default
cp default.settings.php settings.php
chmod 666 /var/www/html/sites/default/settings.php so you can edit the file
After the Drupal install make sure this file's permission is set back to read only, i.e.:
chmod 444 /var/www/html/sites/default/settings.php
chmod 444 /var/www/html/sites/default/files
You are now ready to create the database that drupal will use. Go to the terminal window and type:
mysqladmin -u root password 'your-brand-new-password' [quotes are required]
Make additional security-related changes to mysql. Type:
mysql -u root -p
You will now be at a mysql> prompt.
mysql> DROP DATABASE test; [removes the test database]
mysql> DELETE FROM mysql.user WHERE user = ''; [Removes anonymous access]
mysql> FLUSH PRIVILEGES;
Create a database and database user for your data. You will use this database and user name in your database connection string. The GRANT statement actually creates a new MySQL user account.
mysql> CREATE DATABASE drupal_mysql;
mysql> GRANT ALL PRIVILEGES ON drupal_mysql.* TO 'drupal_admin'@'localhost' IDENTIFIED BY 'thepassword';

You are now ready to run the install, type:
http://localhost/html/install in your web browser. If you get an error about the directory files can not be created, then at the terminal prompt type:
mkdir /var/www/html/sites/default/files
You can then login as the Drupal Administrator and configure the rest of the website. You will eventually want to configure the cron job. For more details please see here . To get started, type http://localhost/html/index.php in your browser. Enjoy!

If you get the message from your browser upon login or logout, This is a phtml file, what should I do with it?
You need to go to your browser and clear the cache. You will find this in Firefox under Tools | Clear Private Data

Since this was written, almost a year ago, you probably will get a message after installing that you need to update. Here is a very brief explanation of how to do it. The detailed version is here.

For more advanced users there is a drush command line utility available. You will need to install the PHP commandline utility first if you do not have it. i.e.:
apt-get install php5-cli
You can download the latest drush tarball from here . Untar it to the directory of your choice not in your drupal website tree. I used my home directory of /home/victor/ You then need to make a soft link to it so it can be found for use in any directory. i.e. :
ln -s /home/victor/drush/drush /usr/local/bin/drush
There is more info in the file called README.txt about how to use this. If you type at the command prompt:
drush help
you will get a list of commands.

Lastly do not forget Git which is an actually fabulous configuration management control tool written by Linus Torvalds who invented Linux! This way everytime you change a Drupal Module or download a new version, you can always get back to where you started. Regardless if it is an hour ago, a second ago, a month ago or a year ago. When I was a Drupal Administrator this saved our lives many times.
You are done for now. Enjoy!