OS & Software

How-to: Install Apache, Mysql and PHP on Ubuntu

I’ve noticed that a few of my readers are interested in learning how to install Apache on Ubuntu.  I can relate to that (I forget how to get the job done from time to time), so I present to you:  My Guide on how to install Apache, MySQL and PHP on a Ubuntu box (be it virtual or physical).  I’ll also throw in three tools you could use to make the management of said server easier. 

Assumptions

During this guide, I’ll be making the following assumptions:

  1. You’ve already installed Ubuntu (Or know how to).
  2. You know how to open the terminal, and use it (It’s simple, really).
  3. You’ve got access to the super-account and his cool moves. 

Requirements

  1. You’ve installed Ubuntu
  2. Optional: You’ve got a second PC / machine to verify access

Let’s get started

First of all, allow me to explain something: the installation of lamp-server we’re going to do, will install Apache2, MySQL and PHP5.  So there’s no need to install any of those manually. 
Bottom line: this guide will help you install Apache and more.  (bonus!)

The steps to follow

  1. Open a Terminal window.
  2. Use the following command to start the installation:
    • sudo tasksel install lamp-server
    • note: Ubuntu is CaSe-SenSITIve; write the command above exactly as I did
  3. A “wizard” will start.  The first, and only, question that will be asked is to provide a password.  This password will be used for the Root-account of the MySQL Server.  Provide the password, and provide it again when asked to. 
  4. The “wizard” will install Apache2, MySQL and PHP5.  Now is the time to get a coffee or something.  When the installation is done, you’ll be taken back to the Terminal window. 

Your Apache server is now up and running!  You can test this by browsing to http://localhost (on the box) or to http://(machinename) or http://(machine IP)

Next thing on the list is to set the proper permissions for the folder where your websites will be stored (the folder /var/www).  I’ve written the instructions in a previous post, so I’m not going to write it all again.

Link to Article: how to set your permissions

With that problem solved, you’re all good to go!  Your APache server is running (or it should be); your MySQL server is ready and your PHP framework is compiled and installed.  What are you waiting for?  Start creating those websites!

Some tools

There are some tools I always install on a new Ubuntu box, and you might find them usefull as well:

  • phpmyadmin: must-have for any LAMP server.  This tool allows you to manage your MySQL server, using any browser. 
  • phpmybackuppro:  An usefull tool to create back-ups of said MySQL databases.  Offers many great options. 
  • Webmin:  a tool to manage or install various services on your UBuntu box.  Can be downloaded or installed from the terminal command line. 

You should be all set now.  I hop that this how-to answered the question of some of you.  If not, feel free to contact me (info can be found on this site) or leave a comment. 

Advertisements

Categories: OS & Software

Tagged as: , , , , , ,

1 reply »