Learn how to install a LAMP stack on Ubuntu Server 19.10.
Recently, I had a reader reach out to me regarding troubles installing a LAMP stack on Ubuntu. I promised that reader I would address the issue by writing up a simple-to-understand walkthrough of installing a full LAMP stack on the latest release of Ubuntu Server (19.10).
What is a LAMP server?
LAMP is an acronym for Linux Apache MySQL PHP. When you install a LAMP stack, you install this entire stack of applications. This particular stack of applications is responsible for powering a very large number of websites across the globe.
SEE: Linux Mint: How to get up and running (free PDF) (TechRepublic)
What you'll need
The only things you'll need to make this happen are a running instance of Ubuntu Server 19.10 (although the steps work for earlier iterations of the platform) and a user account with sudo privileges.
How to install the LAMP stack on Ubuntu
There are a few methods for installing the LAMP stack on Ubuntu, but I want to show you the fastest. For the longest time, it was thought that using the tasksel command was the best way to install the LAMP stack. That method was was dethroned, thanks to a single apt command. The command in question is:
sudo apt-get install lamp-server^
The use of the ^ character means that what precedes is a meta package. When installing meta packages, a number of other packages will also be installed. Packages like apache2-utils, libaprutil1, libhttp-date-perl, php-mysql, php7.3-readline, ssl-cert, and more will be added along with Apache, MySQL, and PHP.
The one caveat to this method of installation is that the MySQL portion of the install doesn't ask you for the usual setting of the admin password. Because of this, you must run a second command to take care of the task.
How to secure MySQL
In order to secure MySQL, issue the command:
During this process, you'll be asked if you want to enable the password policy module. This module ensures that all MySQL user passwords follow a very strict password policy. Accept this if you want a bit more security for your MySQL server and then type/verify an admin password. Once that completes, answer Yes to the remaining questions and MySQL is ready.
How to view the Apache test page
Your LAMP server is installed and ready for testing. Point a web browser to SERVER_IP (Where SERVER_IP is the IP address of the hosting server) and the Apache test page should appear (Figure A).
If you find the test page isn't appearing, you might have to allow HTTP traffic through the firewall. Because the web server is started and enabled during installation, the firewall is probably at fault. To enable HTTP traffic into Ubuntu Server, issue the command:
sudo ufw allow http
Once you've run that command, attempt to view the test page again. That should have solved your problem.
And that's all there is to installing a full LAMP stack on Ubuntu Server 19.10. Hopefully you've found success in this process. If not, fill us in by way of the discussion and we'll see if we can resolve the issue.
- How to become a software engineer: A cheat sheet (TechRepublic)
- 10 free alternatives to Microsoft Word and Excel (TechRepublic download)
- How to enable Apache MPM Prefork to improve performance (TechRepublic)
- How to stop, start, and restart Apache on various Linux distributions (TechRepublic)
- How to install Apache on Fedora server (TechRepublic)
- GitHub: All open-source developers anywhere are welcome (ZDNet)
- It takes work to keep your data private online. These apps can help (CNET)
- The 10 most important iPhone apps of all time (Download.com)
- Must-read coverage: Programming languages and developer career resources (TechRepublic on Flipboard)