Skip to content

Instantly share code, notes, and snippets.

@LinauxTerminology
Last active February 10, 2021 10:39
Show Gist options
  • Save LinauxTerminology/8a74d4037dd5bceac7e29c492b539b13 to your computer and use it in GitHub Desktop.
Save LinauxTerminology/8a74d4037dd5bceac7e29c492b539b13 to your computer and use it in GitHub Desktop.
Install Forma Learning Management System (LMS) On Ubuntu With Apache2, MariaDB And PHP
#!/bin/bash
#Install Apache2
sudo apt update
sudo apt upgrade
sudo apt install apache2
sudo ufw allow in "Apache Full"
apache2 -v
sudo service apache2 start
sudo systemctl enable apache2
sudo service apache2 stop
sudo nano /etc/apache2/apache2.conf
Add this line:
ServerName 127.0.1.1
ctrl+s and ctrl+x
sudo service apache2 start
sudo service apache2 restart
sudo service apache2 status
# Visit: http://localhost/
#Install MySQL
sudo apt-get install mysql-server mysql-client
sudo mysql_secure_installation
mysql --version
nano /etc/mysql/mysql.conf.d/mysqld.cnf
# And then change the bind-address line to 0.0.0.0
# Save and exit
sudo service mysql start
sudo service mysql enable
sudo service mysql restart
sudo service mysql status
ufw allow from any to any port 3306 proto tcp
sudo systemctl restart mysql
sudo mysql
CREATE DATABASE forma;
CREATE USER 'ulms'@'localhost' IDENTIFIED WITH mysql_native_password BY '01722G@usia';
ALTER USER 'ulms'@'localhost' IDENTIFIED WITH mysql_native_password BY '01722G@usia';
GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT on *.* TO 'ulms'@'localhost' WITH GRANT OPTION;
use forma;
FLUSH PRIVILEGES;
exit
sudo service mysql restart
#Install PHP 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.2 libapache2-mod-php7.2 php7.2-common php7.2-mysql php7.2-gmp php7.2-ldap php7.2-curl php7.2-intl php7.2-mbstring php7.2-xmlrpc php7.2-gd php7.2-bcmath php7.2-xml php7.2-cli php7.2-zip
sudo apt update
sudo update-alternatives --set php /usr/bin/php7.2
sudo a2enmod php7.2
sudo systemctl restart apache2
#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.2/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 [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