Install LAMP Server Easily using command line

Hello Linux Lovers! The acronym LAMP is derived from first letters of Linux, Apache HTTP Server, Database MySQL, and Language PHP, Perl or Python. We already have shown you how to install LAMP on many platforms. So we can say that LAMP is a combination of operating system and open-source software stack. Lets start the LAMP setup procedure:

1. To install LAMP run the below command:

sudo apt-get install lamp-server^

2. Run the following commands to setup user for your apache server, add permission & enable some modules:

sudo usermod -a -G www-data YOUR_USER_NAME

sudo chgrp -R www-data /var/www

sudo chmod -R g+w /var/www

sudo apt-get install php5-curl

sudo a2enmod rewrite

3. Restart the apache server:

sudo /etc/init.d/apache2 restart

4. We will open the /etc/apache2/apache2.conf file in text editor to enable rewrite options. Run the below command:

sudo gedit /etc/apache2/apache2.conf

and modify the below snap of script.

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted


<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted

You can notice the word “None” to “All”.

Thats all for now. You may need some more configuration on the basis of your project requirements. But for basic web development this is enough. Lets check in your browser by writting the url: http://localhost  & press enter.



To test MySQL run this command:

mysql -u root -p

Share with:

By Shah Alom

Professionally I am a web developer. I am also founder of Micro Solutions Bangladesh.