Skip to content

Instantly share code, notes, and snippets.

@rakibulinux
Last active July 7, 2020 22:08
Show Gist options
  • Select an option

  • Save rakibulinux/0fb1b9a8012e0feee84fff86bfedaeb4 to your computer and use it in GitHub Desktop.

Select an option

Save rakibulinux/0fb1b9a8012e0feee84fff86bfedaeb4 to your computer and use it in GitHub Desktop.
Install Forma Learning Management System (LMS) On Ubuntu 18.04 With Apache2, MariaDB And PHP
#!/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 rakib DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
GRANT ALL ON rakib.* TO 'rakib'@'localhost' IDENTIFIED BY 'R@k!b2@19P@';
FLUSH PRIVILEGES;
EXIT;
#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.0 libapache2-mod-php7.0 php7.0-common php7.0-mysql php7.0-gmp php7.0-ldap php7.0-curl php7.0-intl php7.0-mbstring php7.0-xmlrpc php7.0-gd php7.0-bcmath php7.0-xml php7.0-cli php7.0-zip
#You can also install PHP 7.3
sudo apt install php7.3 php7.3-common php7.3-mysql php7.3-gmp php7.3-ldap php7.3-curl php7.3-intl php7.3-mbstring php7.3-xmlrpc php7.3-gd php7.3-bcmath php7.3-xml php7.3-cli php7.3-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
wget -c "https://netcologne.dl.sourceforge.net/project/forma/version-2.x/formalms-v2.3.0.2.zip" -O formalms-v2.3.0.2.zip
sudo unzip -d /var/www/html/forma /tmp/formalms-v2.3.0.2.zip
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 admin@example.com
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