os_doOk, so starting off, there was a bit of trial and error involved here and a bit of backtracking.  I’ve done what I think is a good job of backtracking through my steps though to get all of the actual steps listed.  TWO!  I’m not going to vouch for this being 100% accurate anytime after posting.  My experience with OpenSIM is that every damn time seems to be completely different for SOME reason.  That said, it should still be mostly a good guide.

For the uninitiated, OpenSIM is basically an Open source, user controlled Second Life server instance.  It can be connected to other sims via the hypergrid protocols.  This guide does not cover anything involving Hypergrid or connecting to other grids.  It is for creating a private accessible from anywhere OpenSIM instance using Diva on Digital Ocean.  Diva is a pre configured OpenSIM stack deal and Digital Ocean is a Virtual Private Server (VPS) host.

The rest of this post is behind a cut…

Setting up Digital Ocean

The first job is to set up Digital Ocean for your own VPS.  You can follow this link to sign up.  Also, yeah, there is a referral code in there, using it would be appreciated.  You should get some credit ($10) for free just for signing up.  This is enough to run one Single Core, 512mb RAM, 20GB SSD VPS for two months.  You can also choose a larger tier if you prefer better performance out of your OS region (more on that at the end). 

You are essentially getting two months for free but you will have to add some sort of billing info to your account.  You can do a Credit Card for “nothing” you PayPal for an additional $5 charge.  I chose to do PayPal.  It just does a charge and doesn’t create any sort of billing agreement, so I know I won’t be charge in the future if I choose to discontinue my VPS.  The $5 also adds to your credit giving you 3 months of the low tier server, more then enough time to test things out.

Create an account, verify, set up billing and head to the Droplets page.

You will want to select the $5/mo tier, whatever region is closest to you, and Ubuntu 14.04 x64.  Other Ubuntu distros may work, other Linux distros may work, this guide uses the Ubuntu 14.04 x64 Droplet however so using other Droplets may cause some things to not quite work properly.

The Droplet will be created in about a minute and you will be emailed a Root password.  You will be forced to change the Root password on first log in.

Connecting to your VPS

After your droplet is created, you will need to connect to it via SSH.  Fire up your favorite SSH client, if you don’t have one, I recommend Putty, it’s pretty much the defacto standard.

You will also need the IP address of your Droplet.  Head on over to your Digital ocean dashboard, under Droplets and then under Settings.  This will tell you the IP information you will need to connect.  You’re going to need this several times so I recommend keeping this page open in a tab on your browser.

ScreenShot049

Connect to this IP in Putty using the SSH protocol.  The log in is “root” for the username and the password you were emailed.  When entering the password, no characters will show up on screen.  Also if you copy it (make sure to just do the password and no preceding of trailing spaces) you can right click and Putty will paste.  This is useful since you’ll also probably want to copy and paste several things directly from this guide.

Once connected you will be prompted to change the Root password.  make it whatever you want.

Prepping the Server

So, now on to the nitty gritty.  You can always look up more info one what most of this is if you need it, but I’m going to try to keep this pretty straightforward.

Anything presented here in a block quite and a # needs to be entered on the command line.  On the command line, in Ubuntu, we install using “apt-get install”.  You also need to add a “sudo” or “SuperuserDO” to each command.

DO NOT CUT AND PASTE THE #!  This represents the command prompt and is not necessary to run command.  It is mostly there to differentiate between multiple lines.  If a block has more than one line of #, then cut and paste each line individually.  due to word wrapping, some lines may wrap onto two lines, so look for the #!

First we need to update the install repositories.

# sudo apt-get update

Next, we need to install Mono and some dependencies.  Mono lets us run .net Windows apps which are not normally compatible with Linux.

# sudo apt-get install libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 libglu1-mesa:i386
# sudo apt-get install gstreamer0.10-pulseaudio:i386
# sudo apt-get install mono-complete

Next we need to install MySQL and NANT.  MySQL is a database which will store all of the asset data for our OpenSIM.  I’m not entirely sure what NANT does or is but one guide suggested it was needed to correct an issue with MySQL.  during the MySQL set up it will ask you for a password.  Make it whatever you want, you’ll need it anytime you are asked for a password in relation to MySQL.  If you want to make it the same as your Root password for simplicity, you can do that too.

# sudo apt-get install mysql-server mysql-client
# sudo apt-get install nant

Next we will need to configure an SQL database.  Get into the MySQL command prompt by entering the following then your Root password.

# sudo mysql -p

At the MySQL command prompt enter the following commands.

> CREATE DATABASE opensim;
> quit/exit; (one of these two)

This should drop you back to the Linux command prompt.

