{"id":2655,"date":"2024-02-13T21:48:45","date_gmt":"2025-06-27T00:07:28","guid":{"rendered":""},"modified":"2025-08-09T13:21:44","modified_gmt":"2025-08-09T12:21:44","slug":"how-to-install-moodle-lms-on-ubuntu-24-04-server-2","status":"publish","type":"post","link":"https:\/\/netcloud24.com\/knowledgebase\/how-to-install-moodle-lms-on-ubuntu-24-04-server-2\/","title":{"rendered":"Linux VPS &#038; VPS Windows Setup Guide | NetCloud24 Moodle LMS on Ubuntu 24.04 Server"},"content":{"rendered":"<p><html lang=\"en\"><br \/>\n<head><br \/>\n    <meta charset=\"UTF-8\"><br \/>\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><br \/>\n    <title>How to Install Moodle LMS on Ubuntu 24.04 Server Using Windows VPS<\/title><\/p>\n<style>\n        body { font-family: Arial, sans-serif; line-height: 1.6; margin: 20px; }\n        h1, h2, h3 { color: #333; }\n        code { background: #f4f4f4; padding: 2px 4px; border-radius: 4px; }\n        pre { background: #f4f4f4; padding: 10px; border-left: 5px solid #ccc; overflow-x: auto; }\n        ul { list-style-type: disc; margin-left: 20px; }\n        a { color: #0066cc; text-decoration: none; }\n        a:hover { text-decoration: underline; }\n        .promo { background: #e6f3ff; padding: 15px; margin: 20px 0; border-radius: 5px; }\n    <\/style>\n<p><\/head><br \/>\n<body><\/p>\n<h1>How to Install Moodle LMS on Ubuntu 24.04 Server Using Windows VPS<\/h1>\n<p>Moodle is a powerful open-source Learning Management System (LMS) used for creating and managing online courses. This guide provides step-by-step instructions for installing Moodle on an Ubuntu 24.04 server hosted on a Windows VPS using multiple methods: manual setup, Docker, Ansible, Kubernetes, and Terraform. Additionally, we\u2019ll configure Let\u2019s Encrypt for SSL and set up a domain. For reliable VPS hosting, consider <a href=\"https:\/\/us.netcloud24.com\/\">Netcloud24<\/a> for robust Windows VPS solutions.<\/p>\n<div class=\"promo\">\n<h3>Power Your Moodle LMS with Netcloud24<\/h3>\n<p>Host your Moodle LMS on a high-performance Windows VPS from Netcloud24. Explore our services in your region:<\/p>\n<ul>\n<li><a href=\"https:\/\/ie.netcloud24.com\">United States (EN)<\/a><\/li>\n<li><a href=\"https:\/\/uk.netcloud24.com\/\">United Kingdom<\/a><\/li>\n<li><a href=\"https:\/\/ca.netcloud24.com\/\">Canada<\/a><\/li>\n<li><a href=\"https:\/\/fr.netcloud24.com\/\">France<\/a><\/li>\n<li><a href=\"https:\/\/de.netcloud24.com\/\">Germany<\/a><\/li>\n<li><a href=\"https:\/\/es.netcloud24.com\/\">Spain<\/a><\/li>\n<li><a href=\"https:\/\/it.netcloud24.com\/\">Italy<\/a><\/li>\n<li><a href=\"https:\/\/pt.netcloud24.com\/\">Portugal<\/a><\/li>\n<li><a href=\"https:\/\/nl.netcloud24.com\/\">Netherlands<\/a><\/li>\n<li><a href=\"https:\/\/sk.netcloud24.com\/\">Slovakia<\/a><\/li>\n<li><a href=\"https:\/\/cz.netcloud24.com\/\">Czech Republic<\/a><\/li>\n<\/ul><\/div>\n<h2>Prerequisites<\/h2>\n<ul>\n<li>Ubuntu 24.04 VPS (e.g., from <a href=\"https:\/\/us.netcloud24.com\/\">Netcloud24<\/a>)<\/li>\n<li>SSH access and root or sudo privileges<\/li>\n<li>A registered domain name<\/li>\n<li>Basic knowledge of Linux commands<\/li>\n<\/ul>\n<h2>Method 1: Manual Setup<\/h2>\n<h3>Step 1: Update System and Install Dependencies<\/h3>\n<pre>\r\nsudo apt update && sudo apt upgrade -y\r\nsudo apt install -y apache2 php php-mysql php-xml php-mbstring php-curl php-zip php-gd php-intl mysql-server unzip git\r\n    <\/pre>\n<h3>Step 2: Install Moodle<\/h3>\n<pre>\r\ncd \/var\/www\/html\r\nsudo git clone -b MOODLE_404_STABLE git:\/\/git.moodle.org\/moodle.git moodle\r\nsudo chown -R www-data:www-data moodle\r\nsudo chmod -R 755 moodle\r\n    <\/pre>\n<h3>Step 3: Configure MySQL<\/h3>\n<pre>\r\nsudo mysql -u root -p\r\nCREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;\r\nCREATE USER 'moodleuser'@'localhost' IDENTIFIED BY 'YourSecurePassword';\r\nGRANT ALL PRIVILEGES ON moodle.* TO 'moodleuser'@'localhost';\r\nFLUSH PRIVILEGES;\r\nEXIT;\r\n    <\/pre>\n<h3>Step 4: Configure Moodle<\/h3>\n<p>Copy the sample config file and edit it:<\/p>\n<pre>\r\ncd \/var\/www\/html\/moodle\r\nsudo cp config-dist.php config.php\r\nsudo nano config.php\r\n    <\/pre>\n<p>Update the database settings in <code>config.php<\/code>:<\/p>\n<pre>\r\n$CFG->dbtype    = 'mysqli';\r\n$CFG->dblibrary = 'native';\r\n$CFG->dbhost    = 'localhost';\r\n$CFG->dbname    = 'moodle';\r\n$CFG->dbuser    = 'moodleuser';\r\n$CFG->dbpass    = 'YourSecurePassword';\r\n$CFG->wwwroot   = 'http:\/\/yourdomain.com';\r\n$CFG->dataroot  = '\/var\/moodledata';\r\n    <\/pre>\n<p>Create the data directory:<\/p>\n<pre>\r\nsudo mkdir \/var\/moodledata\r\nsudo chown -R www-data:www-data \/var\/moodledata\r\nsudo chmod -R 755 \/var\/moodledata\r\n    <\/pre>\n<h3>Step 5: Complete Installation<\/h3>\n<p>Access <code>http:\/\/yourdomain.com<\/code> in a browser and follow the Moodle setup wizard.<\/p>\n<h2>Method 2: Docker Setup<\/h2>\n<h3>Step 1: Install Docker<\/h3>\n<pre>\r\nsudo apt install -y docker.io\r\nsudo systemctl enable docker\r\nsudo systemctl start docker\r\n    <\/pre>\n<h3>Step 2: Run Moodle with Docker<\/h3>\n<pre>\r\nsudo docker run -d --name moodle -p 80:80 -e MOODLE_DB_HOST=mysql -e MOODLE_DB_USER=moodleuser -e MOODLE_DB_PASSWORD=YourSecurePassword -e MOODLE_DB_NAME=moodle bitnami\/moodle\r\nsudo docker run -d --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=YourSecurePassword -e MYSQL_DATABASE=moodle -e MYSQL_USER=moodleuser -e MYSQL_PASSWORD=YourSecurePassword mysql:8\r\n    <\/pre>\n<p>Access Moodle at <code>http:\/\/yourdomain.com<\/code>.<\/p>\n<h2>Method 3: Ansible Setup<\/h2>\n<h3>Step 1: Install Ansible<\/h3>\n<pre>\r\nsudo apt install -y ansible\r\n    <\/pre>\n<h3>Step 2: Create Ansible Playbook<\/h3>\n<pre>\r\nmkdir moodle-ansible && cd moodle-ansible\r\nnano moodle.yml\r\n    <\/pre>\n<p>Add the following to <code>moodle.yml<\/code>:<\/p>\n<pre>\r\n---\r\n- hosts: all\r\n  become: yes\r\n  tasks:\r\n    - name: Update apt cache\r\n      apt:\r\n        update_cache: yes\r\n    - name: Install required packages\r\n      apt:\r\n        name: \"{{ packages }}\"\r\n        state: present\r\n      vars:\r\n        packages:\r\n          - apache2\r\n          - php\r\n          - php-mysql\r\n          - mysql-server\r\n          - git\r\n    - name: Clone Moodle\r\n      git:\r\n        repo: 'git:\/\/git.moodle.org\/moodle.git'\r\n        dest: \/var\/www\/html\/moodle\r\n        version: MOODLE_404_STABLE\r\n    - name: Set permissions\r\n      file:\r\n        path: \/var\/www\/html\/moodle\r\n        owner: www-data\r\n        group: www-data\r\n        mode: '0755'\r\n        recurse: yes\r\n    <\/pre>\n<h3>Step 3: Run Playbook<\/h3>\n<pre>\r\nansible-playbook moodle.yml\r\n    <\/pre>\n<h2>Method 4: Kubernetes Setup<\/h2>\n<h3>Step 1: Install Kubernetes<\/h3>\n<pre>\r\nsudo apt install -y kubeadm kubectl kubelet\r\nsudo kubeadm init\r\nmkdir -p $HOME\/.kube\r\nsudo cp -i \/etc\/kubernetes\/admin.conf $HOME\/.kube\/config\r\nsudo chown $(id -u):$(id -g) $HOME\/.kube\/config\r\n    <\/pre>\n<h3>Step 2: Deploy Moodle<\/h3>\n<pre>\r\nkubectl apply -f https:\/\/raw.githubusercontent.com\/moodle\/moodle-docker\/master\/k8s\/moodle-deployment.yaml\r\nkubectl apply -f https:\/\/raw.githubusercontent.com\/moodle\/moodle-docker\/master\/k8s\/moodle-service.yaml\r\n    <\/pre>\n<p>Access Moodle via the service endpoint provided by Kubernetes.<\/p>\n<h2>Method 5: Terraform Setup<\/h2>\n<h3>Step 1: Install Terraform<\/h3>\n<pre>\r\nsudo apt install -y terraform\r\n    <\/pre>\n<h3>Step 2: Create Terraform Configuration<\/h3>\n<pre>\r\nmkdir moodle-terraform && cd moodle-terraform\r\nnano main.tf\r\n    <\/pre>\n<p>Add the following to <code>main.tf<\/code> (example for AWS, adjust for your provider):<\/p>\n<pre>\r\nprovider \"aws\" {\r\n  region = \"us-east-1\"\r\n}\r\nresource \"aws_instance\" \"moodle\" {\r\n  ami           = \"ami-0c55b159cbfafe1f0\" # Ubuntu 24.04 AMI\r\n  instance_type = \"t2.medium\"\r\n  tags = {\r\n    Name = \"Moodle-Server\"\r\n  }\r\n  user_data = <<-EOF\r\n              #!\/bin\/bash\r\n              apt update &#038;&#038; apt upgrade -y\r\n              apt install -y apache2 php php-mysql mysql-server\r\n              git clone -b MOODLE_404_STABLE git:\/\/git.moodle.org\/moodle.git \/var\/www\/html\/moodle\r\n              EOF\r\n}\r\n    <\/pre>\n<h3>Step 3: Apply Terraform<\/h3>\n<pre>\r\nterraform init\r\nterraform apply\r\n    <\/pre>\n<h2>Configuring Let\u2019s Encrypt SSL<\/h2>\n<h3>Step 1: Install Certbot<\/h3>\n<pre>\r\nsudo apt install -y certbot python3-certbot-apache\r\n    <\/pre>\n<h3>Step 2: Obtain and Install SSL Certificate<\/h3>\n<pre>\r\nsudo certbot --apache -d yourdomain.com\r\n    <\/pre>\n<p>Follow the prompts to configure SSL. Certbot will automatically update Apache configuration.<\/p>\n<h2>Adding a Domain<\/h2>\n<p>Update your domain\u2019s DNS records to point to your VPS\u2019s public IP address. For Apache, configure a virtual host:<\/p>\n<pre>\r\nsudo nano \/etc\/apache2\/sites-available\/moodle.conf\r\n    <\/pre>\n<p>Add the following:<\/p>\n<pre>\r\n<VirtualHost *:80>\r\n    ServerName yourdomain.com\r\n    DocumentRoot \/var\/www\/html\/moodle\r\n    <Directory \/var\/www\/html\/moodle>\r\n        Options Indexes FollowSymLinks\r\n        AllowOverride All\r\n        Require all granted\r\n    <\/Directory>\r\n<\/VirtualHost>\r\n    <\/pre>\n<p>Enable the site and reload Apache:<\/p>\n<pre>\r\nsudo a2ensite moodle.conf\r\nsudo systemctl reload apache2\r\n    <\/pre>\n<h2>Conclusion<\/h2>\n<p>You\u2019ve now learned how to install Moodle LMS on an Ubuntu 24.04 Windows VPS using manual setup, Docker, Ansible, Kubernetes, and Terraform, along with Let\u2019s Encrypt SSL and domain configuration. For a seamless hosting experience, choose <a href=\"https:\/\/us.netcloud24.com\/\">Netcloud24<\/a> for your VPS needs, offering reliable performance across multiple regions.<\/p>\n<div class=\"promo\">\n<h3>Why Choose Netcloud24?<\/h3>\n<p>Netcloud24 provides high-performance VPS solutions tailored for applications like Moodle. Visit our regional sites for more details:<\/p>\n<ul>\n<li><a href=\"https:\/\/us.netcloud24.com\/\">United States<\/a><\/li>\n<li><a href=\"https:\/\/ca.netcloud24.com\/\">Canada<\/a><\/li>\n<li><a href=\"https:\/\/uk.netcloud24.com\/\">United Kingdom<\/a><\/li>\n<li><a href=\"https:\/\/fr.netcloud24.com\/\">France<\/a><\/li>\n<li><a href=\"https:\/\/de.netcloud24.com\/\">Germany<\/a><\/li>\n<\/ul><\/div>\n<p><\/body><br \/>\n<\/html><\/p>\n<div class=\"post-author-box\" style=\"border-top:1px solid #ddd;margin-top:20px;padding-top:15px;\">\n<p><strong>Author:<\/strong> \u0141ukasz Bodziony<\/p>\n<p><strong>Website:<\/strong> <a href=\"https:\/\/ca.netcloud24.com\" target=\"_blank\" rel=\"dofollow\">Windows VPS<\/a><\/p>\n<p><em>\u0141ukasz Bodziony is the CEO and founder of <a href=\"https:\/\/netcloud24.com\" target=\"_blank\" rel=\"dofollow\">NETCLOUD24<\/a>, a global VPS hosting brand proudly originating from Poland. With extensive experience in cloud computing, virtualization, and server management, he delivers high-performance <strong>Windows VPS<\/strong> and <strong>Remote Desktop Services (RDS)<\/strong> solutions to clients across Europe, North America, and beyond.<\/em><\/p>\n<p><em>His expertise covers a wide range of technologies, including <strong>Microsoft Azure<\/strong>, <strong>Proxmox VE<\/strong>, <strong>Amazon Web Services (AWS)<\/strong>, and numerous other virtualization and cloud platforms.<\/em><\/p>\n<p><em>Beyond running his hosting business, \u0141ukasz also provides <strong>professional paid server configuration and optimization services<\/strong> for companies and individuals. Outside of work, he is dedicated to caring for his children and building a secure future for them.<\/em><\/p>\n<p><em>If you are interested in working with him or need expert assistance with your hosting, cloud environment, or server setup, feel free to reach out via <a href=\"https:\/\/ca.netcloud24.com\" target=\"_blank\" rel=\"dofollow\">Windows VPS<\/a>.<\/em><\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>How to Install Moodle LMS on Ubuntu 24.04 Server Using Windows VPS How to Install Moodle LMS on Ubuntu 24.04 Server Using Windows VPS Moodle is a powerful\u2026<\/p>\n","protected":false},"author":1,"featured_media":3421,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[14,12,11,23,20,21,22,17,7,8,6,10,18,19,15,24,16,5,13,9],"class_list":["post-2655","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-cheapvps","tag-cloudvps","tag-hostingvps","tag-rds","tag-rdscal","tag-remotedesktop","tag-remotedesktopvps","tag-servervps","tag-ukvps","tag-virtualserver","tag-vpshosting","tag-vpsserver","tag-vpssolutions","tag-vpswindows","tag-vpswithwindows","tag-windowsrds","tag-windowsserver","tag-windowsvps","tag-windowsvpshosting","tag-windowsvpsuk"],"jetpack_publicize_connections":[],"_links":{"self":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/2655","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/comments?post=2655"}],"version-history":[{"count":2,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/2655\/revisions"}],"predecessor-version":[{"id":3575,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/2655\/revisions\/3575"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/media\/3421"}],"wp:attachment":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/media?parent=2655"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/categories?post=2655"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/tags?post=2655"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}