Setting Up #Moodle with #MariaDB on AntiX Linux

As I shared previously, I’ve been experimenting with AntiX Linux distro, a version of Linux intended for slower machines. I’m liking it better than Peppermint and Lubuntu, my top two favorites. It’s always a risk to deviate from UbuntuLinux distros, which I’m very comfortable with having used them for years, but Debian/Mepis distros aren’t too far off the beaten path.

Since I wanted to install Apache, MySQL (or rather, MariaDB which replaces MySQL since Oracle bought MySQL out), PHP, I decided to start that process.

Here are my notes on that process:

1) Install AMP on AntiX
Use meta-install (command line) or from Accessories–>Meta-Package Install from the Fluxbox menu on AntiX to get Apache, MySQL, PHP installed

Notice you have many options here…the one we’re interested in is Server, second from the bottom of the list.

Simply click on the checkbox next to Server option in the window shown above, then click Install and wait patiently. You’ll be asked to enter your MySQL root password. Note that phpmyadmin is installed as well and will be available at http://localhost/phpmyadmin

2) Install php5 stuff to ensure compatibility with Moodle.
sudo apt-get install php5-curl php5-xmlrpc php5-gd php5-intl libapache2-mod-php5 libapache2-mod-ruby libapache2-mod-python php5 php5-common php5-dev php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-mysql php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl libapache2-mod-php5

Restart the web server with the command below:

sudo /etc/init.d/apache2 restart

3) Install MariaDB so as to replace MySQL.
This was a bit confusing for me, but…mostly because I wasn’t familiar with how AntiX stores it’s repositories. I was accustomed to working with ONE file for repositories (/etc/apt/sources.list) but AntiX actually stores several files. In the end, this approach makes more sense to me.

At the command line type:
lsb_release -a  – this command will tell you what Debian distro you have. Here’s what I saw when I typed it on my AntiX install:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 7.0 (wheezy)
Release: 7.0
Codename: wheezy

Notice that Debian wheezy is what you have…keep that in mind.

cd /etc/apt/sources.list.d  – this command will switch you over to the appropriate directory.

sudo leafpad mariadb.list – this command will open the leafpad text editor and create a file called “mariadb.list” which is where we’ll put the info we’re going to copy from the next step.

Switch to your Internet browser, and go to this web site.
https://downloads.mariadb.org/mariadb/repositories/

You will be asked to make some choices…here’s what they look like:

