Note: You are currently viewing documentation for Moodle 1.9. Up-to-date documentation for the latest stable version is available here: Step-by-step Install Guide for Ubuntu using apt-get.

Step-by-step Install Guide for Ubuntu using apt-get: Difference between revisions

From MoodleDocs
(New page: This install option will be useful for someone who is doing a new install on an ubuntu server install. We are assuming that 1) You have done your ubuntu install. 2) You have used apt-get ...)
 
No edit summary
 
(17 intermediate revisions by 8 users not shown)
Line 1: Line 1:
This install option will be useful for someone who is doing a new install on an ubuntu server install. We are assuming that
*Ubuntu provides an integrated Moodle package consistent with other Ubuntu/Debian packages. While the Ubuntu/Debian package may not install the latest cutting-edge development version of Moodle, it is more likely to work well in an Ubuntu system.
1) You have done your ubuntu install.
2) You have used apt-get update and apt-get upgrade to get the latest version.
3) You have a typical ubuntu server edition which just gives you the command line.
4) You have not enabled the root account and do not want to do that.
5) When you installed you opted to have a LAMP install and a mailserver.


First,  
*The Ubuntu/Debian package can be installed using a Package Manager (such as Synaptic Package Manager, Adept Package Manager, or KPackageKit), but installation usually is more transparent and successful when the package is installed (using the apt-get tool) from a command-line interface.


          sudo apt-get install moodle
= Installation from the command-line interface =
*The command-line interface is the default in an Ubuntu server without a desktop, and it is possible, but not recommended, to run Moodle on a standalone server without a desktop. Of course, an Ubuntu or Kubuntu desktop is easily added to a server (using one of the commands: sudo apt-get install ubuntu-desktop or the command sudo apt-get install kubuntu-desktop). From the Ubuntu desktop the command-line interface is reached using Terminal; from a Kubuntu desktop it is reached using Konsole.


