Showing posts with label Drupal. Show all posts
Showing posts with label Drupal. Show all posts

Monday, July 4, 2011

Backing up a MySQL Database

As I detailed in a previous post, I installed LAMP on my Ubuntu machine (which included MySQL Database version 5.1.49-1ubuntu8.1) for the purpose of hosting a Drupal site.  I installed Drupal 6 for the purpose of playing around with Drupal and writing a blog about my experience.  It occurred to me that I should probably write about my experience with the latest version of Drupal, so I decided to upgrade to Drupal 7.  Before upgrading, I need to back up my site, and that requires backing up the MySQL database.

I had previous installed PHPMyAdmin, so I began investigating a way to back up my database using that tool.  I found an article on Drupal's website that detailed how to backup a MySQL database with PHPMyAdmin.  I followed this article and wrote about my experience below.

To start, I logged on to PHPMyAdmin as root.  I then clicked on the Export tab.
I clicked the Select All link to select all schemas and selected the SQL radio button. 

Under the Options group and under the Structure sub-group, I checked the following:
  • Structure check box
  • check box
  • check box
  • check box
The check box was checked by default, so I left it checked.

Under the Options group and under the Data sub-group, I checked the following:
  • Data check box
  • Complete Inserts check box
  • Use hexadecimal for BLOB check box
  • selected the INSERT option in the Export type select box.
I left everything else at their default settings.

Finally, I clicked the Go button on the bottom-right corner of the screen.  This brought up a screen where I could choose the location of the file.  I selected a location and the file began to download.  

The resulting file contained all necessary statements for creating re-creating my database. 

I have not tried importing this file yet.  That remains for another article.

Thanks for reading.

Sunday, May 22, 2011

Installing LAMP and Drupal on Ubuntu 10.10

I recently wanted to start a personal Drupal site that I can use for information about video games that I play.  I would be the only person administrating the site, and in all probability, I would be the only person viewing the site.  I am also interested in Drupal because we use it at work and I think it would be a good idea to know more about it.

I installed LAMP first.  LAMP is an open source web development platform and consists of Apache, MySQL Database, and PHP.  The L stands for "Linux", and something similar exists for Windows called WAMP.  I found this site that explains how to install LAMP on Ubuntu 10.10 and 11.04.  Most of the information for this post comes from this site.  See the link below:

http://www.unixmen.com/linux-distributions/4-ubuntu/1239-install-lamp-with-1-command-in-ubuntu-1010-maverick-meerkat

First, I installed a software installation package called taskselTasksel groups software by tasks, and it allows you to install packages for a specific task with one command.  So to install tasksel, I used the following command:

sudo apt-get install tasksel

LAMP
Begin the installation of LAMP by running the tasksel program we just installed:

sudo tasksel

I moved the cursor down to "LAMP server" using the arrow keys, selected "LAMP server" using the space bar, and then hit tab to "Ok" and pressed enter.

The installation asked me to enter a root password for the MySQL database.  Other than that the installation of LAMP did not require any interaction on my part.

After installing LAMP your Ubuntu box will be a functioning web server.  You can verify that the installation configured PHP correctly by creating an info.php file:
  • sudo vi /var/www/info.php 
and adding this brief php program to display the results of phpinfo()
  • <?php
  • phpinfo();
  • ?>
Save and exit vi and restart apache2:

  • sudo /etc/init.d/apache2 restart
At this point you should be able to navigate to the page http://localhost/info.php and see PHP info.  You can see screen shots of this page at the link I mentioned above.

PHPMyAdmin

Next, the page mentions installing something called phpmyadminPhpmyadmin allows you to manage your MySQL Database through a web browser.  I love this idea!  So I installed phpmyadmin with the following command:
  • sudo apt-get install phpmyadmin
After installing you should be able to go to http://localhost/phpmyadmin and login using root as the username and the password you specified during the installation of LAMP.  After logging in, you can administrate the local MySQL database.  You will have to create a database here when installing Drupal.

Now we can install Drupal!

Drupal
I followed this guide for the most part and I did not encounter too many problems.  I wrote a brief synopsis of my experience below.

I mentioned that a database had to be created for Drupal.  If you haven't already, log on as root to http://localhost/phpmyadmin.  The place where you create a database should be on the initial screen you see after logging in.  Type the name of the database and click "Create".  You can leave both of the options at their default settings.  Remember the name of this database because you will have to use it when configuring Drupal.

Next you will need to download the files for Drupal.  These files can be found here.  After downloading the correct version (I choose 6.9 so the file name was drupal-6.9.tar.gz) move the file to the document root of the web server( in my case this was /var/www).  Unpack the file using the following command:
  • tar xvzf drupal-6.9.tar.gz
This will create a directory called /var/www/drupal-6.9.  Consider this the Drupal root.  I changed the name to "site" for simplicity sake. 

Navigate to the site http://localhost/site/ to begin the Drupal installation process.  I didn't have a problem with the installation.  I had to change the permissions on a directory and copy a file.  You will have to enter the name of the database you created in the first step.  After completing installation you should be able to navigate to http://localhost/site/ and log in as administrator for further configuration.

Any site that I mention in this post with localhost in it may be different in your case.  In my case I was loading the page from the server itself.  I can also view these pages on a different computer by using the host name or ip address of the web server instead of localhost.

I completed this process in about two hours.  I have been playing around with it but I have not had much luck yet.  I'll post with more info at a later point.

Until next time...