Installing OpenFire on Ubuntu 8.04

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

25 comments:

Anonymous said...

soor to sound like a noob
but what does Open fire do?

Again, sorry... just putting thoes tux waddlers in th water --- Its a big world out there

Anonymous said...

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.



for step 3, can u clarify how to loginto phpMyAdmin and how to install LAMP and What is LAMP... Sorry, a am new to this!

evo said...

Q: soor to sound like a noob but what does Open fire do?

A: OpenFire is XMPP server that I would think you would use in say a corporate setting to host your own instant messaging platform. A lot of companies use things like Skype and AIM or Yahoo, so OpenFire allows you to bring all of that in-house on a secure network. You can view Jabber clients via the URL:

http://www.jabber.org/clients

Q: for step 3, can u clarify how to loginto phpMyAdmin and how to install LAMP and What is LAMP... Sorry, a am new to this!

A: LAMP is Linux, Apache, MySQL, PHP, it's basically just short hand for an out of the box server that you can configure to handle most web-type requests. As far as logging into phpMyAdmin, you will be prompted for a username/password. This is typically your root username and password that you used in your configuration of MySQL (see section in my document regarding Installing MySQL5. You can also use phpMyAdmin to manage other database's, that would simply be entering your other database username's and password's in the login prompt.

Josh Adams said...

sudo tasksel install lamp-server

Do that. It takes the meat out of the tutorial.

RV Discovery Team said...

Excellent directions, everything worked like clockwork

evo said...

glad to hear that everything worked out! It's a great piece of software!

Anonymous said...

How to start phpMyAdmin? Is is web-based (do we need a local URL)? It does not execute at the prompt (>phpMyAdmin).

evo said...

Q: How to start phpMyAdmin? Is is web-based (do we need a local URL)? It does not execute at the prompt (>phpMyAdmin).

A: phpMyAdmin is web-based. If you install it through apt-get, you should be able to get to it by going to the URL:

http://localhost/phpmyadmin

from the webserver, or replace 'localhost' with your server's name.

Anonymous said...

>>A: phpMyAdmin is web-based. If you
>>install it through apt-get, you should
>>be able to get to it by going to the
>>URL: http://localhost/phpmyadmin

Yeah, I figured it was web based before posting the original question. The URL doesn't work, so I guess phpMyAdmin is not working ....

I followed these installation instructions with one exception (below):
-----------------------------------
begin instruction set
-----------------------------------
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
-----------------------------------
end instruction set
-----------------------------------

***What I was confused with was between steps 3 and 4. We were supposed to log into mysql in step 3, and then the instructions jump to installing phpMyAdmin. I logged into mysql, but the command "sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin" only runs at the command prompt. After logging into mysql, I /q and then executed the installation of phpMyAdmin at the command prompt. I looked at Synaptic Package Manager, and phpMyAdmin is loaded on my machine. I'm not sure what's happening here...

evo said...

Interesting. Pretty much on step 1 you'll be going through the installation process of mysql, and on step 2, you'll be testing your mysql to make sure that the credentials that you entered in step 1 during the installation allow you to actually go into mysql and see that you have a valid instance.

Assuming that this is correct and you were able to log into mysql on step 2, on step 3, you'll be installing phpmyadmin in Apache.

Question, did you install apache, so you can go to http://localhost/ and get the generic apache page saying that it works? Also is apache started? So to get a base line, i'd start with running these from a terminal:

telnet localhost 3306

then

telnet localhost 80

If the first telnet works, you should get a response back from Mysql with the version that is running. Likewise on the second command you'll see that apache is listening on port 80 and everything is working well.

If both of those work out, then I'd then check to make sure that phpmyadmin installed into the web-root directory that is configured for apache. Check the apache configuration file to see where the document root is configured to. On my installation it was set to /var/www/ and if i go to that directory, I will see a phpmyadmin directory that will contain all the php files.

Also I'd have you create a phpinfo page and verify that php is working on your apache instance.

Let me know if that helps!

Anonymous said...

I've been working on other things the past week or so, and now I'm back to working with the Openfire on Ubuntu project...

-----------------------------------
evo said...
...check to make sure that phpmyadmin installed into the web-root directory that is configured for apache. Check the apache configuration file to see where the document root is configured to. On my installation it was set to /var/www/ and if i go to that directory, I will see a phpmyadmin directory that will contain all the php files.
-----------------------------------

