How to install LAMP stack in a single command execution on linux mint 18.3

To install LAMP stack in a single command execution on Linux Mint 18.3

A " LAMP" stack is a group of open source software that is typically installed together to enable a server to host dynamic websites and web apps. This term is actually an acronym which represents the Linux operating system, with the Apache web server. The site data is stored in a MySQL database, and dynamic content is processed by PHP. In this tutorial, we' ll get a LAMP stack installed on Linux Mint 18.3 with single command execution.

Installation

By using the caret symbol at the end, it means we are installing ‘ meta-package’ . Meaning a number of programs that are usually installed together.

linuxhelp ~ # apt-get install lamp-server^
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting ' libhttp-message-perl'  for task ' lamp-server' 
Note, selecting ' libencode-locale-perl'  for task ' lamp-server' 
Note, selecting ' php7.0-cli'  for task ' lamp-server' 
Note, selecting ' mysql-client-5.7'  for task ' lamp-server' 
.
.
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Processing triggers for systemd (229-4ubuntu21) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Processing triggers for libapache2-mod-php7.0 (7.0.25-0ubuntu0.16.04.1) ...

If you try to remove this ‘ meta-package’ you could remove a lot of programs you are not expecting to&hellip SSH being one of them. So please do install your lamp server using these instructions, but do not remove it using lamp-server^

Let' s test the Installation In order to test the Apache installation go to your web browser and navigate your IP or Domain name at the URL http://ipaddress or domain name.

Let' s Test the php now. We want to tell our web server to prefer PHP files, so we' ll make Apache look for an index.php file first.

linuxhelp ~ # vim /etc/apache2/mods-enabled/dir.conf
< IfModule mod_dir.c> 
        DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
< /IfModule> 

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

We want to move the PHP index file index.php above to the first position after the Directory Index specification. When you finished, restart the Apache service using the following command.

linuxhelp ~ # systemctl restart apache2

Let' s test the PHP processing. First, create a file called “ info.php” under HTML root directory.

linuxhelp ~ # vim /var/www/html/info.php
< ?php
phpinfo() 
?> 
~    

When you are finished, save and close the file. Now we can test whether our web server can correctly display content generated by a PHP script. To try this out, we just have to visit this page in our web browser. http://domainname/info.php

Let' s check the MySQL service. In order to do that run the following command.

linuxhelp ~ # systemctl status mysql.service
mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service  enabled  vendor preset: en
   Active: active (running) since Tue 2018-03-20 05:26:45 IST  1min 46s ago
  Process: 1303 ExecStartPost=/usr/share/mysql/mysql-systemd-start post (code=ex
  Process: 1255 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exit
 Main PID: 1302 (mysqld)
   CGroup: /system.slice/mysql.service
           └─1302 /usr/sbin/mysqld

Mar 20 05:26:30 linuxhelp systemd[1]: Starting MySQL Community Server...
Mar 20 05:26:45 linuxhelp systemd[1]: Started MySQL Community Server.

If this was successful, then your PHP is working as expected. That’ s it this is how we install Lamp server in a single command execution on LinuxMint 18.3. With this, the method to install LAMP stack in a single command execution on Linux Mint 18.3 comes to an end.

FAQ
Q
How to install Mysql server on Ubuntu?
A
For the installation of Mysql Server on Ubuntu, use the following command as given below "apt-get install mysql-server"
Q
How to check the enables traffic to ports 80 and 443 in "Apache full" on Ubuntu?
A
For checking the enables traffic to ports 80 and 443 in "Apache full" on Ubuntu, use the command as following "sudo ufw app info "Apache Full""
Q
How to define a Session in LAMP stack?
A
A Session is a method to store some data to be used across multiple pages. In technical terms, it is a logical object that is stored in the server to help you store data and can be accessed across multiple HTTP requests. The session is always temporary based on the session timeout set in your Apache Server.
Q
How you will find the number of elements present in an array in LAMP stack?
A
yes you can choose several applications but it gets insatlled one by one
Q
How to install python setuptools on Ubuntu for LAMP stack?
A
For the installation of python setuptools on Ubuntu for LAMP stack, run the following command on the terminal "sudo apt-get install python-setuptools libapache2-mod-wsgi"