Moodle Installation (MariaDB)
Tue Aug 14, 2018 7:16 am
Install Moodle CMS on Ubuntu 18.04 LTS with Nginx, MariaDB and PHP 7.1 Support
Step 1: Prepare Ubuntu 18.04 LTS
sudo apt update && sudo apt dist-upgrade && sudo apt autoremove
Step 2: Install Nginx HTTP Server
sudo apt install nginx
Nginx commands : sudo systemctl stop nginx.service sudo systemctl start nginx.service sudo systemctl enable nginx.service
Step 3: Install MariaDB Database Server
sudo apt install mariadb-server mariadb-client
Maria commands : sudo systemctl stop mariadb.service sudo systemctl start mariadb.service sudo systemctl enable mariadb.service
sudo mysql_secure_installation
When prompted, answer the questions below by following the guide.
Enter current password for root (syntaXerror): Just press the Enter Set root password? [Y/n]: Y New password: comP(#) Re-enter new password: comP(#) Remove anonymous users? [Y/n]: Y Disallow root login remotely? [Y/n]: Y Remove test database and access to it? [Y/n]: Y Reload privilege tables now? [Y/n]: Y
Open MySQL default configuration file.
sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
Add the below lines just below [mysqld] section.
default_storage_engine = innodb innodb_file_per_table = 1 innodb_file_format = Barracuda innodb_large_prefix = 1
Restart MariaDB server
sudo systemctl restart mariadb.service
Create a blank Moodle database in MariaDB.
sudo mysql -u root -p
CREATE DATABASE moodle;
Create a database user called moodleuser with password comP(#)
CREATE USER 'moodleuser'@'localhost' IDENTIFIED BY 'comP(#)';
Grant the user full access to the database.
GRANT ALL ON moodle.* TO 'moodleuser'@'localhost' IDENTIFIED BY 'comP(#)' WITH GRANT OPTION;
Save changes and exit.
FLUSH PRIVILEGES; EXIT;
Step 4: Install PHP7.1-FPM and Related PHP Modules
PHP 7.1 if not be available in Ubuntu default repositories get it from third-party repositories.
sudo apt-get install software-properties-common sudo add-apt-repository ppa:ondrej/php
sudo apt update
Install PHP 7.1 and related modules.
sudo apt install php7.1-fpm php7.1-common php7.1-mbstring php7.1-xmlrpc php7.1-soap php7.1-gd php7.1-xml php7.1-intl php7.1-mysql php7.1-cli php7.1-mcrypt php7.1-ldap php7.1-zip php7.1-curl
Open PHP-FPM default file.
sudo nano /etc/php/7.1/fpm/php.ini
Change the following lines below in the file and save. You may increase the values of the environment.
file_uploads = On allow_url_fopen = On memory_limit = 256M upload_max_filesize = 64M max_execution_time = 360 cgi.fix_pathinfo = 0 date.timezone = America/Chicago
Step 5: Downloading Moodle
cd /tmp && wget https://download.moodle.org/download.php/direct/stable33/moodle-latest-33.tgz
Run the commands below to extract the downloaded file to Nginx default root.
tar -zxvf moodle-latest-33.tgz
sudo mv moodle /var/www/html/moodle
Change modify the directory permission.
sudo chown -R www-data:www-data /var/www/html/moodle/ sudo chmod -R 755 /var/www/html/moodle/
Step 6: Configure Nginx Moodle Site
sudo nano /etc/nginx/sites-available/moodle
Copy and paste the content below into the file and save it.
server {
listen 80; listen [::]:80; root /var/www/html/moodle; index index.php index.html index.htm; server_name localhost 172.16.21.xxx;
location / { try_files $uri $uri/ =404; }
location /dataroot/ { internal; alias /var/www/html/moodledata/; }
location ~ [^/]\.php(/|$) {
include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.1-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
}
Save the file and exit.
Step 7: Enable the Moodle site VirtualHost.
sudo ln -s /etc/nginx/sites-available/moodle /etc/nginx/sites-enabled/
Step 8 : Restart Nginx
sudo systemctl restart nginx.service
Open browser and browse
http://localhost or http://172.16.21.xxx
Choose the database type and click Next.
Type the database name, username and the password for the user and continue.
Complete all the info and save.
Enjoy!
Step 1: Prepare Ubuntu 18.04 LTS
sudo apt update && sudo apt dist-upgrade && sudo apt autoremove
Step 2: Install Nginx HTTP Server
sudo apt install nginx
Nginx commands : sudo systemctl stop nginx.service sudo systemctl start nginx.service sudo systemctl enable nginx.service
Step 3: Install MariaDB Database Server
sudo apt install mariadb-server mariadb-client
Maria commands : sudo systemctl stop mariadb.service sudo systemctl start mariadb.service sudo systemctl enable mariadb.service
sudo mysql_secure_installation
When prompted, answer the questions below by following the guide.
Enter current password for root (syntaXerror): Just press the Enter Set root password? [Y/n]: Y New password: comP(#) Re-enter new password: comP(#) Remove anonymous users? [Y/n]: Y Disallow root login remotely? [Y/n]: Y Remove test database and access to it? [Y/n]: Y Reload privilege tables now? [Y/n]: Y
Open MySQL default configuration file.
sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
Add the below lines just below [mysqld] section.
default_storage_engine = innodb innodb_file_per_table = 1 innodb_file_format = Barracuda innodb_large_prefix = 1
Restart MariaDB server
sudo systemctl restart mariadb.service
Create a blank Moodle database in MariaDB.
sudo mysql -u root -p
CREATE DATABASE moodle;
Create a database user called moodleuser with password comP(#)
CREATE USER 'moodleuser'@'localhost' IDENTIFIED BY 'comP(#)';
Grant the user full access to the database.
GRANT ALL ON moodle.* TO 'moodleuser'@'localhost' IDENTIFIED BY 'comP(#)' WITH GRANT OPTION;
Save changes and exit.
FLUSH PRIVILEGES; EXIT;
Step 4: Install PHP7.1-FPM and Related PHP Modules
PHP 7.1 if not be available in Ubuntu default repositories get it from third-party repositories.
sudo apt-get install software-properties-common sudo add-apt-repository ppa:ondrej/php
sudo apt update
Install PHP 7.1 and related modules.
sudo apt install php7.1-fpm php7.1-common php7.1-mbstring php7.1-xmlrpc php7.1-soap php7.1-gd php7.1-xml php7.1-intl php7.1-mysql php7.1-cli php7.1-mcrypt php7.1-ldap php7.1-zip php7.1-curl
Open PHP-FPM default file.
sudo nano /etc/php/7.1/fpm/php.ini
Change the following lines below in the file and save. You may increase the values of the environment.
file_uploads = On allow_url_fopen = On memory_limit = 256M upload_max_filesize = 64M max_execution_time = 360 cgi.fix_pathinfo = 0 date.timezone = America/Chicago
Step 5: Downloading Moodle
cd /tmp && wget https://download.moodle.org/download.php/direct/stable33/moodle-latest-33.tgz
Run the commands below to extract the downloaded file to Nginx default root.
tar -zxvf moodle-latest-33.tgz
sudo mv moodle /var/www/html/moodle
Change modify the directory permission.
sudo chown -R www-data:www-data /var/www/html/moodle/ sudo chmod -R 755 /var/www/html/moodle/
Step 6: Configure Nginx Moodle Site
sudo nano /etc/nginx/sites-available/moodle
Copy and paste the content below into the file and save it.
server {
listen 80; listen [::]:80; root /var/www/html/moodle; index index.php index.html index.htm; server_name localhost 172.16.21.xxx;
location / { try_files $uri $uri/ =404; }
location /dataroot/ { internal; alias /var/www/html/moodledata/; }
location ~ [^/]\.php(/|$) {
include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.1-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
}
Save the file and exit.
Step 7: Enable the Moodle site VirtualHost.
sudo ln -s /etc/nginx/sites-available/moodle /etc/nginx/sites-enabled/
Step 8 : Restart Nginx
sudo systemctl restart nginx.service
Open browser and browse
http://localhost or http://172.16.21.xxx
Choose the database type and click Next.
Type the database name, username and the password for the user and continue.
Complete all the info and save.
Enjoy!
- jhllmxxr
- Posts : 1
Join date : 2018-08-17
Re: Moodle Installation (MariaDB)
Fri Aug 17, 2018 8:44 am
E: Sub-process /usr/bin/dpkg returned an error code (1)
what should i do?
what should i do?
- PasserbyGuru
- Posts : 11
Join date : 2018-08-17
Re: Moodle Installation (MariaDB)
Fri Aug 17, 2018 9:04 am
Thank you for posting this! It helped me a lot and I completely installed MOODLE. Thank you!
- PasserbyGuru
- Posts : 11
Join date : 2018-08-17
Re: Moodle Installation (MariaDB)
Fri Aug 17, 2018 9:19 am
- PasserbyGuru
- Posts : 11
Join date : 2018-08-17
Re: Moodle Installation (MariaDB)
Fri Sep 07, 2018 8:26 am
Having trouble with that. All I did was to.
Open terminal of ubuntu
sudo nautilus
go to /var/www/html/
then create a folder of moodledata
sudo chown -R www-data:www-data /var/www/html/moodledata/
sudo chmod -R 755 /var/www/html/moodledata/
Hope that helps!
Permissions in this forum:
You cannot reply to topics in this forum
|
|