As it turns out, phpmyadmin is NOT in the /var/www folder, but is installed in part in the /etc directory and the /usr/share directory. The important file for starting phpmyadmin - index.php - is in the /usr/share folder. I added the following line in the file /etc/apache2/httpd.conf

Alias /phpmyadmin/ "../../usr/share/phpmyadmin/index.php"

It works! ...phpmyadmin just came up on the browser. I haven't used it yet, but I'm pumped that I got it to go. It took some time because I am very new to the Linux-type OS ... especially knowing how to navigate the directories. My experience is with Windows IIS web server stuff.

Anyway, thanks for the hint. I may hit you up for some other hints as I move forward to getting Openfire to work.

evo said...

Glad that got sorted for you! Let me know if you run into further problems!

Damon said...

i have a question about "installing MYSQL5 setp 4... i copy and past the text into a text editor and it hangs on:
sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin

->

any advise?

Thanks

evo said...

you can try to run each separately, such as:

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

sudo apt-get install php5-mysql

sudo apt-get install phpmyadmin

and see which one of those fail. assuming that apache is installed, the first two install into apache, and the last one installs the phpmyadmin web interface to be able to manage your mysql instance.

Anonymous said...

Hi. Thanks for putting up this tutorial. I was following it and got to the part where you test the php installation. In step 2 you say cut and paste this line ... but I don't see a line to cut and paste. Are you saying cut and paste the step 2 line???

Thanks!

evo said...

sorry about that! Google took put the PHP code I put into the posting. I've modified it and if you look there will be new steps and a link to the file if you want to just download it.

Ray said...

I finished the installation, but I can not telnet or browse to port 9090? Everything seemed t o go ok exept for one thing, which was the line with the mv command after downloading the openfire program. It did let me do the next line however? Any ideas???

evo said...

Ray, the mv command:

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

is critical as it takes the file that you downloaded and changes the name to the tar.gz that you will ultimately extract and install OpenFire from.

An alternative if you have Gnome or KDE desktop installed on the server, you can just go to the URL:

http://www.igniterealtime.org/downloads/index.jsp

and click on the tar.gz file and download it via a web-interface. Or you can download it on another machine and send it to the server via FTP or sFTP protocols (assumes SSH is installed).

Let me know if that helps!

Anonymous said...

mv: cannot stat `downloadServlet?filename=openfire%2openfire_3_5_1.tar.gz': No such file or directory

Why do I receive this ?

evo said...

Try and go to the URL:

http://www.igniterealtime.org/downloads/index.jsp

and click on the Linux button under Openfire 3.6.4 which is the current release, and you'll see a bunch of links appear under the button:

openfire-3.6.4-1.i386.rpm RPM for Red Hat Linux and variants May 1, 200941.38 MB

openfire_3.6.4_all.deb Debian package, no Java JRE May 1, 200911.15 MB

JSopenfire-3.6.4-ALL.pkg.gz Solaris package, no Java JRE May 1, 20097.93 MB

openfire_3_6_4.tar.gz Works on most Unix variants, no Java JRE May 1, 20097.02 MB

Click on the last file: openfire_3_6_4.tar.gz and a new page will appear with a link:

Your download will start right now. If a download window does not appear, please click here.

Where it has click here, right click on that and copy the link, and use that in your wget, so it would be:

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

Let me know if that helps!

Anonymous said...

At Install Openfire 3.5.1 ; Step3 I am not able to log into phpmyadmin. I have read of some people moving files to sort this problem but I don't know what file/directoriesI should from where to where. Can I get someadvice please.

evo said...

what's the error message that you receive when you try and log into phpmyadmin or load phpmyadmin from a browser?

Anonymous said...

Installing OpenFire 3_5_1 appears to be more stable than Openfire 3.6.4.

I tried installing Openfire 3.6.4 and had to redo the installation so many times because of the admin-bug. I was unable to log in to Admin user after a while.

Ben said...

I also am getting mv: cannot stat `downloadServlet?filename=....
when i run sudo mv downloadServlet\?filename\=openfire%2openfire_3_5_1.tar.gz openfire_3_5_1.tar.gz or sudo mv downloadServlet\?filename\=openfire%2openfire_3_6_4.tar.gz openfire_3_6_4.tar.gz

I'm a bit of a noob myself so not sure why this is happening. Would really appreciate the help..

evo said...

@Ben,

try:

sudo wget http://www.igniterealtime.org/downloads/download-landing.jsp?file=openfire/openfire_3_6_4.tar.gz

and see if that works.