Setup LAMP on Ubuntu Linux for local deployment

Here we’re going to learn how to setup LAMP to start coding PHP using Ubuntu Linux. LAMP is an acronym meaning Linux Apache MySQL PHP. For this tutorial, we’re going to assume you’ve got Ubuntu 12 or 14. Either 12.04/14.04 or 14.04/14.10 will do.

First of all, before you start. You’ll need to be a sudoer in order to perform these commands. Sudoers are basically users with admin rights. Then, you’ll need to run an update sudo apt-get update. Running an update shouldn’t take long.

Apache

Now, you’ll need to install apache. To do this, run sudo apt-get install apache2

MySQL

Version of MySQL may depend on what you need. As of writing this article, the latest version for MySQL is MySQL 5.7. Ubuntu 16 comes with MySQL 5.6. For simplicity, we’re going to install MySQL 5.5. Run the command below

sudo apt-get install mysql-server-5.5 mysql-client-5.5 mysql-common

PHP

Just a heads up for those of you reading this using Ubuntu 16. Ubuntu 16 comes with PHP 7, not PHP 5. Minor tweaks with this command may be needed.

sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt php5-curl php5-cli php5-common php5-json php5-mysql php5-readline

The command provided also installs some PHP modules and components. I work with Laravel, so most of these modules are needed. You can cherry-pick the ones you need.

Note

You might find yourself using htaccess files. So I’d recommend running this command: sudo a2enmod rewrite start

Comments

comments