When we install LAMP Stack on Linux machines especially on Ubuntu 16.04/18.04, you have to read many blogs/articles to get the required information. To get rid of this hurdle, I’ve written this article to explain each and everything at one place to install the LAMP stack on Linux Machine.
Note: In order to run commands to install LAMP stack you need root access of server.
Step 1: Update your package manager
console.log( 'Code is Poetry' );
Step2: Install Apache Web server
$ sudo apt-get install apache2
Start the Apache server:
$ sudo service apache2 start
Stop the Apache server:
$ sudo service apache2 stop
Restart the Apache server:
$ sudo service apache2 restart
To check status of the Apache server:
$ sudo service apache2 status
Sample Output
● apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: active (running) since Tue 2018-04-23 14:28:43 EDT; 45s ago
Docs: man:systemd-sysv-generator(8)
Process: 13581 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
Process: 13605 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)
Tasks: 6 (limit: 512)
CGroup: /system.slice/apache2.service
├─13623 /usr/sbin/apache2 -k start
├─13626 /usr/sbin/apache2 -k start
├─13627 /usr/sbin/apache2 -k start
├─13628 /usr/sbin/apache2 -k start
├─13629 /usr/sbin/apache2 -k start
└─13630 /usr/sbin/apache2 -k start
http://localhost
http://127.0.0.1
http://your_server_ip
Step3: Installing Mysql
$ sudo apt-get install mysql-server
Testing your MySQL installation:
Run below command to check MySQL is successfully configured
$ sudo mysql -u root -p
Start the MySQL server:
$ sudo mysql -u root -p
Stop the MySQL server:
$ sudo service mysql stop
Restart the MySQL server:
$ sudo service mysql restart
To check status of the MySQL server:
$ sudo service mysql status
Step4: Installing PHP
$ sudo apt-get install php
Install common PHP modules like bcmath, bz2, intl, gd, mbstring, zip.
Run following commands to install
$ sudo apt-get install php-bcmath
$ sudo apt-get install php-bz2
$ sudo apt-get install php-intl
$ sudo apt-get install php-gd
$ sudo apt-get install php-mbstring
$ sudo apt-get install php-zip
$ php -v
Conclusion
This article will help people to install LAMP stack on Linux machine especially Ubuntu 16.04/18.04 without spending too much time reading many blogs/articles.
If you have suggestions or any question please mention in comment.