Sunday, April 10, 2011

Moodle on ICE - Installing LAMP and #Moodle on @PeppermintOS ICE (Updated)


Below are some instructions for installing Apache, MySQL, and PHP on UbuntuLinux. I stole them from this web site--HowToForge--just in case their site disappears, I'll still have the notes. I'm grateful to them. Usually, I use XAMPP on UbuntuLinux but someone told me, "It's so easy, you have to do it." Ok, so I'm going through and following the directions.

I've modified the directions for Peppermint ICE install. Note that "leafpad" is a text editor; on Ubuntu, you would use gedit instead.
  1. Install Apache web server - sudo apt-get install apache2
  2. Verify installation by going to http://localhost on your browser. If you get a message of "IT works" you're doing fine.
  3. Install PHP - sudo apt-get install php5 libapache2-mod-php5
  4. Restart Apache web server so that it recognizes PHP - sudo /etc/init.d/apache2 restart
  5. Test your PHP
    1. sudo leafpad /var/www/testphp.php
    2. Type in the following line into the file that opens up - (note that below is a graphic...I couldn't get blogger to display code):
    3. Save and close the file
    4. In your web browser, type http://localhost/testphp.php
    5. If something like this shows up, you're OK.
  6. Install MySQL database
    1. sudo apt-get install mysql-server
      1. You'll be asked to enter the root user password. Don't mess this up since it's pretty important.
    2. sudo leafpad /etc/mysql/my.cnf
    3. Change the line reading "bind-address =" to reflect your IP address. This presumes a static IP. (Note: I omitted this step without incident)
  7. Install phpMyAdmin, a tool to administer your MySQL databases. I love this tool and it's well worth it. You can also use other tools like SQLYog, which runs on Linux under WINE.
    1. sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin
      1. Note that you may be asked to pick which server to administer with phpMyAdmin; choose Apache2.
      2. You may also be asked to have a database installed and configured..."Configure database for phpmyadmin with dbconfig-common? " Select YES as the response.
      3. You will be asked for the password of the database's administrative user. That's your root password that you typed in earlier.
      4. You will also be asked to setup a phpmyadmin password...type in a good password.
    2. sudo leafpad /etc/php5/apache2/php.ini
  8. Restart the server with this command - sudo /etc/init.d/apache2 restart
  9. You can find where to put web folders (e.g. Moodle install folder) at /var/www
    1. You can get to that folder by typing cd /var/www and then you can get to work!
    2. You'll have to adjust the permissions on any folders you make, such as using a command like sudo chmod 777 -R training assuming that training is the folder for a Moodle. After that you can copy contents into that folder as a regular user. If on a production server, you may want to adjust those permissions from 777 to something else (suggestions?).
I've omitted a few steps that weren't relevant or unnecessary. The install worked great! 

To setup Moodle 1.9.11+, I downloaded a copy and then took these steps:
  1. Copied the contents of the Moodle zip file (unzipped it first, of course) into the training directory
  2. In the /var folder, I created a folder entitled with the command sudo mkdir moodledata
  3. I used the sudo chmod 777 -R moodledata to change it so it was "write-able" (that is, data could be saved to it.
  4. I changed into that folder by typing cd moodledata and then made another folder, mkdir training_data to house the moodledata (e.g. documents, files) for the Training moodle I'd created.
  5. Went to http://localhost/training and voila, up popped the Moodle for installation.
Total time? An hour to do the install and type this blog entry. Not bad. Now, what I wonder about is how to add ldap support to PHP and all the other fun stuff (zend_optimizer). I'll leave that for another day.

Updated to include Moodle 2.0 Install on 04/23/2011:
To install Moodle 2.0.x, I had to take the following added steps:

  1. sudo apt-get install php5-xmlrpc
  2. sudo aptitude install php5-curl
  3. sudo apt-get install php5-intl
The benefit of doing that is that instead of a server check that fails, you see something like the following:

And, you're able to move on!

Some reminders:

To restart your server, type:

sudo /etc/init.d/apache2 restart

To stop your server, type:
sudo /etc/init.d/apache2 stop

To start your server for the first time, type:
sudo /etc/init.d/apache2 start

Get Blog Updates via Email!
Enter your email address:
Delivered by FeedBurner

Everything posted on Miguel Guhlin's blogs/wikis are his personal opinion and do not necessarily represent the views of his employer(s) or its clients. Read Full Disclosure

1 comment:

Kendall said...

sudo tasksel install lamp-server


Genuine Leadership #4: Gratitude