OpenSim – The definitive guide (sort of)


Aside from my M.Sc. degree, I am working on a project involving Virtual Worlds. For that, we are using OpenSim as the simulation server. While my server is fully functional now, not everything was easy. In fact, it was a bit complicated. Its configuration took more than a week (thanks to my ignorance and also probably laziness). Now that my server is up and running, I have compiled some instructions into this guide in order to help people overcome some problems in installing it. My focus is going to be in installing the server in Grid Mode with Hypergrid support on a machine with direct access to the internet, i.e. not behind a NAT (sorry for being so specific, but I’m only reproducing the steps I took to get it working).

First things first

Before installing the OpenSim server, we need to prepare the necessary infrastructure with regard to Operating System (OS) and database backend. Other configurations such as networking will not be covered by this guide due to the writer’s limited knowledge ;)

So, the OS chosen was Ubuntu 9.04 64bits. Why? Well, I tried to install on Windows XP Professional 64bits Service Pack 2, on Windows Vista Ultimate 64bits, Windows 7 Ultimate 64bits RC1 and Windows 7 Professional 64bits with no success. But, this does not mean that I cannot install on such OSes following this guide. It only means that the (wrong) steps I took have not returned any result, in fact, I forgot to do some configurations. Anyways, you can choose whatever OS you want, but this guide will focus on Ubuntu 9.04 64bits (and some tips on Windows OSes).

On Ubuntu, you can install MySQL executing the following command:

sudo apt-get install mysql-server

After installing MySQL, we need to prepare our database in order to store clients, assets, inventories, etc. The first step is to create a user on MySQL to be used by OpenSim. We will call the user opensim with password secret. In sequence, a database also needs to be created (we also will be calling it opensim) and finally the user opensim must have access rights to it. Such steps will not be explained here, for the sake of being focused.

Since the OpenSim is written in C#, we need the mono runtime and tools. In order to compile it, we need to install some additional packages:

sudo apt-get install mono-devel libmono-microsoft8.0-cil libmono-oracle2.0-cil nant

The first three packages install the mono development tools (including compiler) and some requirements for the server. The last one is used to start the build.

Downloading and Compiling OpenSim

In Ubuntu, I am using OpenSim version 0.6.6. The first step is to download the release in this link: http://dist.opensimulator.org/opensim-0.6.6-release.tar.gz

Then you need to extract its contents in a directory, thus creating the opensim-0.0.6-release directory. To compile it, just run:

$ ./runprebuild.sh
$ nant

The first command prepares the build and the second executes the building itself. After that, the sever is compiled and binaries are written under the opensim-0.0.6-release/bin directory.

Configuring Servers

With the server compiled, we need to configure each one. The methodology used here is the UGAIM, i.e. the servers will be configured following the order User, Grid, Asset, Inventory, Messaging. Open a command line and execute the first server:

./OpenSim.Grid.UserServer.exe

You need to answer some questions in order to configure the server. The ones we really need to pay attention are:

  • Deafult Grid Server URI, should look like http://myipaddress:8001 or http://myhostname:8001
  • Key to send to grid server, write 1234 and more important, don’t ask me why :P
  • Key to expect from grid server, as above write 1234
  • Default Inventory Server URI, should look like http://myipaddress:8004 or http://myhostname:8004
  • User Server (this) External URI for authentication keys, should look like http://myipaddress:8002 or http://myhostname:8002
  • Connection String for Database, should be data source=localhost;database=opensim;userid=opensim;password=secret;

As for the other options, just press enter and live with it. Now, execute the grid server:

./OpenSim.Grid.GridServer.exe

Answer the requirements as follows:

  • Default Asset Server, should look like http://myipaddress:8003 or http://myhostname:8003
  • Key to send to asset server, write 1234
  • Key to expect from asset server, write 1234
  • Default User Server URI, should look like http://myipaddress:8002 or http://myhostname:8002
  • Key to send to user server, write 1234
  • Key to expect from user server, write 1234
  • Key to send to a simulator, write 1234
  • Key to expect from a simulator, write 1234
  • Database connect string, should be data source=localhost;database=opensim;userid=opensim;password=secret;

Now it is time to configure the Asset server:

./OpenSim.Grid.AssetServer.exe

Answer the requirements as follows:

  • Database connect string, should be data source=localhost;database=opensim;userid=opensim;password=secret;

The Inventory server:

./OpenSim.Grid.InventoryServer.exe

Answer the requirements as follows:

  • Default Inventory Server URI (this server’s external name), should look like http://myipaddress:8004 or http://myhostname:8004
  • Default User Server URI, should look like http://myipaddress:8002 or http://myhostname:8002
  • Default Asset Server URI, should look like http://myipaddress:8003 or http://myhostname:8003
  • Database Connect String, should be data source=localhost;database=opensim;userid=opensim;password=secret;

