https://www.youtube.com/watch?v=O4BU14qbTag&t=257s
sudo apt update
Go to Moodle.org then Downloads
Go to Other releases supported: https://download.moodle.org/releases/supported/
Download the TGZ
Copy the link using click here to download manually
wget https://download.moodle.org/download.php/direct/stable501/moodle-latest-501.tgz
sudo mv moodle-latest-501.tgz /var/www/html/
tar -xf moodle-latest-501.tgz
ls
ip a
Update Web Server Root:
- If using Apache / cPanel: Update the
DocumentRootdirective in your Apache configuration file or.htaccessso it points to the/publicdirectory (e.g.,/var/www/html/moodle/public)
If Using Apache (VPS or Dedicated Server)
You need to update the VirtualHost configuration file via SSH.
- Open your config file: Locate your site's configuration file (usually found in
/etc/apache2/sites-available/on Ubuntu/Debian or/etc/httpd/conf.d/on CentOS/RHEL). - Edit the DocumentRoot: Find the
DocumentRootdirective and update it to point to the public folder.apache<VirtualHost *:80> ServerName yourdomain.com DocumentRoot /var/www/html/moodle/public <Directory /var/www/html/moodle/public> AllowOverride All Require all granted </Directory> </VirtualHost>Use code with caution. - Restart Apache: Save the file and run
sudo systemctl restart apache2(Ubuntu) orsudo systemctl restart httpd(CentOS) to apply the changes. [1, 2, 3, 4, 5]
To help you map this out correctly, could you tell me:
- Are you on a VPS/Dedicated server or Shared cPanel hosting?
- Is this for your primary domain or a subdomain?
- What CMS or framework (like Moodle) are you configuring
<?php // Moodle configuration file
unset($CFG);
global $CFG;
$CFG = new stdClass();
// 1. DATABASE SETUP
$CFG->dbtype = 'mysqli'; // options: 'mysqli', 'mariadb', 'pgsql', 'sqlsrv', 'oci'
$CFG->dblibrary = 'native'; // 'native' is required
$CFG->dbhost = 'localhost'; // database server hostname or IP address
$CFG->dbname = 'moodle_db'; // name of your Moodle database
$CFG->dbuser = 'moodle_user'; // database username
$CFG->dbpass = 'secure_password_here'; // database user password
$CFG->prefix = 'mdl_'; // prefix for database tables
$CFG->dboptions = array (
'dbpersist' => 0,
'dbport' => '',
'dbsocket' => '',
'dbcollation' => 'utf8mb4_unicode_ci', // recommended collation for MySQL/MariaDB
);
// 2. WEB ROOT URL
// Must be an exact, fixed public URL. Do not use dynamic PHP server hooks here.
$CFG->wwwroot = 'https://yourmoodle.com';
// 3. FILE SYSTEM PATHS
// Path to the primary Moodle web directory
$CFG->dirroot = '/var/www/html/moodle';
// Path to data files. MUST be outside the public web server directory.
$CFG->dataroot = '/var/moodledata';
// 4. SITE PERMISSIONS & CACHING
$CFG->directorypermissions = 0777;
// 5. EXECUTE MOODLE CORE SETUP
// Crucial: No trailing white spaces or line breaks are allowed after the final internal code logic.
require_once(__DIR__ . '/lib/setup.php');
To remove a current Moodle installation from Ubuntu completely, you need to delete three main components: the Moodle code directory, the Moodle data directory, and the database. [1, 2]
Here is how to do it in 4 simple steps:
1. Back up your site
If you need to keep your courses, take a backup of your
moodledata folder and use mysqldump to export your database before deleting anything.2. Remove the Moodle code folder
bash
sudo rm -rf /var/www/html/moodle
Use code with caution.
3. Remove the Moodle data folder
bash
sudo rm -rf /var/moodledata
Use code with caution.
4. Delete the database
0 Comments