Installation on Ubuntu using Git
Introduction
This is probably an unrealistic scenario but it stemmed from a question asked in the forums and the results might be useful to others. This was done on Mythbuntu 10.10. Mythbuntu is one of the Ubuntu derivatives, in this case providing a Linux based TV package. It comes with PHP, Apache and MySQL installed having its own web-based controller.
There was no intention to provide a fully secured production server. This just gets basic Moodle working on 'localhost'.
This should also work fine for ordinary Ubuntu with the noted changes.
Install Mythbuntu
- Install Mythbuntu or ordinary Ubuntu Desktop using (if in doubt) default settings
- Log in and exit MythTV application (using Escape Key) (not on Ubuntu)
- Mythbuntu: Run Firefox and ensure that 'mythweb' is running at localhost (proving the web server is running)
Basic Setup
- Open a terminal window (from Applications>Accessories)
- become root (and stay there right through this), install some additional software (git and php extras Moodle needs):
sudo su (you will need to enter your password) apt-get update apt-get install git git-core git-doc apt-get install php5-gd php5-curl php5-intl php5-xmlrpc
if ordinary ubuntu add the following to the above list
apt-get install php5 mysql-server mysql-client apache2 php5-mysql
- On Ubuntu (only), go to http://localhost/ and make sure you see 'It works!'
Install Moodle code
We're going to use Git to pull the latest code. You could just download it, but this is more fun! The chmod is so the installer can write the config file.
cd /var/www git clone git://git.moodle.org/moodle.git chmod 0777 moodle
- The moodle code location (for installation) is /var/www/moodle
Create the data area
You can create this where you like (more or less) but I will do...
mkdir /var/moodledata chmod 0777 /var/moodledata
- The moodle data location (for installation) is /var/moodledata
Create the database
You will need the root database password. Unless you have changed it, this is same as your login password (or whatever you set up when you installed MySQL above).
mysql -u root -p (asks for password here) mysql> create database moodle default character set utf8; mysql> grant all on moodle.* to moodleuser@localhost identified by 'mypassword'; mysql> exit
Notes:
- don't type 'mysql>', that's just the prompt from the mysql client.
- The grant command creates the MySQL account 'moodleuser' with the supplied password and gives it rights to the moodle database all in one command.
- Set 'mypassword' to something you make up. This is the password for your moodle database
- When you install moodle the database is called 'moodle', the database user 'moodleuser' and the password as above
Configure apache
NOTE TO UBUNTU USERS: If you are following these instructions for vanilla Ubuntu then you can ignore this step. The default Apache configuration will 'just work'.
Apache is configured for mythweb so needs a small tweak to work:
cd /etc/apache2/sites-enabled
Use your favourite editor to edit the file default-mythbuntu. After the closing </Directory> on (or about) line 15 add:
<Directory /var/www/moodle/> DirectoryIndex index.php order allow,deny allow from all </Directory>
make sure you do not add any spaces in 'allow,deny'. Save and exit.
Restart Apache:
/etc/init.d/apache2 restart
(A force-reload will not be enough).
Install Moodle
Open Firefox and go to address http://localhost/moodle You should be able to install Moodle using the information indicated above
and finally
chmod 0755 /var/www/moodle exit
a quick note on updating
Because we installed using Git, updating Moodle becomes surprisingly simple. Using the repository we did gives you the latest weekly at any time. If it matters, do a backup first then:
sudo su chmod /var/www/moodle git pull exit
Then go to the Site administration > Notifications page in Moodle to complete the upgrade.
Troubleshooting
- Most errors will turn up in the web server logs. Always check there first - /var/log/apache2/errors.log
- If you need to change things like file upload sizes you need to edit /etc/php5/apache2/php.ini and then restart the web server with 'sudo /etc/init.d/apache2 restart'