Running APE Server in a Virtual Machine
-
07-01-2021 - |
Question
I have been trying to set-up an Ajax Push Engine (APE) Server in a virtual machine, and have run into a bit of a snag. The problem is that the APE server cannot be accessed outside of the virtual machine.
Setup:
- Guest OS: Ubuntu 10.10 (I believe) with the ape package installed
- IP Address: 192.168.56.1 using a host-only network adapter
- APE Server running on port 6969
If I try wget 127.0.0.1:6969
in the virtual machine, I get a response.
If I try wget 192.168.56.1:6969
from the host OS, I get a Connection Refused
message.
If I ping 192.168.56.1
, I also get a response.
Any help would be greatly appreciated!
Solution
I ended up redoing everything from scratch, and it worked, so I must have got it right somehow. For the benefit of others...
To get APE Server running in a virtual machine (in particular, using VirtualBox), you need to do the following:
Setting up the environment
- Download and install VirtualBox
- Open VirtualBox, and go to
File > Preferences
, thenNetwork
- Confirm that there exists a host-only network
vboxnet0
(if not, create it). Take note of its IPv4 address (192.168.56.1
, in my case)
- Confirm that there exists a host-only network
- Create a new Ubuntu Virtual Machine
- Start the Virtual Machine
Getting the Libraries
Add the PPA for
libmysqlclient15off
, a pre-requisite for APE Server:username# gpg --keyserver hkp://keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A username# gpg -a --export CD2EFD2A | apt-key add - sudo sh -c 'echo "deb http://repo.percona.com/apt maverick main" >> /etc/apt/sources.list.d/percona.list'
Install
libmysqlclient15off
sudo apt-get update; sudo apt-get install libmysqlclient15off
Get and install the latest version of APE server
Edit /etc/network/interfaces, and add the following to the end:
auto eth0 iface eth0 inet static address 192.168.56.101 netmask 255.255.255.0
Close the virtual machine and go into its settings. Change the network settings for the first interface to
Host-only Adapter
Setting Up APE
Restart the Virtual Machine, and ensure that the APE daemon is running
username# ps -ef | grep "aped"
If you need to, make changes to
/etc/ape/ape.conf
Final Steps
Add the following to your hosts file, or some variation:
192.168.56.101 local.site.com 192.168.56.101 0.local.site.com 192.168.56.101 1.local.site.com 192.168.56.101 2.local.site.com 192.168.56.101 3.local.site.com 192.168.56.101 4.local.site.com 192.168.56.101 5.local.site.com 192.168.56.101 6.local.site.com 192.168.56.101 7.local.site.com 192.168.56.101 8.local.site.com 192.168.56.101 9.local.site.com
Access your new APE server via
local.site.com:6969
OTHER TIPS
Check APE config file. Are you binding to the right IP ? By default it's 127.0.0.1