For installing moodle first of all you will need clone the repository.

sudo git clone git://

Now you have to copy the cloned repository to /var/www/html. If the directory doesn’t exist then it means you haven’t setup PHP.

Setting up PHP enviornment

For setting up PHP you will also be needing a data base manangement system like mysql and a webserver like Apache.

For installing Mysql 5.

sudo apt-get install mysql-server mysql-client

For installing Apache2.

sudo apt-get install apache2

For installing PHP 7.0

sudo apt-get install php7.0 libapache2-mod-php7.0

After installing you need to restart Apache.

sudo /etc/init.d/apache2 restart

After installing all these you can copy you moodle repository to /var/www/html. You may have issues with the permission of the directory.

chmod -R 777 path/to/your/directory //it gives all the permissions to edit the directory
sudo cp -R /opt/moodle /var/www/html/
Now create a directory for storing Moodle data.
sudo mkdir /var/moodledata

For giving permissions to the directory.

sudo chown -R www-data /var/moodledata
sudo chmod -R 777 /var/moodledata
sudo chmod -R 0755 /var/www/html/moodle

For setting up mySql

mysql -u root -p

Create Moodle data base.

mysql>CREATE DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
mysql>create user 'moodledude'@'localhost' IDENTIFIED BY 'passwordformoodledude';

And restart mysql. Everything will be set up till now. Just open your browser and go to localhost/moodle and follow the steps. You might need to install some PHP modules that will be automatically be listed. For installing the module.

sudo apt-get install php7.0-modulename

If you have any problem in installing Moodle, you can always contact me or post your problem in Moodle disussion forum Someone will definitely help you.