During the process that follows you will be asked for some names and passwords for the mysql and moodle accounts.
== Prepare your server ==
*Moodle is meant to be run on a [http://ubuntuguide.org/wiki/Ubuntu:All#Servers server]. It requires Apache2, the PHP scripting language, and a database (either MySQL or postgreSQL). While many users feel postgreSQL is a better database, MySQL is more widely used and is easier for first time users (since there are many integrated packages that use it). A LAMP server (Linux, Apache2, MySQL, PHP) can easily be installed from the command-line interface:
sudo tasksel install lamp-server


If you are using a remote terminal then it needs to be an reasoably capable one, otherwise the installation dialog may not be able to talk to you and you will get an error which mentions the limitations of your terminal.  
When installing the LAMP server, note the MySQL root password carefully. This will be required during Moodle installation.


One terminal that does work is the X terminal on a mac. (Not the terminal program that comes with a mac in the utilities folder but the Xterm that you will have if you installed open office).
*Moodle must know where the server is located. (You must also have a way for other users to reach it.) The FQDN (Fully Qualified Domain Name) refers to the location of the server on which the Moodle database is located. In general, there are two options: localhost (meaning the database will be located on the same computer on which Moodle will be installed) or a URL. (Of course, the URL could still refer to the same computer).
 
Don't worry, whichever option you choose can be changed later. For initial installation, it is easiest to use localhost as the FQDN (and also wherever it is available as an installation option).
 
== Moodle installation ==
Install the Moodle package from the command-line interface and follow the prompts:
sudo apt-get install moodle
 
*Database server software for Moodle: ''mysql-server'' -> follow remainder of instructions. Assuming the database is hosted on the same computer as the one Moodle is being installed upon, accept localhost for the options when prompted.
 
*Edit Moodle configuration options (if needed):
sudo nano /etc/moodle/config.php
 
*Edit Moodle apache2 configuration file (if needed):
sudo nano /etc/moodle/apache.conf
 
*Finish installation through a web browser. (A server without a desktop will not have a web browser. Now you see why it is better to have an Ubuntu or Kubuntu desktop installed on top of the server). I recommend the unattended installation.
:<nowiki>http://localhost/moodle</nowiki>
 
== Set up a virtual server ==
The whole point of Moodle is that users can access it over a network. The easiest way is to set up a URL for your server so that users can reach Moodle using the URL. Several steps are necessary.
 
*Make sure the server on which Moodle is running has a [http://ubuntuguide.org/wiki/Ubuntu:All#Set_a_static_IP_address static IP address] on the LAN.
 
*If you have a router on your network, forward incoming traffic on ports 80 and 443 (http and https) from the router to the (static) LAN IP address of the server hosting Moodle.
 
*The [http://ubuntuguide.org/wiki/Ubuntu:All#Firewall firewall] on the Moodle server should allow all incoming traffic on ports 80 and 443.
 
*A URL for your Moodle site should have been established with a DNS name server on the Internet. It is possible to [http://ubuntuguide.org/wiki/Ubuntu:All#Using_Dynamic_IP_addresses_for_a_webserver use a Dynamic DNS server], as well. An example URL is ''mymoodleserver.dyndns.org''.
 
*A virtual host file in /etc/apache2/sites-available must be created for Moodle.
cd /etc/apache2/sites-available
sudo cp default ''moodlevirtualhost''
 
::It should be edited (sudo nano /etc/apache2/sites-available/''moodlevirtualhost'') to look like
 
<VirtualHost *:80>
ServerAdmin webmaster@''mymoodleserver.dyndns.org''
#
DocumentRoot /usr/share/moodle/
ServerName ''mymoodleserver.dyndns.org''
ServerAlias www.''mymoodleserver.dyndns.org'' ''mymoodleserver.dyndns.org''
#RewriteEngine On
#RewriteOptions inherit
</VirtualHost>
 
Notes: The Rewrite options are listed here only for forward compatibility with Apache rewrite rules. They are only used for multi-site installations and can, in general, remain commented out (with the #).
 
*The virtual host file should be linked to /etc/apache2/sites-enabled and apache2 restarted (sudo etc/init.d/apache2 restart).
sudo ln -s /etc/apache2/sites-available/''moodlevirtualhost'' /etc/apache2/sites-enabled
 
*Edit the /etc/moodle/config.php file (sudo nano /etc/moodle/config.php) so that the FQDN (in this case the URL) is correctly noted.
 
$CFG->wwwroot = 'http://''mymoodleserver.dyndns.org''/moodle';
 
*Login to the Moodle server:
::http://''mymoodleserver.dyndns.org''
 
== Add a custom theme to Moodle ==
*Find free Moodle themes [http://moodle.org/mod/data/view.php?id=6552 here].
 
*Download one. Extract the zip file (by clicking on the filename in Dolphin, for example).
 
*Copy the extracted folder to /usr/share/moodle/theme
 
*From Moodle, install the new theme:
:Moodle -> Appearance -> Themes -> Theme Selector
 
 
= Random unreviewed comments =
(These comments have not been reviewed for accuracy).
== Configuration changes ==
=== Allow access to your Moodle from other computers ===
 
This moodle install will only work from the localhost. To make it accessible from other hosts you must edit the file /etc/apache2/conf.d/moodle. Type
 
sudo nano /etc/apache2/conf.d/moodle
 
(This is actually a soft link from /etc/moodle/apache.conf). This fires up the 'nano' text editor which is command line text editor and the sudo gives you the write access you need.
 
About 10 lines down you see the following line
 
#allow from all
 
The # indicates it is commented out, so remove the # and use CTRL+O to save the file.
 
Now restart apache by typing
 
sudo /etc/init.d/apache2 restart
 
in the terminal. You should now be able to access the moodle from other hosts by doing <nowiki>http://<address of your moodle host>/moodle</nowiki>
 
== Comments ==
(These comments may be inaccurate).
The installation is actually rather better thought out than many installations. For example the apache2 conf file is nicely done.
 
These are the file locations for a default install from apt-get
* moodle site is at /usr/share/moodle
* moodle data folder is at /var/lib/data
* config.php is a soft link in the /usr/share/moodle folder and actually sits in /etc/moodle
 
The file permissions for the site and data folder are:
* user = root, group = root for the site folder,
* user = www-data and group = www-data for the data folder.
 
==See also==
 
* [[Step-by-step Install Guide for Ubuntu|Step-by-step Installation Guide for Ubuntu]] - doing a manual installation on Ubuntu.
* [[Administrator documentation]]
 
[[Category:Administrator]]
[[Category:Installation|Ubuntu]]

Latest revision as of 19:37, 30 June 2010

  • Ubuntu provides an integrated Moodle package consistent with other Ubuntu/Debian packages. While the Ubuntu/Debian package may not install the latest cutting-edge development version of Moodle, it is more likely to work well in an Ubuntu system.
  • The Ubuntu/Debian package can be installed using a Package Manager (such as Synaptic Package Manager, Adept Package Manager, or KPackageKit), but installation usually is more transparent and successful when the package is installed (using the apt-get tool) from a command-line interface.

Installation from the command-line interface

  • The command-line interface is the default in an Ubuntu server without a desktop, and it is possible, but not recommended, to run Moodle on a standalone server without a desktop. Of course, an Ubuntu or Kubuntu desktop is easily added to a server (using one of the commands: sudo apt-get install ubuntu-desktop or the command sudo apt-get install kubuntu-desktop). From the Ubuntu desktop the command-line interface is reached using Terminal; from a Kubuntu desktop it is reached using Konsole.

Prepare your server

  • Moodle is meant to be run on a server. It requires Apache2, the PHP scripting language, and a database (either MySQL or postgreSQL). While many users feel postgreSQL is a better database, MySQL is more widely used and is easier for first time users (since there are many integrated packages that use it). A LAMP server (Linux, Apache2, MySQL, PHP) can easily be installed from the command-line interface:
sudo tasksel install lamp-server

When installing the LAMP server, note the MySQL root password carefully. This will be required during Moodle installation.

  • Moodle must know where the server is located. (You must also have a way for other users to reach it.) The FQDN (Fully Qualified Domain Name) refers to the location of the server on which the Moodle database is located. In general, there are two options: localhost (meaning the database will be located on the same computer on which Moodle will be installed) or a URL. (Of course, the URL could still refer to the same computer).

Don't worry, whichever option you choose can be changed later. For initial installation, it is easiest to use localhost as the FQDN (and also wherever it is available as an installation option).

Moodle installation

Install the Moodle package from the command-line interface and follow the prompts:

sudo apt-get install moodle
  • Database server software for Moodle: mysql-server -> follow remainder of instructions. Assuming the database is hosted on the same computer as the one Moodle is being installed upon, accept localhost for the options when prompted.
  • Edit Moodle configuration options (if needed):
sudo nano /etc/moodle/config.php
  • Edit Moodle apache2 configuration file (if needed):
sudo nano /etc/moodle/apache.conf
  • Finish installation through a web browser. (A server without a desktop will not have a web browser. Now you see why it is better to have an Ubuntu or Kubuntu desktop installed on top of the server). I recommend the unattended installation.
http://localhost/moodle

Set up a virtual server

The whole point of Moodle is that users can access it over a network. The easiest way is to set up a URL for your server so that users can reach Moodle using the URL. Several steps are necessary.

  • If you have a router on your network, forward incoming traffic on ports 80 and 443 (http and https) from the router to the (static) LAN IP address of the server hosting Moodle.
  • The firewall on the Moodle server should allow all incoming traffic on ports 80 and 443.
  • A URL for your Moodle site should have been established with a DNS name server on the Internet. It is possible to use a Dynamic DNS server, as well. An example URL is mymoodleserver.dyndns.org.
  • A virtual host file in /etc/apache2/sites-available must be created for Moodle.
cd /etc/apache2/sites-available
sudo cp default moodlevirtualhost
It should be edited (sudo nano /etc/apache2/sites-available/moodlevirtualhost) to look like
<VirtualHost *:80>
ServerAdmin webmaster@mymoodleserver.dyndns.org
#
DocumentRoot /usr/share/moodle/
ServerName mymoodleserver.dyndns.org
ServerAlias www.mymoodleserver.dyndns.org mymoodleserver.dyndns.org
#RewriteEngine On
#RewriteOptions inherit
</VirtualHost>

Notes: The Rewrite options are listed here only for forward compatibility with Apache rewrite rules. They are only used for multi-site installations and can, in general, remain commented out (with the #).

  • The virtual host file should be linked to /etc/apache2/sites-enabled and apache2 restarted (sudo etc/init.d/apache2 restart).
sudo ln -s /etc/apache2/sites-available/moodlevirtualhost /etc/apache2/sites-enabled
  • Edit the /etc/moodle/config.php file (sudo nano /etc/moodle/config.php) so that the FQDN (in this case the URL) is correctly noted.
$CFG->wwwroot = 'http://mymoodleserver.dyndns.org/moodle';
  • Login to the Moodle server:
http://mymoodleserver.dyndns.org

Add a custom theme to Moodle

  • Find free Moodle themes here.
  • Download one. Extract the zip file (by clicking on the filename in Dolphin, for example).
  • Copy the extracted folder to /usr/share/moodle/theme
  • From Moodle, install the new theme:
Moodle -> Appearance -> Themes -> Theme Selector


Random unreviewed comments

(These comments have not been reviewed for accuracy).

Configuration changes

Allow access to your Moodle from other computers

This moodle install will only work from the localhost. To make it accessible from other hosts you must edit the file /etc/apache2/conf.d/moodle. Type

sudo nano /etc/apache2/conf.d/moodle

(This is actually a soft link from /etc/moodle/apache.conf). This fires up the 'nano' text editor which is command line text editor and the sudo gives you the write access you need.

About 10 lines down you see the following line

#allow from all

The # indicates it is commented out, so remove the # and use CTRL+O to save the file.

Now restart apache by typing

sudo /etc/init.d/apache2 restart

in the terminal. You should now be able to access the moodle from other hosts by doing http://<address of your moodle host>/moodle

Comments

(These comments may be inaccurate). The installation is actually rather better thought out than many installations. For example the apache2 conf file is nicely done.

These are the file locations for a default install from apt-get

  • moodle site is at /usr/share/moodle
  • moodle data folder is at /var/lib/data
  • config.php is a soft link in the /usr/share/moodle folder and actually sits in /etc/moodle

The file permissions for the site and data folder are:

  • user = root, group = root for the site folder,
  • user = www-data and group = www-data for the data folder.

See also