This is just one of those things that I don’t do often enough to remember. I thought it would be a good idea for me to put it into a knowledge base article so I don’t have to waste my time going to the all knowing Google.
The first thing to do is make sure your Ubuntu server is up to date with this command:
sudo apt update && sudo apt upgrade -y
This only takes a few seconds to run and updates and upgrades all the packages in one fell swoop. The next thing we install is tasksel with this command:
sudo apt install tasksel
Once that is installed we can run this command
sudo tasksel install lamp-server
This will install all LAMP server dependencies. If you want to make sure your apache server is running you can type the command:
service apache2 status
This will output this:
Press CTRL c to go back to the bash. Now I want to see if PHP was installed correctly. type:
php-version
This will be on your screen:
Next type in the ip address of your new server in the url bar of your favorite browser. You should see this:
Now we will want to see if PHP is working properly. Go to the /var/www/html file and create a file named info.php. (I like to use nano, but some prefer vi or vim.) The file will contain this code:
<?php phpinfo() ?>
Type in (ip_address)/info.php and you should see this:
Your LAMP server should now be basically configured! Now go have fun creating an awesome website or application!