The most common type of web-server available is based on the LAMP (Linux, Apache, MySQL, PHP) bundle, so in this tutorial I will cover creating a web development server based on these components. Another common component is phpMyAdmin which is a web base MySQL administration tool so we are going to include it in our tutorial.
This tutorial guides you through installing Apache 2, MySQL 5, PHP 5 and phpMyAdmin for use as a development web-server on Ubuntu Linux. All these packages are available in the Ubuntu software centre at the versions we require.
To make a fully secure publicly available web-server it would require many other steps that aren’t always necessary when developing websites.
If you want to use the XAMPP installation instead please see my Installing XAMPP on Ubuntu tutorial.
Step 1 Updating the system
Open the terminal from the launcher or by pressing Ctrl-Alt-t.
Now before we stat installing anything you need to check for updates by typing:
sudo apt-get update
You should enter your password when prompted. If there are any updates found you should agree to update and let them install before continuing on with the installation.
Step 2 Installing the Apache 2 web server and PHP
Now that the system is up to date we can install the Apache 2 web server by typing
sudo apt-get install apache2
Next we will install PHP by typing
sudo apt-get install php5
If asked asked to confirm the installation press Y or Enter to proceed with the installation.
As these instructions are for a development web-server we will now install the Xdebug PHP 5 debugging library (this can be skipped if you just want to host PHP websites)
sudo apt-get install php5-xdebug
Step 3 Installing the MySQL Database server
Now we need to install the MySQL Database server that we will be using to provide data for our websites by typing:
sudo apt-get install mysql-server
You may be asked to confirm the installation so press Y or Enter if needed to proceed with the installation.
You will be asked for a password for the root (administrator) user.
You will then be prompted to repaet the password that you jsut entered to confirm that it’s correct.
Now to allow PHP to work with MySQL we need to the php5-mysql package by typing:
sudo apt-get install php5-mysql
Step 4 Testing the Installation
Test the web-server installation in Firefox by typing localhost in the address bar.
Step 5 Installing the MySQL administration system (optional)
Th help use create, manage and delete MySQL databases we are goin to install the web based phpMyAdmin database administration system.
To install phpMyAdmin type the following in the terminal:
sudo apt-get install phpmyadmin
If asked asked to confirm the installation press Y or Enter to proceed with the installation. Once downloaded you will be presented with a series of dialogs to configure phpMyAdmin with your database server and web server.
The first dialog asks what type of web server you are using. You will see a red box showing the highlighted option. The currently selected option will have beside it.
On the screen above make sure that the apache2 has the red highlight (use the arrow keys to select it if required) and press Space to select it (you will see a *) then press Enter.
The dialog will allow you to create the dbconfig-common database used by phpMyAdmin.
Make sure that the Yes option is highlighted and press Enter to configure the database.
The next dialog requests the database administrator password to create and manage databases. You need to type the password for the administrative (root) account for the database server then press Enter. The password will be obscured.
For the next dialog you can safely select <OK> (by using the Tab key) then press Enter to generate a random database password for the phpmyadmin user.
Next we will test the php, mysql and phpmyadmin installations by typing localhost/phpmyadmin in the Firefox address bar.
The user name is root and the password is the database server root password. If you can login then PHP, MySQL and phpMyAdmin are correctly installed.
To make the webserver usable we will need to set-up a websites folder, set-up virtual hosts and enable some required apache modules.
If you like this article please subscribe to my RSS feed or share on one of these solcial networking websites.