The first thing that you will want to do is to setup LAMP (Linux, Apache, MySQL, PHP) on your image. I’m doing this on a fresh Ubuntu Desktop 32bit 8.04 installation so that I can use X11. A great guide exists here, but I’ll post the steps here as well (sometimes those pesky links die).

Installing Apache2

1. Open up the Terminal (Applications > Accessories > Terminal).

2. Copy/Paste the following line of code into Terminal and then press enter:

sudo apt-get install apache2

3. The Terminal will then ask you for you’re password, type it and then press enter.

Testing Apache2

To make sure everything installed correctly we will now test Apache to ensure it is working properly.

1. Open up any web browser and then enter the following into the web address:

http://localhost/

You should see a folder entitled apache2-default/. Open it and you will see a message saying “It works!” , congrats to you!

Installing PHP5

In this part we will install PHP 5.

Step 1. Again open up the Terminal (Applications > Accessories > Terminal).

Step 2. Copy/Paste the following line into Terminal and press enter:

sudo apt-get install php5 libapache2-mod-php5

Step 3. In order for PHP to work and be compatible with Apache we must restart it. Type the following code in Terminal to do this:

sudo /etc/init.d/apache2 restart

Testing PHP5

To ensure there are no issues with PHP let’s give it a quick test run.

Step 1. In the terminal copy/paste the following line:

sudo gedit /var/www/testphp.php

This will open up a file called phptest.php.

Step 2. Create a phpinfo page to test PHP and verify that it’s functioning. I have a copy here that you can use. Right click on the link and go to Save As to save the test page. You’ll want to then upload that saved file to your FTP site. Or if you are on your Ubuntu machine, you can run the below. Make sure that you’re in the DocumentRoot directory (see your Apache conf for the DocumentRoot path).

wget http://evolutioncreations.com/download/phptest.php

Step 3. Save and close the file.

Step 4. Now open you’re web browser and type the following into the web address:

http://localhost/testphp.php

Congrats you have now installed both Apache and PHP!

Installing MySQL5

To finish this guide up we will install MySQL. (Note – Out of Apache and PHP, MySQL is the most difficult to set up. I will provide some great resources for anyone having trouble at the end of this guide.)

Step 1. Once again open up the amazing Terminal and then copy/paste this line:

sudo apt-get install mysql-server

Step 3. This is where things may start to get tricky. Begin by typing the following into Terminal:

mysql -u root -p

Enter in the password that you setup during the apt-get install process.

Step 4. We are now going to install a program called phpMyAdmin which is an easy tool to edit your databases. Copy/paste the following line into Terminal:

sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin

After that is installed our next task is to get PHP to work with MySQL. To do this we will need to open a file entitled php.ini. To open it type the following:

gksudo gedit /etc/php5/apache2/php.ini

Step 5. Once the text editor opens the php.ini file, go to the bottom of the file and add in the following line:

extension=mysql.so

This will allow you to use MySQL within your PHP scripts.

Now just restart Apache and you are all set!

sudo /etc/init.d/apache2 restart

Installing OpenFire 3.5.1

The first thing that we want to do in preparation to install OpenFire is to install Java. Since I’m doing this on a fresh install of Ubuntu Java isn’t installed. But if you do have it installed, make sure you hava version 6.

Step 1. To check your Java version you can run the command:

java -version

If nothing returns, or you get something that tells you that you need to install Java, proceed to step 2. If you do get something back and Java is version 6, then skip to step 3.

Step 2. To install Java, run the following command from Terminal (Applications > Accessories > Terminal):

sudo apt-get install sun-java6-bin

Since you only have one version of Java installed on your system, you don’t need to go to step 2a. If you have multiple versions of Java installed, you will want to specify your Java version:

sudo update-alternatives –config java
select /usr/lib/jvm/java-6-sun/jre/bin/java

Step 3. To create your MySQL user and database. Since your LAMP installation installs phpMyAdmin, first log into phpMyAdmin using root as your username and the password you configured during the installation process.

On the main page, locate Priviledges and scroll down to Add a new User.

Use the following on the New User screen:

Username = Enter a username, I used ‘openfire’
Host = From the drop down menu, select localhost
Password = Enter a password, retype your password

Under the Database for user section of that page, click on the radio button for Create database with same name and grant all priviledges.

At the bottom of the page, click on the Go button.

Step 4. Now that we have setup the database and user, we want to get the OpenFire package. First go to:

cd /opt

Then run:

sudo wget http://www.igniterealtime.org/downloadServlet?filename=openfire/openfire_3_5_1.tar.gz

Once the file downloads, run:

sudo mv downloadServlet\?filename\=openfire%2openfire_3_5_1.tar.gz openfire_3_5_1.tar.gz

then run:

sudo tar zxvf openfire_3_5_1.tar.gz

then create a a symlink:

ln -s /opt/openfire/bin/openfire /etc/init.d/

You know have to make your symlink executable:

chmod +x /etc/init.d/openfire

Now we have to fix an error that comes up when you try and restart the service. Go into the /opt directory:

cd /opt/openfire

and run:

nohup: appending output to `nohup.out’

Congraduations! You can now finish the configuration through the URL:

http://localhost:9090/

LAMP Installation Reference
OpenFire Installation Reference