Check this Out!Visit our social network pages for recent updates!

Students Question – What is the Quickest Way to Install the LAMP Stack on Ubuntu?

The LAMP stack is a collection of opensource software that runs majority of the websites online today. There are countless tutorials on installing the LAMP stack on Ubuntu systems.

What question that comes up frequently is what is the quickly way or one line command to install the LAMP stack on Ubuntu servers? If you want to know, continue below.

There are countless tutorials online that describe the steps to install the LAMP stack on Ubuntu servers. Very few tutorials will show you a one line command that does the same thing. This brief tutorial will show students and new users a one line command that installs the LAMP stack on Ubuntu servers.

So, you probably already know the stack is a acronym for Linux, Apache2, MySQL database server and PHP. The standard way many tutorials show users is the individually install each component or server.

That’s fine.. but if you to just cut to the chase and install the entire stack with a single command, follow the step below.

Installing the LAMP stack with a single command

The single line command that installs the LAMP stack on Ubuntu is shown below.

sudo apt-get install lamp-server^

Running the command above will install all the required packages that power the stack. Before installing the packages, you’ll be asked to type Y to continue with installing the packages.

Below is an example of the packages that will install

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 'libevent-core-2.0-5' 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'
libcgi-fast-perl is already the newest version (1:2.10-1).
libcgi-fast-perl set to manually installed.
libcgi-pm-perl is already the newest version (4.32-1).
libcgi-pm-perl set to manually installed.
libencode-locale-perl is already the newest version (1.05-1).
libencode-locale-perl set to manually installed.
libfcgi-perl is already the newest version (0.78-1).
libfcgi-perl set to manually installed.
libhtml-parser-perl is already the newest version (3.72-2).
libhtml-parser-perl set to manually installed.
libhtml-tagset-perl is already the newest version (3.20-2).
libhtml-tagset-perl set to manually installed.
libhttp-date-perl is already the newest version (6.02-1).
libhttp-date-perl set to manually installed.
libhttp-message-perl is already the newest version (6.11-1).
libhttp-message-perl set to manually installed.
libio-html-perl is already the newest version (1.001-1).
libio-html-perl set to manually installed.
liblwp-mediatypes-perl is already the newest version (6.02-1).
liblwp-mediatypes-perl set to manually installed.
libperl5.22 is already the newest version (5.22.2-3).
libperl5.22 set to manually installed.
libtimedate-perl is already the newest version (2.3000-2).
libtimedate-perl set to manually installed.
liburi-perl is already the newest version (1.71-1).
liburi-perl set to manually installed.
libwrap0 is already the newest version (7.6.q-25).
libwrap0 set to manually installed.
perl is already the newest version (5.22.2-3).
perl set to manually installed.
perl-modules-5.22 is already the newest version (5.22.2-3).
perl-modules-5.22 set to manually installed.
rename is already the newest version (0.20-4).
rename set to manually installed.
ssl-cert is already the newest version (1.0.38).
ssl-cert set to manually installed.
tcpd is already the newest version (7.6.q-25).
tcpd set to manually installed.
Suggested packages:
apache2-doc apache2-suexec-pristine | apache2-suexec-custom php-pear
libipc-sharedcache-perl mailx tinyca
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 libevent-core-2.0-5 libhtml-template-perl liblua5.1-0
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
0 upgraded, 28 newly installed, 0 to remove and 22 not upgraded.
Need to get 24.8 MB of archives.
After this operation, 191 MB of additional disk space will be used.
Do you want to continue? [Y/n]  Y

Type Y to continue with installing the packages.

During the installation, you’ll be prompted to create the root password for MySQL database server. Type and confirm the password to continue.

Ubuntu MySQL password prompt screen

After the packages are installed, your system will be ready to run a PHP powered application on Apache2 webserver hosted by MySQL database server.  And this is the quickest way to install the LAMP stack on Ubuntu

Enjoy!

Leave a Reply