Do you want to work or play with LAMP (Linux, Apache, MySQL, PHP), using phpMyAdmin on Ubuntu 14.04 LTS? Me too! And so I Googled for a single web source on how to make this techie playground happen. My findings varied. While there’s plenty of good information online, it’s scattered about like pieces to a puzzle, and finding the information was either incomplete or unnecessarily complicated. Here are my notes compiled, which I’ve tailored, streamlined and applied successfully.
This is the big picture with all the information in one place. It will be quick, easy and painless. Here’s an overview of the steps involved:
- Install the LAMP server
- Install phpMyAdmin and test Apache and phpMyAdmin
- Set WWW folder permissions
- Test PHP
#1. Installing LAMP
Open your Ubuntu Terminal (Ctrl+Alt+T) and copy and paste the following:
sudo apt-get install tasksel -y && sudo apt-get update && sudo tasksel
Use down arrow key to navigate to the LAMP option, then select it by using the space key, select the Tab key to highlight the <OK> option and select your Enter key to proceed.
Enter a password you will remember, then select Enter key.
And repeat, entering the same password as on the previous screen.
Once installed, the previous window will close and you will be returned to the Terminal.
#2. Installing phpMyAdmin
Enter the following commands into the terminal:
sudo apt-get update && sudo apt-get install phpmyadmin -y
Use down arrow key to navigate to the apache2 option, then select it by using the space key, select the Tab key to highlight the <OK> option and select your Enter key to proceed.
Next window appears, asking to configure database for phpmyadmin with dbconfig-common. Yes is already highlighted, simply select the Enter key to proceed.
Type a password you will remember for the database’s administrative user, then select the Enter key to proceed.
Simply re-enter the password you used on the previous screen, when asked to enter MySQL application password for phpmyadmin, then select the Enter key to proceed.
Simply re-enter the password you used on the previous screen, when asked to enter MySQL application password for password confirmation, then select the Enter key to proceed.
Once installed, the previous window will close and you will be returned to the Terminal, where you will copy and paste the following command and select your Enter key:
sudo apt-get install php5-mcrypt && sudo php5enmod mcrypt && sudo service apache2 restart
You can now test the following by clicking the links:
Test Apache: When clicking this link you should see this image below.
Test phpMyAdmin When clicking this link you should see this image below.
Login with the root username and your password used when setting up your phpMyAdmin installation. Once logged in, you will see the phpMyAdmin interface shown below.
#3. Set WWW Folder Permissions
To set the WWW folder permission, allowing you to modify the /www/html/ directories and files, where your web content will go, copy and paste the following command in your Terminal window, replacing username with your Ubuntu login name:
sudo chown -R username /var/www
You can locate this by navigating to the Home folder, Computer, var/www/html. Once there, you’ll see you can add and modify content, like WordPress files, etc.
#4. Test PHP
You will need to create a simple PHP file using your Gedit text editor program (right-click on the desktop, select New Document, then Empty Document:
- Name the file: phpinfo.php
- Open the file and copy and paste this information exactly as you see here:
<?php
// Show all information, defaults to INFO_ALL
phpinfo();
?>
- Save and close the phpinfo.php file
- Move this file to the /www/html directory
- Click this web address here: http://localhost/phpinfo.php
- You should then see the page image below appear when successful:
Congratulations! You have now installed LAMP, phpMyAdmin and set your WWW folder permissions and are ready to begin local web and database development on your Ubuntu 14.04 operating system. Feel free to contact me with any questions.
Enjoy!