LAMP stands for Linux, Apache, MySQL and PHP.
However, over the years LAMP refers to any deployment stack involving similar components such as the replacement of PHP with Python.
Additionally, the component does not necessarily have to start with the same letter such as MySQL can be easily replaced by PostgreSQL.
The following is a quick start guide to setup the LAMP environment using Linux Debian, such as Ubuntu.
Update
To make sure that the latest package list is used run the following.
~$ sudo apt-get update
Apache
Apache will be used as the web server so that the PHP web pages can be published through a web browser.
It is also one of the most popular open-source web servers to date and supported by a large community.
1. Open a terminal window and enter the following command:
~$ sudo apt-get install apache2
Enter the root password and the following is displayed.
2. Enter
Y
to accept installing the dependencies and continue the installation.
The progress of the installation is displayed and the prompt should return.
3. Verify the Apache server is running by opening a web browser and navigating to
http://localhost
~$ sudo /etc/init.d/apache2 restart
MySQL
The database will be used to store the application data.
1. Open a terminal window and enter the following command:
~$ sudo apt-get install mysql-server
Enter the root password and the following is displayed.
2. Enter
Y
to accept installing the dependencies and continue the installation.
The progress of the installation is displayed and the MySQL root password prompt should be displayed.
3. Enter the MySQL root user password and enter it again on the next screen to continue the installation.
4. Verify the installation by checking the version number of MySQL from the terminal.
~$ mysql --version
5. The following is optional, but highly recommended to provide added security to the MySQL database server.
~$ sudo mysql_secure_installation
6. Enter the following at the specified prompts:
- Enter current password for root (enter for none): root password
- Change the root password? N
- Remove anonymous users? Y
- Disallow root login remotely? Y
- Remove test database and access to it? Y
- Reload privilege tables now? Y
PHP
This enables PHP development and operation to be possible.
The PHP components and Apache libraries are required in order to render PHP correctly in a web browser.
1. Open a terminal window and enter the following command:
~$ sudo apt-get install php5 libapache2-mod-php5
Enter the root password and the following is displayed.
2. Enter
Y
to accept installing the dependencies and continue the installation.
The progress of the installation is displayed and the prompt should return.
3. Verify the installation by checking the PHP version.
~$ php -v
- Verify that PHP is working correctly.
~$ php -r 'echo "nnPHP is working fine.nnn";'
The following output should be displayed.
PHP is working fine.
Leave a Reply