A side note here, if you are familiar with working with SQL you can also create a separate user and assign them permissions on this database.  I’m not covering this in the scope of this guide.  It’s good practice for security but this is a mostly private Virtual Server with nothing else running on it.  Ultimately there isn’t much threat if for some reason it was compromised.  If you plan to host an instance that others access, you may want to look into setting up a separate MySQL user.

We’ll need to punch some holes in the firewall in order to access our server remotely.  Enter the following two lines.

# iptables -A INPUT -p tcp –dport 9000 -j ACCEPT
# iptables -A INPUT -p udp –dport 9000 -j ACCEPT

This will open TCP and UDP ports on port 9000, which is what OpenSIM uses.  A note on ports.  This guide uses the default Diva Distribution, which creates one Mega Region (one region the size of a 2×2 Block of SL regions).  If you create more regions, OpenSIM assigns ports to them sequentially, so 9001, 9002, and so on.  You will need to run these commands for each new region you add changing the port number each time.  This guide does not cover adding more regions.

Before I move on, you’ll need to install two more utilities we’ll use later.  Run each of the following.

# sudo apt-get install unzip
# sudo apt-get install screen

Unzip is a standard utility to open Zip files, Screen will be used later to let our OpenSIM instance continue to run after closing the Putty instance.

Set up Diva (OpenSIM)

I had a bit of an issue getting the link to Diva.  You can find Diva here: http://metaverseink.com/Downloads.html .  The problem si those links use some screwy script to count clicks.  As of this writing, the following command works to download the actual zip file directly.

# sudo wget http://metaverseink.com/download/diva-r25084.zip

If the version changes, change the version in that command to match whatever version is listed on the download pages.  I got the URL by downloading Diva locally with Firefox.  By right clicking the download I could “copy download link”.

After the download finishes, you’ll need to unzip it.

# unzip diva-r25084.zip -d diva

Again, if there is a different version, you’ll change the version number to match.

Navigate to the directory containing the files you’ll need to launch OpenSIM.

# cd diva
# cd diva-r25084
# cd bin

Now run the Configuration tool.

# mono Configure.exe

This will ask you several questions.  Your MySQL is as localhost which I believe is the default.  Your external IP/Domain is your Digital Ocean IP address.  You CAN assign a real domain name if you want a friendlier name but that is beyond the scope of this guide.  The short is, you’ll need to set up your domain via the registrar to point to the IP of your Digital Ocean VPS. 

Be sure to use your MySQL password and not your Root password (unless you just made them the same).  The MySQL username is “root” though (unless you changed it).

If you don’t plan to let people create their own user accounts you can ignore and leave blank all of the email information.

We are nearly done!  Home stretch time now.

First time to run now…

# mono OpenSim.exe

This should start the server.  First run will take a bit as it initializes the database.  Once it runs through some loading you should get a message about Logins ready.

Connect with your viewer of choice, I recommend Firestorm.  I tried Singularity but I got some errors, however my copy of Singularity may be outdated.

NOTE: For Firestorm you will need to install the version on the link above for “SL & OpenSIM”.  The normal version only works with the Second Life Official Grids.

You’ll need to add the Grid to the list to connect.  In Firestorm, this si in Preferences under “OpenSIM”.  the URL will be http://<IP OF SERVER”">:9000/ .  For example, if the IP was 127.0.0.1, your URL would be http://127.0.0.1:9000/.

ScreenShot045

When you connect, you should be able to see some stuff happening on the Putty Window pertaining to your log in.

If you get errors, I recommend Googling for the error word for word (maybe with the word OpenSIM added before or after).

Once you know everything is working, Log out of the server on your viewer.

In Putty, close the OpenSIM instance by typing “Quit”.

Once you are back at the Command Prompt, enter the following command to run OpenSIM in a Screen Instance so it will continue to work after you close Putty.

# screen -S OpenSim -d -m mono OpenSim.exe -gridmode=true

This appears to do nothing but it’s actually starting up OpenSIM in the background.  You can read more about manipulating Screen here.

You should now be able to connect to your own Private Region from anywhere.  You can also create user accounts and let your friends connect.

Performance

I have not really had a chance to extensively test performance.  512mb of RAM is likely going to be the clencher here, OpenSIM recommends 1gb.  I found it to be a wee bit laggy but not awful and my bandwidth kind of sucks anyway.  I don’t plan to add a ton of other users so that may cause a performance hit as well.  Scripts will cause some lag too.  It’s not going to be perfect but it should work pretty well as a private repository/sandbox/showroom.

References I used:
https://github.com/diva/d2/wiki/Installation
https://ariejan.net/2007/12/12/how-to-install-mysql-on-ubuntudebian/
http://www.sutor.com/c/2014/02/virtual-life-with-linux-standalone-opensim-on-ubuntu-13-10/
http://forums.osgrid.org/viewtopic.php?f=14&t=1965

4 thoughts on “Roll Your Own OpenSIM with Digital Ocean”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.