Wednesday, July 30, 2008

OpenSim on half a buck a day

I recently decided to see what the big deal was about OpenSim. After initially installing it on my desktop computer and connecting to it with the latest Release Candidate viewer, I decided to try to set it up on an inexpensive hosting account to see how feasible it was to run a real sim live on the Internet. Today's blog post talks a bit about how I did it, it's not a how-to guide, and you'll probably need to be a bit of a Linux geek to follow along, but hopefully you find it interesting.

The first step for hosting OpenSim was to find a suitable hosting account. Many people try to simply connect a server to their home DSL or Cable Internet service, but there are many disadvantages to this approach, mostly arising from the inexpensive equipment provided with such services often not being particularly easy to set up for inbound connections and the fact that most Telco and Cable service providers discourage the use of home Internet connections for hosting servers. Generally, if you want to host your own server, your best bet is some form of hosting provider.

There are a number of options for server hosting, including some people who are renting pre-configured OpenSim servers. Given that you can get a nice OpenSpace region (interesting to note the similarity between OpenSpace and OpenSim, intentional?) from Linden Lab for $75/month, it's my humble opinion that it defeats the purpose of setting up your own OpenSim server if you have to pay anywhere close to that much. That said, you're not going to be able to host OpenSim on a typical inexpensive shared hosting account, because it needs it's own dedicated IP addresses and ports as well as needs to have software installed that most shared hosting accounts don't provide. Luckily, there has been a recent trend to offer what's called "virtual private servers", which uses virtualization software like VMWare or Xen behind the scenes to host multiple virtual servers on a single physical server. To you and the software you install, virtualization makes it looks like you have an entire server to yourself. After some research, I found that SliceHost offers a $20/month virtual private server hosting plan which appeared to provide enough bandwidth and computing resources to comfortablely host an OpenSim simulator. Following the excellent instructions on the SliceHost website, I was able to start with an Ubuntu Hardy Heron OS image, and install Apache, MySQL, PHP, Perl, Python, Mono, and phpMyAdmin. One key point of divergence from the SliceHost instructions was when configuring the server's firewall, it was necessary to allow access to all the ports necessary for OpenSim to operate.

I initially tried to use the same pre-built OpenSim binaries that I used on my desktop. After a few mystery crashes, I decided to use svn to get the latest version of the OpenSim code. The instructions on the OpenSim website were fairly straightforward, and I was pleased that I was able to reasonably easily compile the latest version of OpenSim.

By default, OpenSim provides very minimal physics features that don't do things like prevent you from walking through walls. The recommended physics engine is called OpenDynamicsEngine, and a pre-built binary was also included with OpenSim, but this version had problems as well, forcing me to also rebuild the OpenDynamicsEngine from source to get it to work.

OpenSim can be run in either standalone mode, as a private grid, or connected to another grid. The documentation of standalone mode versus as a grid is somewhat unclear in that standalone mode is technically a simple form of a grid in that you can have as many regions as you want in a standalone simulator. I was initially confused and thought that you needed to run a grid in order to have multiple regions, but this is in fact not the case. Typically, you'll probably only use grid mode to connect a region to an existing grid, such as OSGrid. In my case, I wanted to have my own set of regions that were part of my private sandbox grid as well as have one or two regions connected to OSGrid. This proved simple to do with a couple of caveats. First of all, when I set up the firewall, I needed to make sure that I opened enough ports for all the regions I wanted to serve. The only thing that the documentation didn't explicitly state was that I needed to create two copies of the opensim/bin directory so that I could run two instances of the simulator code, one for my private grid and the other for the regions I intended to connect to OSGrid. I'm still not sure if this is absolutely necessary, but I'm pretty sure that you have to keep these installations in separate directories because they need different configuration settings in their respective OpenSim.ini configuration files. One other detail was that it was necessary to change the setting "http_listener_port" in the OpenSim.ini file for my OSGrid simulator to be the first port number in the series of port numbers assigned to the OSGrid regions.

There were a few other things that I needed to learn through trial and error and reading between the lines of the documentation. One important tip was that OpenSim isn't yet set up to easily be run and administered in a "headless" fashion. When the OpenSim server starts up, it goes into a command-line mode where you are able to administer it by entering in commands. In order to do this without having to stay connected to your server all the time, a tool called GNU Screen can be used to allow the server to run in command-line mode while still letting you disconnect and reconnect to your server via SSH.

After completing these steps, I had 3 regions in a private grid and another region attached to OSGrid, all on a $20/month hosting account. It's hard to beat that kind of price/performance ratio, although this certainly wasn't a project for the faint of heart. If there is enough interest, I'll put up a page with the start to end steps I took.

Of course, once you do this, you'll still have to grapple with the issues of having a Ruthed avatar with bad hair and skin. Using Second Inventory and test LibSL TestClient, it's possible to move some of your SL content into OpenSim (only stuff you made yourself or you bought and paid for, of course), but that's the subject of another blog post.

9 comments:

Lulworth said...

Hi Emma - nice write up. I've rewritten some of the documentation at

http://opensimulator.org/wiki/OpenSim_Configuration#Standalone_vs._Grid

to make it clearer that you can run multiple regions on standalone.

Regarding running in the background - this is possible (there is a background switch which might not be well documented yet - I think it's -background). In this mode, OpenSim has to be controlled via XMLRPC calls.

Brian B. said...

Hi Emma,

Thanks for the clarity of your writeup. I've used standalone mode for awhile but have not yet gone to Grid mode. If you could write more about your experience with having both modes on one v-server, it would be helpful.

SL Darb Dabney

Gaynor said...

Yes, please give us the step by step instructions so the techno dim (like me) can follow them.

I've been wanting an empty sim to release some wild plants into, and I might be able to afford an open sim.

galah3 said...

I would very much like further info as I know nothing about servers and am a bit of a nitwit when it comes to detail

and would very much like to have a giant terrain a bit like Darb Dabneys (well done Darbs by the way)

Flew into Elsewhere today and took a pickie for a whumpy bear

so thanks for that too Emma

Naked Bunny with a Whip said...

Just a note that you have to own a regular region in SL ($295/month) in order to buy any OpenSpaces ($75/month). You can get an OpenSpace without owning a regular region only by renting from someone who does.

Buck said...

Care to teach a linux newbie on what to configure when setting up a region in linx?

wow power leveling said...

welcome to the wow power leveling, cheap service site, buy cheap wow gold,wow gold,world of warcraft power leveling buy wow power leveling

dfous said...

Bon marche de Dofus Kamas.achat de dofus.le prix moins cher.nous vendons dofus,or de Wakfu. 24/7 appui-en-ligne et livraison rapide.Wakfu Kamas
china: chinaserving

TasmanPerth said...

Hi! I run an OpenSim/OSGrid region on a $10/mo Ubuntu virtual server, it's from fsckvps.com. You get 512MB of guaranteed ram, burstable to 1GB, 30GB of diskspace, and 400GB/mo transfer. I run the sim on the server along with my shoutcast Newage music station.. I just converted from a standalone region to adding it to the OSGrid.. It was a piece of cake... If you're in OSGrid, come by the Tasmania1 sim and say hi!!

Tas