Created
June 7, 2021 16:28
-
-
Save LinuxFintech/b82c82e71b63318a4893231d56e1b42c to your computer and use it in GitHub Desktop.
Install Forma Learning Management System (LMS) On Ubuntu With Apache2, MariaDB And PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Install Apache2 | |
sudo apt update | |
sudo apt install apache2 | |
sudo systemctl start apache2.service | |
sudo systemctl enable apache2.service | |
sudo systemctl restart apache2.service | |
#Install MariaDB | |
sudo apt-get install mariadb-server mariadb-client | |
sudo systemctl start mariadb.service | |
sudo systemctl enable mariadb.service | |
sudo systemctl status mariadb.service | |
#Secure MariaDB | |
sudo mysql_secure_installation | |
#When prompted, answer the questions below by following the guide. | |
Enter current password for root (enter for none): Just press the Enter | |
Set root password? [Y/n]: Y | |
New password: Enter any password | |
Re-enter new password: Repeat same password | |
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 | |
#Now that MariaDB is installed, to test whether the database server was successfully installed | |
sudo mysql -u root -p | |
CREATE DATABASE arif DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; | |
GRANT ALL ON arif.* TO 'uarif'@'localhost' IDENTIFIED BY 'A@H!b2@12A@'; | |
use arif; | |
FLUSH PRIVILEGES; | |
EXIT; | |
sudo service mysql restart | |
#Install PHP 7.3 With Modules | |
sudo apt-get update && apt-get upgrade | |
sudo apt-get install software-properties-common | |
sudo add-apt-repository ppa:ondrej/php | |
sudo apt-get update | |
sudo apt install php7.4 libapache2-mod-php7.4 php7.4-common php7.4-mysql php7.4-gmp php7.4-ldap php7.4-curl php7.4-intl php7.4-mbstring php7.4-xmlrpc php7.4-gd php7.4-bcmath php7.4-xml php7.4-cli php7.4-zip | |
#Change PHP default configuration file for Apache2. The lines below is a good settings for most PHP based LMS… Update the configuration file with these and save | |
sudo gedit /etc/php/7.0/apache2/php.ini | |
file_uploads = On | |
allow_url_fopen = On | |
short_open_tag = On | |
memory_limit = 256M | |
upload_max_filesize = 100M | |
max_execution_time = 360 | |
date.timezone = America/Chicago | |
#Now Save and Exit | |
sudo systemctl restart apache2.service | |
#Install PHPMyAdmin | |
sudo apt-get install phpmyadmin php-mbstring php-gettext -y | |
#Make sure to select No | |
#add this line "Include /etc/phpmyadmin/apache.conf" at /etc/apache2/apache2.conf | |
#/etc/init.d/apache2 restart | |
#Now Download Forma LMS Latest Release | |
cd /tmp | |
# Download forma LMS https://sourceforge.net/projects/forma/files/latest/download | |
#unzip and keep forma under /var/www/html/forma/ | |
sudo chown -R www-data:www-data /var/www/html/forma/ | |
sudo chmod -R 755 /var/www/html/forma/ | |
#Configure Apache2 for FormaLMS | |
sudo nano /etc/apache2/sites-available/forma.conf | |
<VirtualHost *:80> | |
ServerAdmin [email protected] | |
DocumentRoot /var/www/html/forma/formalms | |
ServerName localhost | |
ServerAlias www.localhost.com | |
<Directory /var/www/html/forma/formalms/> | |
Options FollowSymlinks | |
AllowOverride All | |
Require all granted | |
</Directory> | |
ErrorLog ${APACHE_LOG_DIR}/error.log | |
CustomLog ${APACHE_LOG_DIR}/access.log combined | |
<Directory /var/www/html/forma/formalms/> | |
RewriteEngine on | |
RewriteBase / | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule ^(.*) index.php [PT,L] | |
</Directory> | |
</VirtualHost> | |
#Now save and Exit | |
#Enable the Forma and Rewrite Module | |
sudo a2ensite forma.conf | |
sudo a2enmod rewrite | |
sudo systemctl restart apache2.service | |
#Now finished the Installation Process. Visit you installed site. | |
http://localhost | |
#You will be prompted to download the config.php file and save in Forma root directory… | |
sudo cp ~/Downloads/config.php /var/www/html/forma/formalms/ | |
#Now you can delete the install folder. | |
sudo rm -rf /var/www/html/forma/formalms/install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment