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).
Installing Apache
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
apache2ctl status
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!".
Installing PHP
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
Installing MySQL
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.
Installing PhpMyAdmin
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.
Got a comment?