ObjectiveThe objective of this article is LAMP setup. Installing LAMP on Ubuntu 18.04 Bionic Beaver includes the setup of Linux, Apache, MySQL and PHP server, also known as LAMP stack.
Operating System and Software Versions
- Operating System: - Ubuntu 18.04 Bionic Beaver
RequirementsPrivileged access to to your Ubuntu 18.04 system will be required.
- # - requires given linux commands to be executed with root privileges either directly as a root user or by use of
- $ - requires given linux commands to be executed as a regular non-privileged user
Install LAMP Ubuntu 18.04Using the
taskselcommand the procedure of installing LAMP on Ubuntu 18.04 Bionic Beaver is a rather trivial matter. First, make sure that you have the
$ sudo apt install taskselTo install LAMP server using
$ sudo tasksel install lamp-server
Test your LAMP InstallCreate a simple PHP Info page to test your LAMP installation:
$ sudo bash -c "echo -e '<?php\nphpinfo();\n?>' > /var/www/html/phpinfo.php"The above command will create a new
/var/www/html/phpinfo.phpfile with the following content:
$ cat /var/www/html/phpinfo.php <?php phpinfo(); ?>Now, point your web browser to your new LAMP install using the following URL:
http://<YOUR SERVER DOMAIN OR IP ADDRESS HERE>/phpinfo.php:
BLUE SKY STUDIOS are looking for Linux Administrator to maintain and support the Studio's 450+ production Linux workstations, including daily interactions with the Studio’s digital animation artists.
LOCATION: Greenwich, Connecticut, USA
Optional LAMP Setup
MySQL Secure InstallationIt is recommended to secure your MySQL installation before using your LAMP stack server in production. To do so execute:
Firewall ConfigurationThe following firewall configuration allows incoming traffic on TCP ports
$ sudo ufw allow in "Apache Full"
Install PHP ModulesThe default LAMP stack comes pre-installed with basic PHP modules. There are many additional PHP modules available
$ apt-cache search ^php- | grep module. First, obtain a PHP module package name and then install it using:
$ sudo apt install MODULE_NAME_HERE
Appendix: LAMP install error messagesWarning Message:
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this messageSolution: Open
/etc/apache2/apache2.confand insert the following directive at the end of the file:
ServerName <YOUR SERVER DOMAIN OR IP ADDRESS HERE>Alternatively, use the
echocommand. This example will be used for a server with the IP address
10.1.1.4. Change your server IP or Domain name accordingly:
$ sudo bash -c "echo ServerName 10.1.1.4 >> /etc/apache2/apache2.conf"Confirm your new configuration:
$ sudo apache2ctl configtest Syntax OK