Installing Moodle on 5.0-Nano
Installing Moodle on 5.0-Nano |
Introduction
This step-by-step guide shows how to install Moodle on Uniform Server V5.0-Nano. In addition shows how to resolve fixed paths allowing Moodle to be run from a USB memory stick.
Windows does not support true cron jobs however V5.0-Nano has an integrated portable Cron catering for both hard drive and USB memory stick installations.
Pre-Installation
Install Uniform server
Download Moodle
Copy files to Uniform Server
|
Switch to production, start servers
UniServer’s default is to use the production PHP configuration file however you may have switched configuration files during development.
Before installing any applications ensure the production configuration is selected.
Check configuration file:
- Start UniTray, in folder UniServer double click on Start.exe tray icon created.
- Check configuration: Left click tray icon > Server Status – Top of page php.ini displays either Production or development.
- If Production displayed no action required you can start servers.
- If development displayed proceed as follows:
- Switch to production, Left click tray icon > Advanced > click php.ini switch to Production.
Start Servers:
- Start Uniform Server. Left click tray icon > click Start UniServer
Create a Moodle Database
Creating the Moodle database is straight forward, tables are automatically inserted during installation
|
Note:
- You can start phpMyAdmin from Apanel, start Apanel by typing http://localhost/apanel/ into your browser address bar.
- From Apanel click on the phpMyAdmin link. (left menu under tools)
Moodle Installation
All that remains is to run the Moodle installer script install.php. Type the following into your browser address bar.
http://localhost/moodle/install.php
Most of the pages display information to proceed to the next page click either next or continue button. Item 4 requires a database user name and password, for a personal installation we are using defaults root and root. The following shows what to expect during installation:
1) Choose a Language: Select your language e.g. English (en) click Next | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2) Checking your PHP Settings: passes all click NEXT Your server should pass all these tests to make Moodle run properly
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3) Please confirm the locations of this Moodle installation:
For a default installation of Uniform Server these are correct (will be different for your installation) click Next | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
4) Database configuration:
Click Next | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
5) Checking your environment:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
6) Download language pack Installation: Option to download a language pack NEXT | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
7) Configuration completed: config.php has been successfully created Continue | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
8) Copyright notice: Have you read these conditions and understood them? YES | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
9) Current release information: Moodle 1.9.5+ (Build: 20091126)(leave Unattended operation un-checked): Continue | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
10) Setting up database: Takes some time wait as the install takes place: Database was successfully updated Continue | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
11) Setting up module tables: Again wait, Workshop tables have been setup correctly Continue | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
12) Setting up plugin tables: Truefalse tables have been set up correctly, Continue | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
13) Upgrading database: Datbase was successfully upgraded Continue | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
14) Upgrading database: Blocks version is now 2007081300 Continue | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
15) Setting up block tables: Continue | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
16) Setting up plugin tables: Paypal tables have been set up correctley Continue | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
17) Setting up plugin tables: xml and other plugins set up correctly Continue | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
18) Setting up plugin tables: xml tables have been set up correctly Continue | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
19) Setting up plugin tables: user tables have been set up correctly Continue | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
20) Setting up plugin tables: stats tables have been set up correctly Continue | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
21) Setting up plugin tables: unittest tables have been set up correctly Continue | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
22) Setup administrator account: Admin set-up: On this page you should configure your main administrator account which will have complete control over the site. Make sure you give it a secure user name and password as well as a valid email address. You can create more admin accounts later on. Fill in details:
Click Update profile | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
23) Front Page settings: This page allows you to configure the front page and name of this new site. You can come back here later to change these settings any time using the Administration menus. Fill in details:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
24) Finished: This is your main admin page you can continue setting up Moodle or log out |
Note: Steps 22-23 I entered dummy information. You can change this information from admin at any time, however make sure you remember your admin password and name.
Stopping Moodle
- Logout from admin
- Stop Uniform Server. Left click tray icon > click Stop UniServer - Second menu item from top
Starting Moodle
- Start UniTray, in folder UniServer double click on Start.exe tray icon created.
- Start Uniform Server. Left click tray icon > click Start UniServer - First menu Item
- In your browser address bar type http://localhost/moodle/
Admin login
- Username: boss
- Password: fred123
Portability - USB Memory Stick
To run Moodle from a Memory stick, copy the folder UniServer and all its content to whatever drive your memory stick is on.
Note: This process is not fast; writing 104 MB (UniServer plus Moodle) took just over 20 minutes. In the same vain do not expect exceptional performance, Moodle uses a large database hence is slow when run from a memory stick. That said I found it just about acceptable.
Hard Coded path
During installation Moodle uses absolute paths (drive letter and folder path to moodle) and hard wires these into a configuration file. This means you cannot move the installation to another location and expect Moodle to run. A solution to this problem requires modifying Moodle's configuration file config.php.
Open the following file in a text editor:
UniServer\www\moodle\config.php
Its a small file locate the following three lines (yours may be slightly different):
$CFG->wwwroot = 'http://localhost/moodle'; $CFG->dirroot = 'C:\moodle_b\UniServer\www\moodle'; $CFG->dataroot = 'C:\moodle_b\UniServer/moodledata';
The hard coded paths start with C: followed by a list of folders to the Moodle installation these hard coded paths prevent portability. Another problem, first line assumes you are running servers on localhost and standard port 80 this becomes an issue if you run move servers (multi-server operation) because it changes all ports.
Solution is to let PHP automatically calculate absolute paths and web-root folder.
Replace the above three lines with the following code:
$splitArray = explode("\\www",__DIR__); // Split at folder www to $base = "$splitArray[0]"; // find drive letter and sub-folders $root = 'http://'.getenv("HTTP_HOST").'/moodle'; // Local testing //$root = 'http://'.GetHostByName($REMOTE_ADDR).'/moodle'; // moving from event to event $CFG->wwwroot = $root; $CFG->dirroot = $base.'\www\moodle'; $CFG->dataroot = $base.'\moodledata';
The above change makes Moodle completely portable.
Tip UniServer on a laptop
I lifted the following tip from gdunc blog, it looks very useful, hence I integrated this into the above:
For those users who use UniServer on a laptop and move from event to event. To allow external users to view your moodle make the following changes:
Change:
$root = 'http://'.getenv("HTTP_HOST").'/moodle'; // Local testing //$root = 'http://'.GetHostByName($REMOTE_ADDR).'/moodle'; // moving from event to event
To:
//$root = 'http://'.getenv("HTTP_HOST").'/moodle'; // Local testing $root = 'http://'.GetHostByName($REMOTE_ADDR).'/moodle'; // moving from event to event
This switches from localhost to your domain.
In addition to allow external access you need to put your servers on-line as follows:
Edit file: UniServer\www\.htaccess
Change these lines:
Order Deny,Allow Deny from all Allow from 127.0.0.1
To:
#Order Deny,Allow #Deny from all #Allow from 127.0.0.1
Move Servers
One of Uniform Server’s unique features is the capability to run more than one complete server on the same PC. When running a server from a USB memory stick you can use this to great advantage and prevent server clashes. You will have noticed UniTray’s icon displays one (meaning standard ports). Moving UniServer increments this digit and so on for each server move. In reality it’s not just a port change but a complete server update, running server status displays the server characteristics.
Move Servers:
- Assumes a new extracted server (see note 1)
- Stop all running Uniform Servers
- Start UniTray, in folder UniServer double click on Start.exe tray icon created.
- Move servers, Left click tray icon > Advanced > click Move Servers multi-server operation.
- In the pop-up window at all prompts press enter to accept defaults.
- The tray icon will display 2, if you already use a server with this number repeat steps 4 and 5 each server must have a unique number.
- After moving the servers you can now install Moodle as explained above.
- However before proceeding you need to use the new server ports for installation.
- To find these: Left click tray icon > Server Status
I moved the servers to icon 3 hence Apache port = 82 and MySQL port = 3308
To start Moodle installation: type http://localhost:82/moodle/install.php into your browser
Database Configuration step 4) Host Server: name becomes: localhost:3308
After installation page access requires the addition of a port number as shown
- Site address: http://localhost:82/moodle/
Note 1:
If you have already installed Moodle on UniServer V5-Nano and want to move the servers it is possible.
- Follow steps 2-6 as above
- Edit file UniServer\www\moodle\config.php
- Assumes you have made the changes as explained in Hard Coded path
- Now locate line (6)
Change line: $CFG->dbhost = 'localhost';
To: $CFG->dbhost = 'localhost:3308'; - Save file.
Use the port number that matches your server, start the servers. Pages are accessible as mentioned above just remember to use the port number that matches your server.
Cron
Moodle has a cron.php script that needs to be periodically run. It takes care of various routine tasks for example unsubscribing inactive members and sending out email messages.
Manualy Run Cron
To keep Moodle happy you need to periodically run the cron.php script.
For a personal implementation of Moodle you can run cron.php occasionally by typing the following into your browser address bar:
http://localhost/moodle/admin/cron.php
Automatically Run Cron
Manually running Cron can become tedious an alternative solution is to use UniServer 5.0-Nano's built in portable-cron.
Enable portable Cron
Edit file: UniServer\unicon\main\run_cron.php
Uncomment this line as shown:
$dummy = file("http://localhost/moodle/admin/cron.php"); // Uncomment to enable
Change the timer to suit application
sleep(15); // Set required delay (seconds)
Run portable Cron
Manually run cron from UniTray
- Start: Left click tray icon > Advanced > click Start Portable Cron
- Stop: Left click tray icon > Advanced > click Stop Portable Cron
Automatically start and stop with servers
Edit file: UniServer\unicon\tray_menu\UniTray1.ini
Locate these lines under [Menu.Left] Menu section (for convenience lines have been split):
Type: item; Caption: "Start UniServer (Apache MySQL)"; Action: shellexecute; FileName: "%PHP%\php.exe"; Parameters: " -n %ServerConMain%\start_servers.php 7";ShowCmd: hidden; Glyph: 9 Type: item; Caption: "Stop UniServer (Apache MySQL)"; Action: shellexecute; FileName: "%PHP%\php.exe"; Parameters: " -n %ServerConMain%\stop_servers.php 7";ShowCmd: hidden; Glyph: 11
- Replace start_servers.php 7 with start_servers.php 23
- Replace stop_servers.php 7 with start_servers.php 23
Note: Values are binary coded
Note: Binary 1+2+4+16 = 23 1 - Run Apache server 2 - Run MySQL server 4 - Start Index page 16 - Run cron
Plugin
The above instructions are generic allowing you to install the latest version of Moodle.
If you prefer a click and go solution go to SourceForge
- Under Plugins
- Navigate to sub-folder Uniform Server 5-Nano Plugins
- Download file V55_Moodle_l_9_5.exe
Save this to folder UniServer, to install double click on file. Moodle is pre-configured and ready to go. Check out the read me file for latest information.
Note: This plugin is intended to quickly get Moodle up and running allowing you to explore the software. If you intend running a production server delete the folders installed and perform a manual install this allows you to tailor Moodle and include any missing modules.
MySQL Security
The above installation guide and associated downloadable plugin are intended to get the application up and running purely for testing.
If you are intending to put the application on line make sure to read any security advice provided with the application and check providers web site.
More impotently the above installation is an extreme security risk if put online as is. Its imperative you secure the MySQL server before putting your servers online.
Please read the following page MySQL Security and restrict privileges to any user that has connection access to your server.
Summary
Although there are a large number of steps Moodle is easy to install on Uniform Server.
Real reason for installing Moodle was to test its compatibility with PHP 5.3.0 and UniServer 5.0-Nano. It takes a lot to impress me; Moodle’s installation ran flawlessly very impressive and a credit to there design team.