cPanel Moodle migration to Bitnami stack
Date Posted : 21/12/2018
How to migrate Cpanel Moodle to Bitnami stack
In this article, we’re going to explain about migrating a cpanel moodle site to bitnami stack
Prerequisites
We assume you have bitnami application up and running
Cpanel backup files and database copied to bitnami server
Backup Existing Data from Cpanel
Copy the web files and moodle data directory from your cpanel server to bitnami server under /backup/cpbackup-username username folder
/home/username/public_html
/home/username/moodledata
Backup Database
1. Login to cPanel
2. Click on Phpmyadmin
3. Select username_moodle database
4. Click on “Export” Database
5. On the resulting page, select the “Quick” export method and the “SQL” output format
6. Click “Go”
7. An SQL export file will be created and downloaded to your desktop. Store this file carefully, as you will need it if you plan to later import the database back into MySQL.
You need to copy this database to bitnami server
Stop bitnami apache service
sudo /opt/bitnami/ctlscript.sh stop apache
Rename existing bitnami installation
mv /opt/bitnami/apps/moodle/htdocs/ /opt/bitnami/apps/moodle/htdocs-OLD
mv /opt/bitnami/apps/moodle/moodledata /opt/bitnami/apps/moodle/moodledata-OLD
Upload and extract backups which you taken from cPanel server
cp -pr /backup/cpbackup-username/public_html/* /opt/bitnami/apps/moodle/htdocs/
cp -pr /backup/cpbackup-username/moodledata/* /opt/bitnami/apps/moodle/moodledata/
Update Moodle variables in config.php
$CFG->wwwroot = 'http://learn.pheonixsolutions.com';
$CFG->dataroot = '/opt/bitnami/apps/moodle/moodledata';
$CFG->directorypermissions = 02775;
Apply valid ownership to run under bitnami user
chown bitnami:daemon /opt/bitnami/apps/moodle/htdocs/ -R
chown bitnami:daemon /opt/bitnami/apps/moodle/moodledata -R
chown daemon:daemon /opt/bitnami/apps/moodle/moodledata/sessions/ -R
Change permissions for moodledata directory and its sub folders
chmod 2775 /opt/bitnami/apps/moodle/moodledata
cd /opt/bitnami/apps/moodle/moodledata
find . -type d -exec chmod 2775 {} \;
Start bitnami apache service
sudo /opt/bitnami/ctlscript.sh start apache
You should have all the Moodle components upgraded and ready to use.