How to Install Moodle LMS on a cPanel Server: A Step-by-Step Guide
If you’re looking to install Moodle LMS on your server, you’re in the right place! In this tutorial, we’ll walk through the process of installing Moodle on a cPanel server. Whether you’re a Moodle administrator, a teacher, or a developer, this guide will help you get Moodle up and running on your web server with ease.
Introduction to Moodle and cPanel
Before we dive in, let me briefly explain what Moodle and cPanel are. Moodle is one of the most popular Learning Management Systems (LMS) used for creating and managing online courses. If you’re unfamiliar with cPanel, it’s a web hosting control panel that simplifies the process of managing your hosting account and websites.
If you’re new to Moodle and haven’t seen my previous tutorial on installing Moodle on a Mac laptop, be sure to check that out too (link below). For those already familiar with cPanel, you’re in exactly the right spot!
Step 1: Log Into cPanel and Create a Subdomain
The first thing you’ll need to do is log into your cPanel account. Once you’re logged in, create a subdomain specifically for Moodle. I strongly recommend setting up Moodle on a subdomain instead of a folder under an existing domain. This will save you from future headaches.
Here’s how to create a subdomain:
- In your cPanel dashboard, locate and click on “Subdomains.”
- Create a new subdomain. For this example, we’ll call it “my Moodle.”
- Once the subdomain is created, cPanel will automatically create a folder for it, which will be where we upload the Moodle files.
Step 2: Download Moodle
Next, we’ll download the Moodle installation files.
- Open a browser and search for “Moodle download.”
- Go to the official Moodle download page and select the version you need. In this case, we’ll be using Moodle 4.0.
- Download either the
.zip
or.tgz
file. Both formats work fine, but I’ll go with the.zip
version for simplicity.
Step 3: Upload Moodle to the Server
Now that we have the Moodle files, let’s upload them to the server.
- In cPanel, go to “File Manager.”
- Navigate to the folder for your subdomain (in our case, it’s
myMoodle
). - Click “Upload” and select the Moodle
.zip
or.tgz
file you downloaded earlier. Once the upload is complete, you’ll see the file in your subdomain folder. - Now, extract the file. Select the compressed file and click “Extract.”
- After extracting, a folder named “moodle” will appear. Move all of the contents up one level so that they are directly in the root of the
myMoodle
folder.
Step 4: Create a MySQL Database
Moodle needs a database to store all your data. To create a MySQL database:
- Go back to cPanel and find the “MySQL Databases” option.
- Click on “MySQL Database Wizard.”
- Name your database (e.g.,
myMoodle
), and then click “Next Step.” - Create a new user for the database. You can name the user anything you like (e.g.,
rickshare_myMoodle
), and make sure to set a strong password. - Once the user is created, grant them “All Privileges” to ensure they can access and modify the database.
Make a note of the database name, username, and password—you’ll need these for the Moodle installation.
Step 5: Begin the Moodle Installation Process
With everything set up, it’s time to run the Moodle installation.
- Open a web browser and visit your new subdomain (e.g.,
myMoodle.ricochet.com
). - Moodle will prompt you to begin the installation process. Select your preferred language and click “Next.”
- The next screen will ask you to confirm the data path. If you’re setting up multiple Moodle instances, it’s a good idea to create a separate “moodledata” folder. Name it something like
myMoodle_data
to keep things organized. - Choose your database type. Most cPanel servers use MySQL, but check if your server uses MariaDB (as is the case with this setup).
- Enter the database details you created earlier—database name, user, and password.
Step 6: Finalizing the Installation
After entering the database information, Moodle will check your server environment to make sure everything is configured properly. If there are any issues (e.g., missing PHP extensions), Moodle will notify you. You may need to enable PHP extensions such as mbstring
, sodium
, or mysqli
in cPanel.
To enable missing extensions:
- In cPanel, go to “Select PHP Version” under the “Software” section.
- Click on “Extensions” and check the boxes for the missing extensions.
Once the installation checks are complete, you’ll proceed with the final steps:
- Create your Moodle admin account (e.g.,
admin
). - Enter your email address and a password for logging in to Moodle.
- Provide a full site name (e.g., “My Moodle”).
- Save the changes and proceed.
Step 7: Set Up Cron Jobs
To ensure Moodle runs smoothly, you need to configure cron jobs for background tasks. This step is essential for tasks like sending emails or performing regular maintenance.
Here’s how to set up cron jobs:
- In cPanel, find “Cron Jobs” under “Advanced.”
- Set the frequency to “Once per minute” by selecting
* * * * *
. - Add the following command (make sure to adjust the path to PHP and Moodle accordingly): swiftCopyEdit
/usr/local/bin/php /home/yourusername/public_html/myMoodle/admin/cli/cron.php
Replace /home/yourusername/public_html/myMoodle/
with your actual path.
Step 8: Verify Installation
Now that the cron job is set up, go back to Moodle and test it by navigating to “Site Administration” and selecting “Scheduled Tasks.” Check the “Last Run” column to ensure the cron jobs are running successfully. If it says “Never,” double-check your cron settings in cPanel.
Conclusion
That’s it! You’ve successfully installed Moodle on your cPanel server. You can now start using it to create and manage online courses. Don’t forget to check out my courses on Moodle, where I dive deeper into using the platform as a teacher, administrator, or developer.
If you encounter any issues along the way, feel free to leave a comment, and I’ll be happy to assist. Happy Moodle-ing!
Explore More:
For more in-depth courses and resources on Moodle, visit the course page below.
Thanks for reading! See you in the next video or post!