How to install LAMP on Debian
Installing LAMP might seem hard at first look. But if you do it one step at a time it won't be much of a problem. In this tutorial you will find out how to install Apache, PHP, MySQL and phpMyAdmin on deb-based linux systems (Debian, Ubuntu, Mint).
Let's install apache first. To do it run:
sudo apt-get install apache2
Apache will run as soon as it's installed. In the terminal you will see "Starting web server apache2" message.
To manage Apache you can use apache2ctl tool. With it's help you can, for example, check on Apache web sever current status. To do it run
You can also use commands like:
sudo apache2ctl stop
sudo apache2ctl start
sudo apache2ctl restartto stop, run or restart Apache.
To make sure Apache works navigate to http://localhost in your browser. If the installation was a success you will see the page saying "it works!".
To install PHP run:
sudo apt-get install php5 libapache2-mod-php5
After the installation Apache usualy restarts itself, but if it didn't, run:
sudo apache2ctl restart
To install MySQL run:
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
After the installation the dialog will pop up where you will need to enter the password for MySQL root. MySQL creates root user automatically. What you need to do is to enter the password for MySQL root and confirm it. It's recommended to use different password for system root and MySQL root.
With phpMyAdmin you can manage MySQL database from your browser. To install PhpMyAdmin run
sudo apt-get install phpmyadmin
In the end of the installation the dialog will pop up. Choose apache2.
Then you will be offered to create PhpMyAdmin database.
After that you will need to enter the password for database administrator.
Finally you will be asked to enter the password to finish the registration of PhpMyAdmin. You don't have to actually do it as PhpMyAdmin will create one itself for its internal usage.
Now you have LAMP installed and you can proceed to its further configuration. To check if things went OK navigate to http://localhost/phpmyadmin in your browser. You should get to PhpMyAdmin login page where you need to enter root user and MySQL root password to start working with the database.
That's the basics of installing LAMP on deb-based linux systems.
This work is licensed under a Creative Commons Attribution-NoDerivs 3.0 United States License.
Good job! thanks
Since this is LAMP stack we are talking about, shouldn't you explain how to install MySQL instead of PHPMyAdmin? I also heard that PHPMyAdmin is not as secure as MySQL. There are risks of SQL injection may be. For MySQL, there is a guide in this tutorial that you can follow: https://www.cloudways.com/blog/install-lamp-on-debian/
Got a comment?
All Rights Reserved.