And finally the Messaging server:

./OpenSim.Grid.MessagingServer.exe

Answer the requirements as follows:

  • Default User Server URI, should look like http://myipaddress:8002 or http://myhostname:8002
  • Key to send to user sever, write 1234
  • Key to expect from user server, write 1234
  • Default Grid Server URI, should look like http://myipaddress:8001 or http://myhostname:8001
  • Key to send to grid sever, write 1234
  • Key to expect from grid server, write 1234
  • Connection String for Database, should be data source=localhost;database=opensim;userid=opensim;password=secret;
  • My Published IP Address, should be the real IP Address of the machine where the server will execute on

After those steps, our servers are configured and ready. Now the last step is to configure the simulator. Before executing it, we will take a look at its configuration. Just copy the OpenSim.ini.example to OpenSim.ini and open it on a text editor.

Modify it to suit your needs and servers as follows:

  • Under [Startup] section
    • change both gridmode and hypergrid values to true
    • change storage_plugin value to “OpenSim.Data.MySQL.dll” and storage_connection_string value to “data source=localhost;database=opensim;userid=opensim;password=secret;”
    • change pyshics value to OpenDynamicsEngine
  • Under [Network] section
    • change grid_server_url value to “http://myipaddress:8001″ or to “http://myhostname:8001″
    • change both grid_send_key and grid_recv_key values to 1234
    • change user_server_url value to “http://myipaddress:8002″ or to “http://myhostname:8002″
    • change both user_send_key and user_recv_key values to 1234
    • change asset_server_url value to “http://myipaddress:8003″ or to “http://myhostname:8003″
    • change inventory_server_url value to “http://myipaddress:8004″ or to “http://myhostname:8004″
    • change messaging_server_url value to “http://myipaddress:8006″ or to “http://myhostname:8006″
  • Under [Architecture] section
    • comment the Include-Standalone line (just start the line with a comma)
    • uncomment the Include-HGGrid line (remove the comma at the beginning of the line)

The OpenSim.ini file is baked up, leaving us the architecture files to deal. The config-include directory has the needed files and examples. So, the final configuration steps are, on the config-include directory:

  • Copy the GridCommon.ini.example to GridCommon.ini
    • Under [AssetService] section, change AssetServerURI to http://myipaddress:8003 or http://myhostname:8003
    • Under [InventoryService] section, change InventoryServerURI to http://myipaddress:8004 or http://myhostname:8004
  • Copy the FloatsamCache.ini.example to FloatsamCache.ini

And that’s it. The simulator is finally configured and ready to be executed.

./OpenSim.exe

The last steps are creating a region, defining it’s position, and more importantly: defining the External Host Name which must be myipaddress or myhostname. Also, make sure that the Internal IP Address equals to 0.0.0.0.

I thinks that’s it. If you have any trouble following these steps, or find some errors, please drop a comment and I’ll be glad to help!

, ,

  1. #1 by Maria Korolov on September 3, 2009 - 10:20 am

    Pedro — Congrats on getting grid services to work! You seem to have gone through quite a bit of trouble for this — do you mind telling us what this grid will be used for?

    Myself, I run very small projects — less than six regions in size — so I’ve been able to avoid everything that you went through and just run a standalone. Of course, a standalone won’t be able to handle as many regions and users as a full grid can.

    For people who want a super-easy installation process, there’s even an auto setup process over on OSGrid — it automatically downloads and installs all the software and even configures your router for you: http://www.osgrid.org/elgg/pg/pages/view/52761/

    (That’s for people who want their regions automatically connected to OSGrid, a non-profit grid dedicated to OpenSim development and community building, and the largest grid running OpenSim.)

  2. #2 by Pedro Leite on September 3, 2009 - 1:20 pm

    Hi Maria,

    Thanks for commenting! This grid is part of a project sponsored by RNP (National Research Network) involving UFPE (Federal University of Pernambuco), UFABC (Federal University of ABC) and IFAL (Federal Institute of Alagoas).

    Basically, the main goal is to offer a service consisting of activities and research on virtual worlds to organizations who benefit from RNP services. With our solution, students can take classes from their home. The same applies to teachers, so they could prepare their classes (a PPT, for an example), upload it to our servers and present it to students.

    We are using open source technologies and a small modification to the SL viewer, so we are able to use data gloves.

    The connection between grids is done through HyperGrid technology, as you may know.

    For the link you sent, it is a great start point for everyone!

    Anyways, if you decide to change your architecture, using grid mode instead of standalone, I hope those steps help you!

    And finally, what kind of projects you run in your grid? Can you tell about them?

    Kind regards,
    Pedro.

(will not be published)