You just choose a distro (e.g. Debian), a release (wheezy), a version (e.g. 10 (the 5.5 didn’t work for me), and a mirror (e.g. I chose the one with the American flag, osuosl).

Scroll down and you will see more info:

Paste the code below into that leafpad text editor window you started earlier for the mariadb.list file:
# MariaDB 10.0 repository list - created 2013-02-17 14:18 UTC
# http://mariadb.org/mariadb/repositories/
deb http://ftp.osuosl.org/pub/mariadb/repo/10.0/debian wheezy main
deb-src http://ftp.osuosl.org/pub/mariadb/repo/10.0/debian wheezy main


Exit Leafpad text editor, saving the mariadb.list file. If you type ls -lh you will get a directory listing showing the mariadb.list file:

type the following at the command line:

sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db

sudo apt-get update

sudo apt-get install python-software-properties

To complete the install, type the following:

sudo apt-get install mariadb-server – this will install MariaDB server. You will be notified that MySQL will be removed, but…no problem. You will also be asked to type in the root password for your MariaDB just like you did with MySQL.

After that, you can go to http://localhost/phpmyadmin and verify that MariaDB is working…here’s what it looks like:
3) Optimize your PHP.ini file settings
Type the following at the command line:
sudo leafpad /etc/php5/apache2/php.ini – This will open up your php.ini configuration settings so you can make the following modifications:
  • display_errors = Off
  • display_startup_errors = Off
  • register_globals = Off
  • post_max_size = 2000M
  • mysql.connect_timeout = -1
  • max_execution_time = 5000
  • max_input_time = 5000
  • memory_limit = 2000M
  • file_uploads = On
  • upload_max_filesize = 2000M
  • Save the file and restart Apache web server with the command:

    sudo /etc/init.d/apache2 restart

    4) Create your Moodle database, as well as a user who can access it, using phpmyadmin 
    Open your web browser and go to http://localhost/phpmyadmin
    Some points to keep in mind…choose utf8_general_ci collation type while creating your database, and create a localhost-only user (e.g. moodleuser) that has complete rights on the database.

    5) Install Moodle
    The rest of these instructions are consistent with stuff I’ve written before…so I’m just copying-n-pasting those here:
    a) Create Moodledata folder
    You will need to create a MoodleData directory. Here’s the command to do it:

    sudo mkdir /var/moodledata

    Since I like to put all my Moodle instances’ MoodleData folders as subdirectories of MoodleData, I would create new subdirectories in the following way:

    sudo mkdir /var/moodledata/sandbox

    If I needed to assign write access, I would probably do something like the following:

    sudo chmod -R 777 /var/moodledata

    b) Download the Moodle installation file
    From the command line, you can download the Moodle installation file. For example:

    wget “http://download.moodle.org/download.php/stable24/moodle-latest-24.zip”

    should enable you to download the Moodle file. Once downloaded, you can unzip the file in this way:

    unzip moodle-latest-24.zip

    By the way, if the wget command pulls up a blank file (not one that is 30-40 megs in size), you may want to get the direct link for the Moodle install file download (click on the regular link and then before it starts to download, copy-n-paste the link for “direct link”). I sometimes use a URL shortener (goo.gl) to get a shorter link to work with if I have to type, rather than copy-n-paste, the link into the Terminal window.

    c) Create folder where Moodle PHP files will be stored.
    To create the folder where you will store the Moodle PHP files–these are the files you extracted after downloading and unzipping the file from above. You can create the folder with this command:

    sudo mkdir /var/www/sandbox

    where sandbox is the name of the proposed Moodle instance.

    Then copy the contents of your downloaded, unzipped Moodle install file with this command:

    sudo cp -rv /home/yourusername/moodle/* /var/www/sandbox/

    d) Begin the web-based install process
    Go to your web browser and type in the URL of the server, or, if on your own computer, type

    http://localhost/sandbox

    You should see the start of the Moodle installation. Follow the steps suggested. After you’ve installed Moodle, you should see everything pop up as normal.

    e) Configuring Moodle (View Video Walkthrough)
    After the installation of Moodle, you’ll be asked to do some configuration of Moodle. 
    1. Session Handling (View Video) – How to Deploy Multiple Moodle Instances on one server with different cookies
    2. Setting Up CRON Jobs (View Video: Part 1 | Part 2) – Read more about what is Cron. Use the Moodle Cron package. The simplest way is to use this little package MoodleCron-Setup.exe, which makes this whole thing very easy by installing a small Windows service. Run it and forget about it! 🙂
    3. Managing Courses
      1. Course Default Settings with a quick overview of group settings (View Video)
      2. Course Categories (View Video)
      3. Backing Up and/or Duplicating from Restored Course (View Video)
      4. Restoring Courses (View Video)
    Some additional topics:
    C. Moodle User Authentication (View Video Walkthrough) – How do users login to Moodle?

    D. Adding Modules/Blocks/Themes to Moodle 
    1. How to Install Blocks/Modules into Moodle
    2. How to Install Themes into Moodle
    Step 7 – Cron Job Setup
    Your Moodle will need to occasionally run cron jobsWhy is the cron job important? 

    Cron assists some of Moodle’s modules to perform tasks on a scheduled basis. For example, the cron process might tell Moodle to check all discussion forums so it can mail out copies of new posts to people who have subscribed to that forum. The primary Moodle script that does all this is located in the admin directory, and is called cron.php. However, it can not tell itself to run, so you need to set up a mechanism where this script is run regularly (eg every five or ten minutes). This provides a “heartbeat” so that the script can perform functions at periods defined by each module.
    Read Cron – MoodleDocs

    You can edit the cron job in the following way:

    env EDITOR=nano crontab -e

    Paste in a modified line of instructions for every Moodle instance you have running on the server:

    */10 * * * * wget -q -O /dev/null “http://localhost/sandbox/admin/cron.php”

    Note that this line of instruction will run the cron job every 10 minutes. There are other ways of accomplishing this task, so be open to the possibilities!

    To edit cron jobs, go to /etc/cron.weekly, /etc/cron.hourly, /etc/cron.monthly. For example:

    cd /etc/cron.weekly

    Optional Step A – OPENSSH
    If you want to have a secure (SSL) installation of Moodle–which may result in a performane hit–or simply do SSL for your Moodle logins, you will need to take the following step BEFORE (although I did it after as long as you are comfortable moving (mv) files and folders around) your start installing Moodle. Please note that I found this tutorial helpful for moving beyond this point.

    sudo apt-get install openssh-server unattended-upgrades 

    These steps are relevant and I encourage you to follow this tutorial in two parts…Be aware that the original info is offline, so this is my Evernote copy of it..Thanks, Evernote!)




    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

    var _gaq = _gaq || []; _gaq.push([‘_setAccount’, ‘UA-3445626-5’]); _gaq.push([‘_setDomainName’, ‘mguhlin.org’]); _gaq.push([‘_trackPageview’]); (function() { var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true; ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’; var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s); })();

    Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out / Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out / Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out / Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out / Change )

    Connecting to %s

    %d bloggers like this: