Install LAMP ( Linux, Apache, MySQL, PHP ) in ubuntu in single command
Install LAMP ( Linux, Apache, MySQL, PHP ) in Ubuntu server:
Please use the following command to install the LAMP ( Linux, Apache, MySQL, Php ) server.
1 |
sudo apt-get install lamp-server^ |
Above lamp-server^ package is Meta package, Means it includes many other packages. It will install Apache, MySQL, PHP and few PHP modules and all other dependencies. So that we can get rid of manual installation of each package.
Lamp Install – Sample Output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
root@test:~# sudo 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' Note, selecting 'libapache2-mod-php' for task 'lamp-server' Note, selecting 'rename' for task 'lamp-server' Note, selecting 'mysql-server-5.7' for task 'lamp-server' Note, selecting 'php-common' for task 'lamp-server' Note, selecting 'libaprutil1' for task 'lamp-server' Note, selecting 'mysql-server' for task 'lamp-server' Note, selecting 'php7.0-opcache' for task 'lamp-server' Note, selecting 'libcgi-fast-perl' for task 'lamp-server' Note, selecting 'libwrap0' for task 'lamp-server' Note, selecting 'libhttp-date-perl' for task 'lamp-server' Note, selecting 'perl-modules-5.22' for task 'lamp-server' Note, selecting 'liblwp-mediatypes-perl' for task 'lamp-server' Note, selecting 'libfcgi-perl' for task 'lamp-server' Note, selecting 'libcgi-pm-perl' for task 'lamp-server' Note, selecting 'libaprutil1-dbd-sqlite3' for task 'lamp-server' Note, selecting 'php7.0-common' for task 'lamp-server' Note, selecting 'libaio1' for task 'lamp-server' Note, selecting 'libio-html-perl' for task 'lamp-server' Note, selecting 'ssl-cert' for task 'lamp-server' Note, selecting 'apache2-data' for task 'lamp-server' Note, selecting 'libperl5.22' for task 'lamp-server' Note, selecting 'libapr1' for task 'lamp-server' Note, selecting 'libaprutil1-ldap' for task 'lamp-server' Note, selecting 'libhtml-tagset-perl' for task 'lamp-server' Note, selecting 'mysql-client-core-5.7' for task 'lamp-server' Note, selecting 'php7.0-json' for task 'lamp-server' Note, selecting 'php7.0-readline' for task 'lamp-server' Note, selecting 'tcpd' for task 'lamp-server' Note, selecting 'liblua5.1-0' for task 'lamp-server' Note, selecting 'mysql-common' for task 'lamp-server' Note, selecting 'libhtml-template-perl' for task 'lamp-server' Note, selecting 'libtimedate-perl' for task 'lamp-server' Note, selecting 'apache2-bin' for task 'lamp-server' Note, selecting 'perl' for task 'lamp-server' Note, selecting 'apache2' for task 'lamp-server' Note, selecting 'php-mysql' for task 'lamp-server' Note, selecting 'apache2-utils' for task 'lamp-server' Note, selecting 'libhtml-parser-perl' for task 'lamp-server' Note, selecting 'libapache2-mod-php7.0' for task 'lamp-server' Note, selecting 'liburi-perl' for task 'lamp-server' Note, selecting 'mysql-server-core-5.7' for task 'lamp-server' Note, selecting 'php7.0-mysql' for task 'lamp-server' liblua5.1-0 is already the newest version (5.1.5-8ubuntu1). liblua5.1-0 set to manually installed. libperl5.22 is already the newest version (5.22.1-9). libwrap0 is already the newest version (7.6.q-25). perl is already the newest version (5.22.1-9). perl-modules-5.22 is already the newest version (5.22.1-9). rename is already the newest version (0.20-4). tcpd is already the newest version (7.6.q-25). The following additional packages will be installed: libevent-core-2.0-5 Suggested packages: www-browser apache2-doc apache2-suexec-pristine | apache2-suexec-custom php-pear libdata-dump-perl libipc-sharedcache-perl libwww-perl mailx tinyca openssl-blacklist The following NEW packages will be installed: apache2 apache2-bin apache2-data apache2-utils libaio1 libapache2-mod-php libapache2-mod-php7.0 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libcgi-fast-perl libcgi-pm-perl libencode-locale-perl libevent-core-2.0-5 libfcgi-perl libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl liblwp-mediatypes-perl libtimedate-perl liburi-perl mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server mysql-server-5.7 mysql-server-core-5.7 php-common php-mysql php7.0-cli php7.0-common php7.0-json php7.0-mysql php7.0-opcache php7.0-readline ssl-cert 0 upgraded, 40 newly installed, 0 to remove and 10 not upgraded. Need to get 24.5 MB of archives. After this operation, 183 MB of additional disk space will be used. Do you want to continue? [Y/n] |
Testing the LAMP Installation :
Open your web browser and enter the IP Address of your server in the URL box and hit enter. You will be presented with Apache default page like below.
Uninstall LAMP :
Don’t remove the complete Lamp package using
1 |
sudo apt-get --purge remove lamp-server^ |
or
1 |
sudo apt-get remove lamp-server^ |
Because lamp-server^ is a Meta Package. It will install many dependencies as part of LAMP server. So if you remove it using apt-get, It will remove all those dependencies.
SSH server is also one of the dependency. So it will remove the OpenSSH Package also.
You will lose connection to your server through SSH. So be careful while uninstalling the LAMP server using above commands.