One of the many great things about Windows Azure is how easy you can create a virtual machine, no matter the OS of your preference. But for good or bad, your virtual machine will be fresh, so you need to work on setting up whatever you need to get to work.
Recently I needed to set up some web applications that I preferred to run on Linux, and for that I prefer to use XAMPP because of the simplicity of the installation process. But this time was not as straightforward as on my previous experiences, so then this is how I did it.
I’ll assume that you already have the virtual machine created; I chose an Ubuntu Server 13.04 instance from the gallery. After getting the virtual machine up and running, the first step I did was to download the latest XAMPP version from the Apache friends website.
sudo wget http://sourceforge.net/projects/xampp/files/XAMPP%20Linux/1.8.1/xampp-linux-1.8.1.tar.gz/download?use_mirror=iweb&download=
After that you need to extract the files from the tar, so we follow the process described for the XAMPP installation guide
sudo tar xvfz xampp-linux-1.8.1.tar.gz -C /opt
So far, so good. But when we try to start our XAMPP server using
sudo /opt/lampp/lampp start
We get the following error
XAMPP is currently only availably as 32 bit application. Please use a 32 bit compatibility library for your system.
To solve this, there are 2 posible solutions, both of them start by doing
sudo apt-get update
After this, you can install the
sudo apt-get install ia32-lib
This solution worked for me on previous Ubuntu versions, but not this time. If this solution doesn’t work for you either, then you need to run the following command
sudo dpkg --add-architecture i386 && sudo apt-get update && sudo apt-get install ia32-libs
As stated in this askubuntu.com answer,
(…) installing through WUBI did not correctly detect the available foreign architectures. As tumbleweed suggested printing the foreign architectures probably returns nothing. Add i386 as a foreign architecture, update the apt cache, then install the 32 bit libs.
So then now you might be able to start your XAMPP server by
sudo /opt/lampp/lampp start
You should now get something like this
Starting XAMPP 1.8.1... LAMPP: Starting Apache... LAMPP: Starting MySQL... LAMPP started.
With this you have successfully installed your XAMPP server, the next step is to test your web server. When you create a new virtual machine, by default the only open port is the one designed for SSH. In order to access the server via a different port we need to create a new endpoint. On the Virtual Machine administration page, go to the endpoints tab
There you will see the list of the endpoints that we already have. If it is a new VM you might see only the one corresponding to SSH.
Click on ADD ENDPOINT button at the bottom of the page, and you will see the small window to create a new endpoint.
You can choose the name you want but it cannot be the same as an existing one; the protocol will be TCP. The public port is the one you will use to access your webserver, so it can be anything you want. The private port is the one your XAMPP server is using to serve the content. It is normally the 80, but you can change that on the XAMPP configuration accordingly to your needs.
After clicking the complete button, you should be able to see your new endpoint listed and now you can access your web server from any part in the world with something like this
Once the page loads, you will most likely see the following error message
New XAMPP security concept: Access to the requested object is only available from the local network. This setting can be configured in the file "httpd-xampp.conf". If you think this is a server error, please contact the webmaster.
So then what you need to do is modify the specified file. According to our installation, it will be located in
/opt/lampp/etc/extra/ directory. We need to find the section with the title “New XAMPP security concept” and comment out the full
LocationMatch section or adjust the values of the allowed IP addresses if you don’t want to open your site to the public.
Another change we need to make in the same file is on the
Directory "/opt/lampp/phpmyadmin" section. We need to add there
Requiere all granted to be able to access the phpMyAdmin site. Remember to add some IP filters so it is not open to anybody that has the URL address to access it.
To finish, just restart your XAMPP server
sudo /opt/lampp/lampp restart
And voilà, you are now ready to work with your XAMPP server on the cloud. CodeProject