Monday, August 03, 2009

Installing OpenSim to use over a LAN


OpenSim is an open source version of Second Life. You install, run, and configure it, set up a viewer, and it's your very own virtual world. SL has tons of object (prims) that are given away or sold and OpenSim is a blank slate. But it's yours and you have full control over who can access it and what they can do there. That makes it an excellent resource for teaching.

There are lots of tutorials on getting your own OpenSim up and running out there but 90% are just for standalone sandbox on your own machine and the rest are for grid mode in which you link your region with others out there on other people's machines. I'm writing this tutorial because I want to run my own sim but have my students connect to it through a client viewer on laptops connecting over our school's wireless network. The basic plan is installing the opensim service on a computer, installing MySQL so objects have permanence and don't have to be reactivated when the sim restarts or users log off, and giving that computer a static IP so client apps always know where to find it. With this setup you can run the sim on one computer and connect to it from any other computer on your school network, but it's not publicly available outside your school unless you open that IP up through the firewall (which I may consider later on). Here's how I did it (UPDATE 10/16: I've just upgraded to the newest version of OpenSim using Diva's Distribution, which makes all of the following pretty much obsolete. I'm just keeping the old steps below so I can look back some day and appreciate how far it's all come. It's now SO much easier. Here is the tutorial for the Diva approach.)
  1. Desktop running Windows XP SP3, assigned a static IP by the DNS server, no monitor, I just log in remotely. (Ask your system administrator to assign the IP if you, like me, can't.)
  2. MySQL 5.1 installed (good instructions here, a little old. The Toad (MySQL GUI) part is for an earlier version of Toad, but the idea is to create a root account and create a new database called 'opensim'. If you prefer you can use the mysql command line (tutorials here and here instead for mysql command line tools. No need to create any tables. OpenSim will do that on first run. Stop the first tutorial and continue to the next step when he gets to configuring the opensim.ini file because it's for an older version of OpenSim.
  3. Okay, now go download an opensim binary (look for the Windows binary on the right, soon to be version 0.6.6). The version I've installed is 'standalone' 0.6.3. The two flavors of OpenSim are standalone and grid mode and I spent two days thinking that since I wanted to share out my region with other computers on our LAN I needed grid mode (which is much more complicated to install). After much frustration (couldn't connect) it dawned on me that grid mode is for connecting regions over the internet. Standalone is what you want if you're just looking for an insulated virtual world not connected to the other regions out there.
  4. Run the installer but don't start OpenSim yet. First you need to edit some settings in the OpenSim.ini file you'll find among the many files in the Program Files\OpenSim folder. OpenSim.exe looks to this file for all of its configuration info so you set these here by adding and removing semi-colons so it will ignore and follow what you want it to.
  5. So open OpenSim.ini in a text editor.
  6. Under STORAGE add a semi-colon in front of storage_plugin = "OpenSim.Data.SQLite.dll"
    (and the next line "storage_connection_string" if it doesn't have one).
  7. You want it to use your MySQL database to store primitives and user attributes so they stay from one session to another. I believe the default, SQLite, isn't good with that. So remove the semi-colon from storage_plugin="OpenSim.Data.MySQL.dll" and the next line.
  8. One the connection string line you'll need to add your database details, storage_connection_string="Data Source=localhost;Database=opensim;User ID=root;Password=yourpassword;";
  9. Under the PHYSICS section you might want to uncomment the physics = OpenDynamicsEngine line. This physics algorithm prevents objects from going through each other whereas the default doesn't.
  10. The PERMISSIONS section allows you to set permissions (obviously) but I haven't played with that yet. I will definitely revisit those settings soon. Once OpenSim is running, you can shut it down, change settings, and restart it if you want to adjust things.
  11. In the STANDALONE section there are more SQLite settings and you need to change them to the same MySQL settings as in the STORAGE section.
  12. There are more interesting settings further down that I haven't investigated yet, like SUN for daytime and nighttime automation and VOICE for voice chat. I'll update when I get these figured out. You'll see below I'm not using the Hippo Opensim viewer but if you do you'll want to fill in the GRIDINFO section which gives the appropriate details to Hippo when you set it to your sim.
  13. Now go to exactly 3:00 here where they are starting OpenSim.exe and follow their steps, which continue on in part 2, EXCEPT where you put in the region IP (at 5:00) you'll want to put in the computer's fixed IP. You can stop when they get to downloading Hippo Viewer.
  14. I tried Hippo and it's great except that if students are connecting on Windows machines with network accounts Hippo has no way I could figure out of saving the sim IP as the default for all users on the machine. Instead, I downloaded the Second Life viewer, installed it on the student laptops, right clicked on the desktop icon (which will need to be moved to the All Users desktop and given full permissions to 'everyone') and added the following flag in the 'target' field: -loginuri http://fixed.ip.ad.dress:9000/ That reroutes the viewer to your sim rather than actual Second Life on the web. If you don't want the occasionally racy SL screenshots showing up either you can add -loginpagehttp://fixed.ip.ad.dress:9000/?method=login.
  15. Now with your sim running, open the SL viewer from the icon and login with the master avatar account you created. I hope it works!
  16. Finally, you might be wondering about voice chat. There's supposedly a module, explained here, that enables that through the SL viewer. We'll see. I've spent some time on this but I'll address it in a separate post because it turns out to be quite involved.

19 comments :

Justin Clark-Casey (justincc) said...

Hi Erik. You might be interested to know that there is a later binary of OpenSim 0.6.6 on the downloads page at

http://opensimulator.org/wiki/Download

For some reason the links on the front page (which still do show 0.6.3) haven't been updated yet. Hopefully this will happen soon.

0.6.6 might also require some changes in your tutorial though I can't tell you what there would be off the top of my head.

Erik N. said...

I see it is updated now...I had downloaded 0.6.3 about a month ago for this project. Currently trying to figure out activating voice chat. From what I read I need an experimental 'trunk' release. I'm no developer so I don't know what that entails but I assume this Freeswitch module isn't included in the binary version.

Erik N. said...

Oh, now I see, the front page, yes, still has 0.6.3.

Ricky Marrufo said...

Have anyone been able to connect to OpenSim on a LAN??

How does it works and what version do I use?? I only could do it in Standalone mode

Erik N. said...

@Ricky,
Standalone is for connecting over a LAN. I have a post on an easier setup over at this post. If you're just doing it at home, log in to your router and assign a specific IP to your computer running the sim, then other computers connect to that IP.

Anise Shaw said...

Thanks a ton for this. I was setting up stand alone for an art project to be used over LAN, and I was having troubles with prim storage. Your new version is great if you're just starting out, but I was silly and did all of my prim work before setting up the database. This older, longer version worked well for my trouble shooting.
Cheers!

Anonymous said...

Could anyone tell me how to import SQLITE database entries to MySQL?
I am by no means a programmer and the help would be greatly appreciated.

Erik N. said...

Converting from SQLite > SQL is very hard or impossible from what I can find. You either have to start over or save an OAR file, change over the database, and import the OAR. Look here for how to backup and restore data.

Anonymous said...

it's not so much the simulator but the asset file from the userbase. I tried the save IAR function but it appears to be argumentative about where the inventory path is, so I've not been successful in using it for userbase backup.

Justin Clark-Casey (justincc) said...

@Foxxe - Did you see the instructions on save iar at

http://opensimulator.org/wiki/Inventory_Archives

? There is a problem with save iar in the current development copies of OpenSim but any official release (such as 0.6.8) should be fine.

Anonymous said...

Actually there is a problem with 0.6.8 as far as I can see (as I AM using it)

I use the default path off the root;
F:\opensim-0.6.8-binaries\bin\
ALL db files are there, but I STILL get the following message:
[INVENTORY ARCHIVER]: Aborted save. Could not find inventory path /opensim-0.6.8-binaries/bin

I've been getting it with EVERY attempt with only the path being the difference... so far no luck at all. I've tried to decipher the precise path but the examples don't mention much on what is what.

Anonymous said...

I did find a work around. I Transferred everything from my inventory into objects, and left them in the sim and backed up the sim. There is just one other oddity I've not found. I got everything running off the MySQL db now but everytime I log in I have to REATTACH any prim attachments I might have on the avatar. What did I miss?

Justin Clark-Casey (justincc) said...

Hi Foxxe. For "save iar" there are two paths - the path to the folder or item in your avatar's inventory (e.g. Objects/My Stuff/Hairpiece) and the path to a save location on your filesystem (e.g. F:\opensim-0.6.8-binaries\bin\).

I suspect that you are accidentally specifying your file system path where the inventory path should be. You could try an inventory path of just "/" - this will save your entire inventory.

But as you say, putting everything in a box in the region and saving an OAR instead is a workaround.

Justin Clark-Casey (justincc) said...

I'm not sure why your attachments are failing though - normally this is only a problem on SQLite.

Anonymous said...

perfect! that explains what I was doing wrong. for future reference you might wanna point out that the path it's looking for IS in the inventory folder inworld (and not on the harddrive as I was looking)

Thanks again

Erik N. said...

Justin, I have a related question about OARs. I have a 4 x 4 standalone megaregion and I want to make OAR files with only 4 of the regions. When I change regions and do that on the command line all that gets backed up is the terrain, though. It appears that all the prims belong to the root region even though I'm rezzing them in regions 11, 12, 15, and 16. Is this because I have set CombineContiguousRegions=true? If I set it to false will it break things? And even if it doesn't would it figure out those prims belong to those regions?

Justin Clark-Casey (justincc) said...

@Erik - I'm not sure how well OARs work with megaregions at the moment. You might try looking through Diva's post at

http://www.metaverseink.com/blog/?p=28

for more details.

Unknown said...

Hi, I'm a 7-12 educator running a stand alone open sim on a Mac. I'd like to be able to have my students connect to it. We are already networked with the apple remote desktop. I'm going to try the steps above but I'm not sure if they're specific to windows. If anyone can be of assistance please email me. I am not super tech savy so I need pretty specific instructions.

rdillon4@schools.nyc.gov

RoyalGrid.servegame.com said...

I managed a Freeswitch version which works both on Windows and Linux using the apt install wine command. I just had to change the vocal plugins in Firestorme since Vivox modified the .exe