How to link your OpenSim region to Infinite Grid (Linux/MySQL)

1 post / 0 new
This is intended for people with some familiarity with command line tools, text editors, ssh, etc. It is also aimed at people who will be running many sims and regions on their remote server. If you just want to run one or two sims on your own computer, there are many shortcuts you can do to set up faster.

NOTE - The far easier way, and he highly recommended way, to install OpenSim for linking a region to Infinite Grid is to use onefang's version of OpenSim at http://www.infinitegrid.org/viewers/opensim-IG-0.8.2.1.tar.bz2 which does most of the below for you. It's source code is at https://github.com/onefang/opensim-IG

Remember, when in doubt, put the error message into your favourite web search engine, ixquick.com is mine, and enjoy reading possibly related problems and solutions. Never hurts to read more before you try fixing something.

If you have never run an OpenSim Server before then you should set up a standalone using Diva's D2 system (download found on http://opensimulator.org/wiki/Main_Page ). Diva has a very much simplified set up (5 steps, 6 for Linux/Mac) and running the standalone will introduce you to the concepts and file structure used here.

In addition to my linked regions, I have a Diva standalone on a spare machine that I use for experiments and trying things out. It has saved me many hours of research and fixing mistakes!

Please help make this better. If you find a rough spot (or plain old mistake or bug) update the section with comments about the problem you found and how you solved it. This wouldn't be nearly as nice a guide with out all the help I received; props to Rizzy and onefang for their original design / battle plan, to my brave first vic... uh... volunteer Waki, and for all the tweeks and enhancements from Karen Palen, (and probably others who have been quieter about their enhancements or less lucky in the what can Alice remember lottery). Thanks y'all!

Passwords

By the end of this, if you are doing everything right, you will have about 5 or 6 new passwords. I find remembering a bunch of good passwords hard. I recommend using a program called KeePassX to remember all your usernames and passwords.

To make good passwords, especially important ones like the one for keepassx, follow the instructions at http://diceware.com or http://world.std.com/~reinhold/diceware.html . Read the whole page, but the instructions actually start in the section "Using Diceware"

 

Make an admin user account

Since my helpful tester was waki, I will use 'waki' in many of the examples. Unless you actually use that name, or really like it alot, you probably want to use something else.

Login in to your remote host as root using ssh, command:

   ssh root@host.example

My host is ngiw.co, and it's name will show up in the examples. Your host probably will have a different name.

 

adduser

Add a new user

   root@NGIW:~# adduser waki
   Adding user `waki' ...
   Adding new group `waki' (1003) ...
   Adding new user `waki' (1002) with group `waki' ...
   Creating home directory `/home/waki' ...
   Copying files from `/etc/skel' ...
   Enter new UNIX password:
   Retype new UNIX password:
   passwd: password updated successfully
   Changing the user information for waki
   Enter the new value, or press ENTER for the default
       Full Name []: waki
       Room Number []:
       Work Phone []:
       Home Phone []:
       Other []:
   Is the information correct? [Y/n] y

Entering value like Full Name etc. are optional and can be changed later. Lot's of command line programs will ask you questions that look like

   Want fries with that [Y/n]?
   What is your favorite color [blue]?

Sometimes they are telling you the default answer, sometimes the kinds of answers they expect. In this case it's telling you "You can enter y or n, the default is y" and not telling you "I'm an idiot and think Y is the same as n." If you aren't sure and have to guess, on linux guess lowercase. And think of most prompts that end with stuff in [...] as the next button on an GUI instalation wizard, you *might* someday want to enter something other than the default.

 

enable sudo

Next give waki rights to sudo, run the command visudo.

   root@NGIW:~# visudo

The screen will clear and go into the program nano, a simple text editor. The screen will look something like:

   GNU nano 2.2.2            File: /etc/sudoers.tmp
   # /etc/sudoers
   #
   # This file MUST be edited with the 'visudo' command as root.
   #
   # See the man page for details on how to write a sudoers file.
   #
   
   Defaults        env_reset
   
   # Host alias specification
   
   # User alias specification
   
   # Cmnd alias specification
   
   # User privilege specification
   root    ALL=(ALL) ALL

this starts nano eiditing a special file. use arrows to get down to the end of the root line just after ALL. Hit enter and add

   waki  ALL=(ALL) ALL

NOTE Type a tab after waki, not spaces; and a space after (ALL), not a tab.

then save your changes and exit, type control-o, then enter when asked for a file name (using the default file name), then control-x

 

Test your work

Login as waki using ssh in a new window. Use the password you supplied above. Test sudo permissions with the command: "SUDO LS -LA" but use all lowercase.

   waki@NGIW:~$ sudo ls -la
   [sudo] password for waki:
   total 24
   drwxr-xr-x 3 waki waki 4096 2011-07-30 23:32 .
   drwxr-xr-x 6 root root 4096 2011-07-30 23:06 ..
   -rw-r--r-- 1 waki waki  220 2011-07-30 23:06 .bash_logout
   -rw-r--r-- 1 waki waki 3103 2011-07-30 23:06 .bashrc
   drwx------ 2 waki waki 4096 2011-07-30 23:32 .cache
   -rw-r--r-- 1 waki waki  675 2011-07-30 23:06 .profile

 

LOG YOUR ROOT SHELL OUT!!!

The root user is cool, it can do any thing. But doing things logged in as root, it's kinda like running with scissors, only these scissors are more like a lightsaber crossed with anthrax and hydrogen bombs. You want to be logged in as root as rarely as possible, and for as little time as possible. Almost anything root can do, you can do with sudo.

   root@NGIW:~# exit
   logout
   Connection to ngiw.co closed.

 

Stuffs the instalation needs

Would be cool if you could just download a thingy and go huh? Setting up a server is not a click and go exercise though, and we have a buncha stuff to do before we even begin putting opensim on the computer.

 

 

mysql?

If you are going to use mysql, and not sqllite, you need to be sure you have it installed. Try:

   waki@NGIW:/opt/opensim/config$ which mysql
   /usr/bin/mysql
   waki@NGIW:/opt/opensim/config$ mysql --version
   mysql  Ver 14.14 Distrib 5.1.41, for debian-linux-gnu (x86_64) using readline 6.1

If you get an error, or just a prompt again like:

   waki@NGIW:/opt/opensim/config$ which mysql
   waki@NGIW:/opt/opensim/config$

check your spelling, or install mysql. (Instead of 'mysql', I typed 'myslq' above, then Karen fixed it, Thanks Karen!)

To get help installing msql see https://help.ubuntu.com/10.04/serverguide/C/mysql.html On Ubuntu 10.10 we had to do the following 4 commands to install mysql:

   sudo dpkg --configure -a
   sudo apt-get clean
   sudo apt-get update
   sudo apt-get install mysql-server

(NOTE: Having to use dpkg --configure -a often means that a previous install did not complete, so you likely wont have to do this.)

How ever it goes, pre-installed, or you-installed, you may also want to set the root password, see http://www.cyberciti.biz/faq/mysql-change-root-password/

Next, configure mysql for opensim.

 

Diva: howto set up mysql for opensim

This is 99% stuff from the Diva distro of Opensim, thanks Diva! All the mistakes are mine. Start the command line console for the mysql root account.

   waki@NGIW:/opt/opensim/config$ mysql -u root -p -h localhost

If this doesn't work, try su or sudo as root

   waki@NGIW:/opt/opensim/config$ sudo mysql

Next, create a schema called opensim:

   mysql> create database opensim;

create a user account called opensim with any passwd you want. Please choose a good password!

   mysql> create user opensim identified by 'your_password_here';
   mysql> create user 'opensim'@'localhost' identified by 'your_password_here';

give all privileges to that user for access to the opensim schema:

   mysql> grant all on opensim.* to opensim;
   mysql> grant all on opensim.* to 'opensim'@'localhost';

make MySql server reload the user data:

   mysql> FLUSH PRIVILEGES;

NOTE: The 2 middle commands are only available for MySQl 5. If your installation is older, or if they don't work, do this instead:

   mysql> use mysql;
   mysql> insert into user (Host, User, Password, Select_priv,
   Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,
   Reload_priv,Process_priv,File_priv,References_priv,Index_priv,
   Alter_priv) VALUES ('localhost','opensim',
   PASSWORD('your_password_here'),
   'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
   mysql> FLUSH PRIVILEGES;

Finally do

   mysql> exit;

to get out of mysql.

All of the places above where it has 'your_password_here' you want to put something like 'mYseKr37Pa55wurD', including the ' marks.

 

howto start and stop mysql server

If you can't get the mysql> prompt, maybe the server hasn't been started.

Start MySQL server by using the command:

   waki@NGIW:/opt/opensim/config$ sudo /etc/init.d/mysql start

Stop MySQL server by using the command:

   waki@NGIW:/opt/opensim/config$ sudo /etc/init.d/mysql stop

 

GNU Screen

GNU screen is an indespensible tool for running remote servers. You may not have it installed either. Try "which screen" and/or "screen --version" to see if you do.

   waki@NGIW:/opt/opensim/config$ which screen
   /usr/bin/screen
   waki@NGIW:/opt/opensim/config$ screen --version
   Screen version 4.00.03jw4 (FAU) 2-May-06

If you don't then

   waki@NGIW:/opt/opensim/config$ sudo apt-get install screen

 

Mono

OpenSim.exe is a program written in C#, to run it on Linux machines you need the Mono package. First, check if you have it:

   waki@NGIW:/opt/opensim/config$ which mono
   /usr/bin/mono
   waki@NGIW:/opt/opensim/config$ mono --version
   Mono JIT compiler version 2.4.4 (Debian 2.4.4~svn151842-1ubuntu4)
   Copyright (C) 2002-2010 Novell, Inc and Contributors. www.mono-project.com
           TLS:           __thread
           GC:            Included Boehm (with typed GC)
           SIGSEGV:       altstack
           Notifications: epoll
           Architecture:  amd64
           Disabled:      none

If you don't, do:

   waki@NGIW:/opt/opensim/config$ sudo apt-get install mono-complete

This might also work if you have mono, but scripts aren't compiling (you see an error about something like "gw not found".)

 

Real instalation

Now begin the instalation of opensim.

 

make opensim user

To help keep your host secure, you will make a user with very few permissions that will only be used to run opensim. Login as an admin user, and make the user that will run opensim.

   waki@NGIW:~$ sudo adduser --system --shell /bin/false --group opensim
   Adding system user `opensim' (UID 106) ...
   Adding new group `opensim' (GID 111) ...
   Adding new user `opensim' (UID 106) with group `opensim' ...
   Creating home directory `/home/opensim' ...

Among the many things opensim, the user, can not do is login.

 

make the log directory

   waki@NGIW:/opt/opensim/config$ sudo mkdir /var/log/opensim
   [sudo] password for waki:
   waki@NGIW:/opt/opensim/config$ sudo chown opensim:opensim /var/log/opensim
   waki@NGIW:/opt/opensim/config$ ls -la /var/log/opensim
   total 8
   drwxr-xr-x  2 opensim opensim 4096 2011-07-31 02:09 .
   drwxr-xr-x 13 root    root    4096 2011-07-31 02:09 ..

 

make /opt/opensim

Now make the place to keep all the opensim software.

   waki@NGIW:~$ sudo mkdir /opt/opensim
   waki@NGIW:~$ sudo chown waki:waki /opt/opensim
   waki@NGIW:~$ cd /opt/opensim
   waki@NGIW:/opt/opensim$ ls -lad .
   drwxr-xr-x 2 waki waki 4096 2011-07-30 23:45 .

 

get the distro

Get the version of opensim you want to run, I recommend the one from the IG forums. Currently that is

https://github.com/downloads/infinitegrid/InfiniteGrid-Opensim/opensim-0.7.1.1-infinitegrid-03.tar.bz2

but check the forums for more recent builds. Start with http://forums.infinitegrid.org/viewtopic.php?f=7&t=52

   waki@NGIW:/opt/opensim$ wget https://github.com/downloads/infinitegrid/InfiniteGrid-Opensim/opensim-0.7.1.1-infinitegrid-03.tar.bz2
   --2011-07-31 00:06:32--  https://github.com/downloads/infinitegrid/InfiniteGrid-Opensim/opensim-0.7.1.1-infinitegrid-03.tar.bz2
   Resolving github.com... 207.97.227.239
   Connecting to github.com|207.97.227.239|:443... connected.
   HTTP request sent, awaiting response... 302 Found
   Location: http://cloud.github.com/downloads/infinitegrid/InfiniteGrid-Opensim/opensim-0.7.1.1-infinitegrid-03.tar.bz2 [following]
   --2011-07-31 00:06:33--  http://cloud.github.com/downloads/infinitegrid/InfiniteGrid-Opensim/opensim-0.7.1.1-infinitegrid-03.tar.bz2
   Resolving cloud.github.com... 216.137.59.182, 216.137.59.188, 216.137.59.224, ...
   Connecting to cloud.github.com|216.137.59.182|:80... connected.
   HTTP request sent, awaiting response... 200 OK
   Length: 26018959 (25M) [.bz2]
   Saving to: `opensim-0.7.1.1-infinitegrid-03.tar.bz2'
   
   100%[===================================================================================>] 26,018,959   700K/s   in 35s
   
   2011-07-31 00:07:08 (717 KB/s) - `opensim-0.7.1.1-infinitegrid-03.tar.bz2' saved [26018959/26018959]

 

make the 'standard' directory structure

We are a bit of neat freaks here at IG. The folowing is more complicated than what you have to do, but makes upgrading easier, and maintaining easier. Hopefully at the end you will see why it is the way it is.

   waki@NGIW:/opt/opensim$ mkdir config
   waki@NGIW:/opt/opensim$ mkdir modules

We give each simulator a directory with a very boring name, sim01, sim02 etc. And we put all the configuration files in config, and all the thridparty dlls etc in modules.

 

unpack the distro into sim01

Now lets make our first simulator, sim01

   waki@NGIW:/opt/opensim$ mkdir sim01
   waki@NGIW:/opt/opensim$ cd sim01

Check the tar looks OK

   waki@NGIW:/opt/opensim/sim01$ tar tvjf ../opensim-0.7.1.1-infinitegrid-03.tar.bz2 | head
   tar: Record size = 8 blocks
   drwxr-xr-x riseon/riseon     0 2011-06-19 01:22 opensim-0.7.1.1-infinitegrid-03/
   drwxr-xr-x riseon/riseon     0 2011-06-19 01:18 opensim-0.7.1.1-infinitegrid-03/share/
   drwxr-xr-x riseon/riseon     0 2011-06-19 01:18 opensim-0.7.1.1-infinitegrid-03/share/Schemas/
   -rw-r--r-- riseon/riseon  9837 2011-06-19 01:18 opensim-0.7.1.1-infinitegrid-03/share/Schemas/SceneObjectPart0.xsd
   -rw-r--r-- riseon/riseon   449 2011-06-19 01:18 opensim-0.7.1.1-infinitegrid-03/share/Schemas/SceneObjectPart1.xsd
   drwxr-xr-x riseon/riseon     0 2011-06-19 01:18 opensim-0.7.1.1-infinitegrid-03/share/RegionLoading/
   -rw-r--r-- riseon/riseon   684 2011-06-19 01:18 opensim-0.7.1.1-infinitegrid-03/share/RegionLoading/example_web.xml
   -rw-r--r-- riseon/riseon   633 2011-06-19 01:18 opensim-0.7.1.1-infinitegrid-03/share/RegionLoading/HOWTO_REMOTE_REGION_LOADING.txt
   drwxr-xr-x riseon/riseon     0 2011-06-19 01:18 opensim-0.7.1.1-infinitegrid-03/share/php/
   -rwxr-xr-x riseon/riseon  1640 2011-06-19 01:18 opensim-0.7.1.1-infinitegrid-03/share/php/generateUserFunction.php

unpack it

   waki@NGIW:/opt/opensim/sim01$ tar xjf ../opensim-0.7.1.1-infinitegrid-03.tar.bz2

make a symlink

   waki@NGIW:/opt/opensim/sim01$ ln -s ./opensim-0.7.1.1-infinitegrid-03 current

and check our work.

   waki@NGIW:/opt/opensim/sim01$ ls -la
   total 12
   drwxr-xr-x 3 waki waki 4096 2011-07-31 00:29 .
   drwxr-xr-x 5 waki waki 4096 2011-07-31 00:15 ..
   lrwxrwxrwx 1 waki waki   33 2011-07-31 00:29 current -> ./opensim-0.7.1.1-infinitegrid-03
   drwxr-xr-x 9 waki waki 4096 2011-06-19 01:22 opensim-0.7.1.1-infinitegrid-03

 

more IG standard organization stuff

Now move a bunch of files making symlinks. First OpenSim.ini

   waki@NGIW:/opt/opensim/sim01$ cd current/bin
   waki@NGIW:/opt/opensim/sim01/current/bin$ mv OpenSim.ini ../../../config/sim01.opensim.ini
   waki@NGIW:/opt/opensim/sim01/current/bin$ ln -s ../../OpenSim.ini OpenSim.ini
   waki@NGIW:/opt/opensim/sim01/current/bin$ cd ../..
   waki@NGIW:/opt/opensim/sim01$ ln -s ../config/sim01.opensim.ini OpenSim.ini
   waki@NGIW:/opt/opensim/sim01$ ls -la
   total 12
   drwxr-xr-x 3 waki waki 4096 2011-07-31 00:45 .
   drwxr-xr-x 5 waki waki 4096 2011-07-31 00:15 ..
   lrwxrwxrwx 1 waki waki   33 2011-07-31 00:29 current -> ./opensim-0.7.1.1-infinitegrid-03
   drwxr-xr-x 9 waki waki 4096 2011-06-19 01:22 opensim-0.7.1.1-infinitegrid-03
   lrwxrwxrwx 1 waki waki   27 2011-07-31 00:45 OpenSim.ini -> ../config/sim01.opensim.ini

Now OpenSim.exe.config

   waki@NGIW:/opt/opensim/sim01$ cd current/bin
   waki@NGIW:/opt/opensim/sim01/current/bin$ mv OpenSim.exe.config ../../../config/sim01.opensim.exe.config
   waki@NGIW:/opt/opensim/sim01/current/bin$ ln -s ../../OpenSim.exe.config OpenSim.exe.config
   waki@NGIW:/opt/opensim/sim01/current/bin$ cd ../..
   waki@NGIW:/opt/opensim/sim01$ ln -s ../config/sim01.opensim.exe.config OpenSim.exe.config
   waki@NGIW:/opt/opensim/sim01$ ls -la
   total 12
   drwxr-xr-x 3 waki waki 4096 2011-07-31 00:50 .
   drwxr-xr-x 5 waki waki 4096 2011-07-31 00:15 ..
   lrwxrwxrwx 1 waki waki   33 2011-07-31 00:29 current -> ./opensim-0.7.1.1-infinitegrid-03
   drwxr-xr-x 9 waki waki 4096 2011-06-19 01:22 opensim-0.7.1.1-infinitegrid-03
   lrwxrwxrwx 1 waki waki   34 2011-07-31 00:50 OpenSim.exe.config -> ../config/sim01.opensim.exe.config
   lrwxrwxrwx 1 waki waki   27 2011-07-31 00:45 OpenSim.ini -> ../config/sim01.opensim.ini

Now a couple dll's

   waki@NGIW:/opt/opensim/sim01$ cd current/bin
   waki@NGIW:/opt/opensim/sim01/current/bin$ mv OpenSim.Forge.Currency.dll ../../../modules/
   waki@NGIW:/opt/opensim/sim01/current/bin$ ln -s ../../../modules/OpenSim.Forge.Currency.dll OpenSim.Forge.Currency.dll
   waki@NGIW:/opt/opensim/sim01/current/bin$ mv OpenSimSearch.Modules.dll ../../../modules/
   waki@NGIW:/opt/opensim/sim01/current/bin$ ln -s ../../../modules/OpenSimSearch.Modules.dll OpenSimSearch.Modules.dll
   waki@NGIW:/opt/opensim/sim01/current/bin$ ls -la ../../../modules/
   total 56
   drwxr-xr-x 2 waki waki  4096 2011-07-31 00:54 .
   drwxr-xr-x 5 waki waki  4096 2011-07-31 00:15 ..
   -rwxr-xr-x 1 waki waki 29184 2011-06-19 01:20 OpenSim.Forge.Currency.dll
   -rwxr-xr-x 1 waki waki 16384 2011-06-19 01:21 OpenSimSearch.Modules.dll
   waki@NGIW:/opt/opensim/sim01/current/bin$ ls -la OpenSimSea*.dll OpenSim.Fo*.dll
   lrwxrwxrwx 1 waki waki 43 2011-07-31 00:54 OpenSim.Forge.Currency.dll -> ../../../modules/OpenSim.Forge.Currency.dll
   lrwxrwxrwx 1 waki waki 42 2011-07-31 00:55 OpenSimSearch.Modules.dll -> ../../../modules/OpenSimSearch.Modules.dll

Two more dll's

   waki@NGIW:/opt/opensim/sim01/current/bin$ mv NSLModules.Messaging.MuteList.dll ../../../modules/
   waki@NGIW:/opt/opensim/sim01/current/bin$ ln -s ../../../modules/NSLModules.Messaging.MuteList.dll NSLModules.Messaging.MuteList.dll
   waki@NGIW:/opt/opensim/sim01/current/bin$ mv OpenSimProfile.Modules.dll ../../../modules/
   waki@NGIW:/opt/opensim/sim01/current/bin$ ln -s ../../../modules/OpenSimProfile.Modules.dll OpenSimProfile.Modules.dll
   waki@NGIW:/opt/opensim/sim01/current/bin$ ls -la ../../../modules/*dll
   -rwxr-xr-x 1 waki waki  7680 2011-06-19 01:20 ../../../modules/NSLModules.Messaging.MuteList.dll
   -rwxr-xr-x 1 waki waki 29184 2011-06-19 01:20 ../../../modules/OpenSim.Forge.Currency.dll
   -rwxr-xr-x 1 waki waki 28672 2011-06-19 01:21 ../../../modules/OpenSimProfile.Modules.dll
   -rwxr-xr-x 1 waki waki 16384 2011-06-19 01:21 ../../../modules/OpenSimSearch.Modules.dll
   waki@NGIW:/opt/opensim/sim01/current/bin$ ls -la OpenSimPro*dll NSLMod*
   lrwxrwxrwx 1 waki waki 50 2011-07-31 01:03 NSLModules.Messaging.MuteList.dll -> ../../../modules/NSLModules.Messaging.MuteList.dll
   lrwxrwxrwx 1 waki waki 43 2011-07-31 01:01 OpenSimProfile.Modules.dll -> ../../../modules/OpenSimProfile.Modules.dll

Two .ini files, and we are close to done

   waki@NGIW:/opt/opensim/sim01/current/bin$ cd config-include/
   waki@NGIW:/opt/opensim/sim01/current/bin/config-include$ mv GridCommon.ini ../../../../config/sim01.gridcommon.ini
   waki@NGIW:/opt/opensim/sim01/current/bin/config-include$ mv FlotsamCache.ini ../../../../config/sim01.flotsamcache.ini
   waki@NGIW:/opt/opensim/sim01/current/bin/config-include$ ln -s ../../../../config/sim01.gridcommon.ini GridCommon.ini
   waki@NGIW:/opt/opensim/sim01/current/bin/config-include$ ln -s ../../../../config/sim01.flotsamcache.ini FlotsamCache.ini
   waki@NGIW:/opt/opensim/sim01/current/bin/config-include$ ls -la GridC*ini Flots*ini
   lrwxrwxrwx 1 waki waki 41 2011-07-31 01:17 FlotsamCache.ini -> ../../../../config/sim01.flotsamcache.ini
   lrwxrwxrwx 1 waki waki 39 2011-07-31 01:17 GridCommon.ini -> ../../../../config/sim01.gridcommon.ini
   waki@NGIW:/opt/opensim/sim01/current/bin/config-include$ ls -la ../../../../config/sim01*
   -rw-r--r-- 1 waki waki  2090 2011-06-19 01:18 ../../../../config/sim01.flotsamcache.ini
   -rw-r--r-- 1 waki waki  3476 2011-06-19 01:18 ../../../../config/sim01.gridcommon.ini
   -rwxr-xr-x 1 waki waki  1203 2011-06-19 01:18 ../../../../config/sim01.opensim.exe.config
   -rw-r--r-- 1 waki waki 33908 2011-06-19 01:18 ../../../../config/sim01.opensim.ini

 

Make your regions.ini!

Here we make a new sim! You will need a cool name (maybe "Waki Test"?), a NEW UUID (goto this url: http://www.famkruithof.net/uuid/uuidgen and you will see in big letters a new UUID), and a position. You can go inworld and look around on the map to find a free spot, and compare with the list at http://infinitegrid.org/map/index.php. Numbers get bigger to the East and to the North; the first number is for East/West the second for North/South.

   waki@NGIW:/opt/opensim/sim01/current/bin/config-include$ cd ..
   waki@NGIW:/opt/opensim/sim01/current/bin$ cd Regions/
   waki@NGIW:ln -s /opt/opensim/config/sim01.regions.ini Regions.ini
   waki@NGIW:/opt/opensim/sim01/current/bin/Regions$ ls -la
   total 24
   drwxr-xr-x  2 waki waki  4096 2011-07-31 01:24 .
   drwxr-xr-x 11 waki waki 20480 2011-07-31 01:03 ..
   -rw-r--r--  1 waki waki     0 2011-06-19 01:18 .keep
   lrwxrwxrwx  1 waki waki    36 2011-07-31 01:24 Regions.ini -> ../../../../config/sim01.regions.ini
   waki@NGIW:/opt/opensim/sim01/current/bin/Regions$ cd ../../../../config/
   waki@NGIW:/opt/opensim/config$ ls -la
   total 56
   drwxr-xr-x 2 waki waki  4096 2011-07-31 01:16 .
   drwxr-xr-x 5 waki waki  4096 2011-07-31 00:15 ..
   -rw-r--r-- 1 waki waki  2090 2011-06-19 01:18 sim01.flotsamcache.ini
   -rw-r--r-- 1 waki waki  3476 2011-06-19 01:18 sim01.gridcommon.ini
   -rwxr-xr-x 1 waki waki  1203 2011-06-19 01:18 sim01.opensim.exe.config
   -rw-r--r-- 1 waki waki 33908 2011-06-19 01:18 sim01.opensim.ini

Now make the actual sim01.regions.ini

   waki@NGIW:/opt/opensim/config$ nano sim01.regions.ini

And we are back in our friend Nano. Make the file look something like below. DO NOT copy the UUID or name from my example below, it won't work for you. Make up your own name and get your own UUID. You will need to change the InternalAddress and ExternalHostName to be your IP and either DNS name (URL) or IP.

   [Waki Test]
   RegionUUID = 6c38e16d-9a4f-42db-9d71-102529d4437a  <----- what is there about "UNIQUE" that you did not understand? see: https://secure.wikimedia.org/wikipedia/en/wiki/Uuid
   Location = 9996,10007                              <----- again UNIQUE (i.e. ONLY ONE) per grid in THIS case!
   InternalAddress = 0.0.0.0                          <----- 0.0.0.0 will work for a single sim per physical machine
   InternalPort = 9003                                <----- 9002 is used for HTTP/UDP so START with port 9003! CAUTION Diva/D2 starts at port 9000
   AllowAlternatePorts = False                        <----- NEVER change this - ***EVER***!!! It screws things up beyond belief!
   ExternalHostName = myregion.org                    <----- URL is best (without the HTTP://), but IP (e.g. 88.109.81.55) works too

Then, like when we gave waki sudo rights, control-o and enter to save, and control-x to exit.

CAUTION: be VERY careful about added garbage at the end of the file! Like the commands at the bottom of the nano screen! :-(

waki@NGIW:/opt/opensim/config$ cat sim01.regions.ini    <----- check EXACTLY what is in the file!

 

read the ini files

Now, read every line of every file in the config directory. You need to know what options you have, and you need to make a few changes before you start.

See testing (below) to set up any custom options that you may wish to use - get it WORKING first, then add any options!

Karen: YES Alice really means this and she is RIGHT! (Ask me how I know :-( )

 

change port in opensim.ini

Did you read every line of every file in the config directory? I hope so.

Edit opensim.ini,

   waki@NGIW:/opt/opensim/config$ nano sim01.opensim.ini

After you have read the whole file, go to the top and type control-w then http to seach for http_listener_port. You should set it to 9002. The few lines around your change should look like:

   ;; the region ports use UDP.
   ;http_listener_port = 9000
   http_listener_port = 9002
   
   ;# {ExternalHostNameForLSL} {} {Hostname to use for HTTP-IN URLs. This should be reachable from the internet.} {}

 

mysql changes in gridcommon.ini

If you are using mysql, you will need to change sim01.gridcommon.ini

   waki@NGIW:/opt/opensim/config$ nano sim01.gridcommon.ini

Right near the top you will see

   ; SQLite
   Include-Storage = "config-include/storage/SQLiteStandalone.ini";
   
   ; MySql
   ; Uncomment these lines if you want to use mysql storage
   ; Change the connection string to your db details
   ; StorageProvider = "OpenSim.Data.MySQL.dll"
   ; ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=****;"

You want to change to

   ; SQLite
   ; Include-Storage = "config-include/storage/SQLiteStandalone.ini";
   
   ; MySql
   ; Uncomment these lines if you want to use mysql storage
   ; Change the connection string to your db details
   StorageProvider = "OpenSim.Data.MySQL.dll"
   ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=****;"

But replace the **** with the real password, so it looks something like

   ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=mYseKr37Pa55wurD;"

 

Start opensim for the first time!

Now we are ready to find all the mistakes we made. Try starting opensim. We will be using a program called GNU Screen. That way you can disconnect and leave the sim running, come back later and reconnect to the console. (Type control-a ? to get a command chart when you are running Screen, and if you never used it before, read through the manual to get some idea of what's happening.)

 

Start it

   waki@NGIW:/opt/opensim/config$ cd /opt/opensim/sim01/current/bin
   waki@NGIW:/opt/opensim/sim01/current/bin$ /usr/bin/mono OpenSim.exe

If things work well (i.e you have EVERYTHING right!), your screen will be spammed with zillions of messages, and every so often a question. Here is (slightly edited) what they say about that for the diva distribution:

 

Diva to the rescue again!

While running OpenSim for the first time, you will be asked a few questions related to the "Estate" and the owner of the regions. If you are bringing up multiple new regions in one sim, (the diva distro comes with 4 regions), you will be asked some of the questions multiple times. Here is a typical interaction:

   ...
   Your region is not part of an estate.
   Do you wish to join an existing estate? [no]: no  <---- first time
   New estate name [My Estate]: Waki Estate
   ...
   The current estate has no owner set.
   Estate owner first name [Test]: Waki
   Estate owner last name [User]: Dagod
   Password: 123
   Email []: waki@email.com
   ...

The estate questions repeat for the other regions. Typical answers are:

   Do you wish to join an existing estate? [no]: yes <---- other times
   Estate name to join [None]: Waki Estate

 

Stop the SIM

Check carefully to see that things are indeed working properly!

Log on to the main grid (e.g Infinite Grid) and visit your sim to be SURE that things are working correctly from the user's viewpoint!

In the console, type "backup", then when you get the prompt again, type "shutdown"

This is also the time to review the config (ini) files and change any settings that you wanted to change when you reviewed the ini files above.

TEST TEST TEST!

Also read http://forums.infinitegrid.org/viewtopic.php?f=7&t=30&hilit=hypergrid to see if you want Hypergrid in your region.

 

Start the sim as a daemon

Once you have everything working you can start the actual daemon process:

   waki@NGIW:/opt/opensim/sim01/current/bin$ screen /usr/bin/mono OpenSim.exe

 

Logout, but leave the sim running

That's why we have screen in the first place. The command is two characters, no enter is needed. The first character is control-a, press down the control key, while it is down press and release the a key, then release the control key. The second and final character is d, pres and release the d key and you are out of screen, and the sim is still running.

Type "screen -ls" to see that the session is still around, and "screen -r" to reconnect.

 

Why such boring names, and 9002? WTF?

There is a method to the madness. The names of the directories are short, and can be generated easily in a script. Very boring mechanical names of files is great if you have to write scripts to mess with the files. The other issue is the port number thing. Trying to keep the ports for 17 simulators straight is a challenge, we need all the help we can get. We have two helpers here.

The normal set up is one region gets one sim (aka OpenSim process) and one directory. The ports simX uses are X*2 and X*2+1. So even before I look, I expect that sim04 will use http port 9008 and region port 9009. The other trick, I recommend if you have multiple people maintaining your sims and hosts, is a file called /opt/opensim/config/ports.txt. It looks something like:

   -*- mode: org -*-
   
   Current directory, ports, and regions
   
     | dir    | http_listener_port |  region port | region name     |
     |--------+--------------------+--------------+-----------------|
     | test   |               9000 |         9001 | test            |
     |--------+--------------------+--------------+-----------------|
     | ngiw01 |               9002 |         9003 | Crushing Square |
     | ngiw02 |               9004 |         9005 | Silver Heart    |
     | ngiw03 |               9006 | 9007 -- 9015 | Speedway        |
     |--------+--------------------+--------------+-----------------|

But it's only a text file, so do it any way you like.

 

Industrial Improvements

The first time we ran opensim above we did it as the user waki. That's fine for testing, but not the way to go permanently. Supose someone finds a bug in opensim, and figures out how to make the opensim process type commands. Waki has sudo, so the attacker could make opensim (make waki) delete everything on the host!

So we want the opensim user to run all instances of opensim. We also want to make the simulator start up atomatically (e.g. system reboots, or simulator crashes), and we want to be able to look at all the simulators running in one window.

 

shared screen

A few things need to be set right to make shared screens work.

 

opensim's .screenrc and ACL

You will need to create an ACL (Access Control List) telling screen who can connect to the shared screen console. I'll show you the one I use, originally written by my sister Riseon. It lives in /home/opensim/.screenrc and the . matters! To create it do

   waki@NGIW:/opt/opensim/config$ sudo nano /home/opensim/.screenrc

and make the file look something like

   # C-a :source .screenrc
   
   termcapinfo xterm* ti@:te@
   startup_message off
   vbell off
   autodetach on
   altscreen on
   shelltitle "$ |bash"
   defscrollback 10000
   defutf8 on
   nonblock on
   
   hardstatus alwayslastline
   hardstatus string '%{= kw}[ %{= kb}%H%{= kw} ][%= %{= kw}%?%-Lw%?%{= kW}%n*%f %t%?%?%{= kw}%?%+Lw%?%?%= ][ %{r}%l%{w} ]%{w}[%{r} %d/%m/%y %C %A %{w}]%{w}'
   
   bind 'q' quit
   
   multiuser on
   acladd waki,root,alice

You probably want to copy-and-paste it from here, but remove the spaces at the beginning of the lines if you get them in your cut.

On that very last line you list the user names that can access the shared screen. That would give them the ability to read and write OAR files, IAR files, flatten the terrain, all the fun console stuff we do with OpenSim.

   waki@NGIW:/opt/opensim/config$ sudo chown opensim:opensim /home/opensim/.screenrc
   waki@NGIW:/opt/opensim/config$ sudo chmod 744 /home/opensim/.screenrc
   waki@NGIW:/opt/opensim/config$ sudo ls -la /home/opensim/.screenrc
   -rw-r--r-- 1 opensim opensim 479 2011-06-18 22:19 /home/opensim/.screenrc

For an explanation of all those commands in that file check out the screen manual, type "man screen" at the command line.

 

setuid permission on the binary

I know, it bugs me too. Anyway, do:

   waki@NGIW:/opt/opensim/config$ which screen
   /usr/bin/screen
   waki@NGIW:/opt/opensim/config$ sudo chmod u+s /usr/bin/screen
   waki@NGIW:/opt/opensim/config$ sudo chmod g+s /usr/bin/screen
   waki@NGIW:/opt/opensim/config$ ls -la /usr/bin/screen
   -rwsr-sr-x 1 root utmp 376112 2010-08-17 18:10 /usr/bin/screen

 

permissions on the /var/run/screen dir

   waki@NGIW:/opt/opensim/config$ sudo chmod 755 /var/run/screen
   waki@NGIW:/opt/opensim/config$ sudo chown root:utmp /var/run/screen
   waki@NGIW:/opt/opensim/config$ ls -lad /var/run/screen
   drwxr-xr-x 5 root utmp 100 2011-06-19 00:30 /var/run/screen

 

Magic to start a sim

Monit, we will get to it below, uses the file /opt/opensim/sim01/start-sim-in-shared-screen when it's time to start sim01. And similar files for other simulators. Time for nano again.

 

   waki@NGIW:/opt/opensim/config$ cd /opt/opensim/sim01
   waki@NGIW:/opt/opensim/sim01$ nano start-sim-in-shared-screen

then it's copy-pasta time again, make this:

   #!/bin/bash
   console_name=screen_console
   screen_session=opensim/${console_name}
   osversion=current
   
   if [ x$1 = x ]; then
       pathname=`pwd`
       tgt="`basename $pathname`"
   elif [ -d ./$1 ]; then
       tgt=$1
   elif [ -d ./sim$1 ]; then
       tgt=sim$1
   fi
   
   if [ x$tgt = x ]; then
       echo "usage:"
       echo "    $ start-sim-in-shared-screen <sim>"
       echo "    $ cd <dir>; start-sim"
       echo "where <sim> is one of: " robust sim[0-9][0-9]
       echo "or <dir> is one of the robust or sim directories"
       exit 1
   fi
   
   if (screen -ls opensim/ | grep -q ${console_name}); then
       echo "INFO: Screen already running"
       true
   else
       echo "DEBUG: Starting screen"
       screen -d -m -S ${console_name}
   fi
   
   inidir=/opt/opensim/${tgt}
   bindir=/opt/opensim/${tgt}/${osversion}/bin
   if [ x$tgt = xrobust ]; then
       exe="Robust"
   else
       exe="OpenSim"
   fi
   cmd="/usr/bin/mono ${exe}.exe --inifile /opt/opensim/${tgt}/${exe}.ini"
   tmpfile=`mktemp`
   echo "chdir ${bindir}"          > ${tmpfile}
   echo "screen -t ${tgt} ${cmd}" >> ${tmpfile}
   chmod a+r ${tmpfile}
   rm -f ${inidir}/start.screen
   cp ${tmpfile} ${inidir}/start.screen
   rm ${tmpfile}
   # echo "INFO: start process and connect to screen (opensim)"
   screen -r ${screen_session} -p "-" -X source ${inidir}/start.screen

Be sure to remove the 4 spaces at the beginning of the lines. The lines with more than 4, just remove the first four.

You also need to make the file executeable as monit will use it to start the sim.

   waki@NGIW:/opt/opensim/sim01$ chmod a+x ./start-sim-in-shared-screen
   waki@NGIW:/opt/opensim/sim01$ ls -la ./start-sim-in*
   -rwxr-xr-x 1 waki waki 0 2011-08-01 21:30 ./start-sim-in-shared-screen

 

log rolling

We change out logfiles daily, and delete those that are more than a couple days old.

 

tell opensim

   waki@NGIW:/opt/opensim/config/sim01$ nano /opt/opensim/config/sim01.opensim.exe.config

Here's what to put in /opt/opensim/config/sim01.opensim.exe.config.

   <?xml version="1.0" encoding="utf-8" ?>
   <configuration>
     <configSections>
       <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
     </configSections>
     <runtime>
       <gcConcurrent enabled="true" />
   	<gcServer enabled="true" />
     </runtime>
     <appSettings>
     </appSettings>
     <log4net>
       <appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console">
         <layout type="log4net.Layout.PatternLayout">
           <conversionPattern value="%date{HH:mm:ss} - %message" />
         </layout>
       </appender>
       <appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender">
         <file value="/var/log/opensim/sim01.log" />
         <rollingStyle value="Date" />
         <datePattern value="yyyyMMdd" />
         <appendToFile value="true" />
         <layout type="log4net.Layout.PatternLayout">
           <conversionPattern value="%date %-5level - %logger %message%newline" />
         </layout>
       </appender>
       <root>
         <level value="DEBUG" />
         <appender-ref ref="Console" />
         <appender-ref ref="LogFileAppender" />
       </root>
     </log4net>
   </configuration>

See http://logging.apache.org/log4net/release/config-examples.html for more info about the ugly file format. Including the amazing and stupid fact that log4net wont delete old log files if you organize them by date! Here at IG we use cron to do that.

 

tell cron

First make a file to manage the crontab settings.

   waki@NGIW:/opt/opensim/config$ nano /opt/opensim/config/opensim-crontab.txt

Here's what to put in /opt/opensim/config/opensim-crontab.txt

   # to see current crontab for opensim
   #  $ sudo crontab -u opensim -l
   #
   # to install this crontab for opensim:
   #  $ cat /opt/opensim/config/opensim-crontab.txt | sudo crontab -u opensim -
   #
   # at midnight, remove old logs, files created 3 or more days ago
   0 0 * * *       find /var/log/opensim -ctime +1 -delete

A tiny how-to is in the comments at the beginning. Note the install command also deletes any other crontab entries for opensim, so you may want to keep all crontab entries for opensim in the file and up to date. Your first command with cron should always be the -l command to see the current crontab.

   waki@NGIW:/opt/opensim/config$ sudo crontab -u opensim -l
   waki@NGIW:/opt/opensim/config$

Good, you remembered the first command is always look. Now tell cron about opensim's things to do.

   waki@NGIW:/opt/opensim/config$ cat /opt/opensim/config/opensim-crontab.txt | sudo crontab -u opensim -
   waki@NGIW:/opt/opensim/config$

Now check what cron thinks you told it.

   waki@NGIW:/opt/opensim/config$ sudo crontab -u opensim -l
   # to install this crontab for opensim:
   #  $ cat /opt/opensim/config/opensim-crontab.txt | sudo crontab -u opensim -
   #
   # to see current crontab for opensim
   #  $ sudo crontab -u opensim -l
   #
   # at midnight, remove old logs, files created 3 or more days ago
   0 0 * * *       find /var/log/opensim -ctime +1 -delete

 

monit

The monit program is a standard linux tool that watches other processes to see if they are still healthy and running right. Monit can be told how to restart processes when they have crashed, that is what we are going to do. Infact, we almost never start opensim, we let monit do it, even when we 'restart' a sim, what we usually actually do is stop a sim, and watch monit start it back up. (Read the monit man page, it can do lots more cool stuff.)

 

instal monit

First verify that you have monit installed, in the usual ways

   waki@NGIW:/opt/opensim/config$ which monit
   /usr/sbin/monit

Except monit wants -V, not --version

   waki@NGIW:/opt/opensim/config$ monit -V
   This is monit version 5.0.3
   Copyright (C) 2000-2009 by Tildeslash Ltd. All Rights Reserved.

If not you will see something like:

   waki@NGIW:/opt/opensim/config$ which monit
   waki@NGIW:/opt/opensim/config$
   waki@NGIW:/opt/opensim/config$ monit -V
   The program 'monit' is currently not installed.  You can install it by typing:
   sudo apt-get install monit

Which is exactly what you should do, and expect to see something like:

   waki@NGIW:/opt/opensim/config$ sudo apt-get install monit
   Reading package lists... Done
   Building dependency tree
   Reading state information... Done
   The following NEW packages will be installed:
     monit
   0 upgraded, 1 newly installed, 0 to remove and 4 not upgraded.
   Need to get 526kB of archives.
   After this operation, 1,036kB of additional disk space will be used.
   Get:1 http://nl.archive.ubuntu.com/ubuntu/ maverick/universe monit amd64 1:5.1.1-1 [526kB]
   Fetched 526kB in 0s (1,219kB/s)
   Selecting previously deselected package monit.
   (Reading database ... 49073 files and directories currently installed.)
   Unpacking monit (from .../monit_1%3a5.1.1-1_amd64.deb) ...
   Processing triggers for ureadahead ...
   Processing triggers for man-db ...
   Setting up monit (1:5.1.1-1) ...

Notice right at the end monit basically says "Monit isn't running, and you aren't done yet."

   Starting daemon monitor: monit won't be started/stopped
       unless it it's configured
       please configure monit and then edit /etc/default/monit
       and set the "startup" variable to 1 in order to allow
       monit to start

We will get everthing set up for monit before we start it.

 

make /var/run/opensim

We will make opensim write a 'pid' file when it starts up, so monit knows which process is currently supposed to be running opensim.

   waki@NGIW:/opt/opensim/config$ sudo mkdir /var/run/opensim
   waki@NGIW:/opt/opensim/config$ sudo chown opensim:opensim /var/run/opensim
   waki@NGIW:/opt/opensim/config$ sudo chmod 755 /var/run/opensim
   waki@NGIW:/opt/opensim/config$ ls -la /var/run/opensim
   total 16
   drwxr-xr-x  2 opensim opensim 120 2011-07-16 10:54 .

 

set up for restart

The /var/run directory is wiped on restart, so we need to redo this every time the system starts:

   waki@NGIW:sudo nano /etc/rc.local

 

   #!/bin/sh -e
   #
   # rc.local
   #
   # This script is executed at the end of each multiuser runlevel.
   # Make sure that the script will "exit 0" on success or any other
   # value on error.
   #
   # In order to enable or disable this script just change the execution
   # bits.
   #
   # By default this script does nothing.
   
   # setup the opensim PID directory on reboot
   mkdir -p /var/run/opensim
   chmod 755 /var/run/opensim
   chown opensim:opensim /var/run/opensim
   
   exit 0

 

make opensim.ini use /var/run/opensim for pid file

Start nano to fix the opensim.ini

   waki@NGIW:/opt/opensim/config$ nano ./sim01.opensim.ini

Search (control-w) for PIDFile. Change the file to have something like this:

   ;# {PIDFile} {} {Path to PID file?} {}
   ;; Place to create a PID file
   ; PIDFile = "/tmp/my.pid"
   PIDFile = "/var/run/opensim/sim01.pid"
   
   ;; Determine where OpenSimulator looks for the files which tell it
   ;; which regions to server

Save and exit after making that change, or verifying it's set to that already.

 

create a monit conf file for your simulator

First be sure the configuration directory already exists.

   waki@NGIW:/opt/opensim/config$ ls -lad /etc/monit/conf.d
   drwxr-xr-x 2 root root 4096 2011-08-04 07:03 /etc/monit/conf.d

If not, something may be broken in your monit install. But this might fix it enough:

   waki@NGIW:/opt/opensim/config$ sudo mkdir -p /etc/monit/conf.d
   waki@NGIW:/opt/opensim/config$ sudo chown -r root:root /etc/monit
   waki@NGIW:/opt/opensim/config$ sudo chmod 755 /etc/monit
   waki@NGIW:/opt/opensim/config$ sudo chmod 755 /etc/monit/conf.d
   waki@NGIW:/opt/opensim/config$ ls -lad /etc/monit/conf.d
   drwxr-xr-x 2 root root 4096 2011-08-04 07:03 /etc/monit/conf.d

Next make a configuration file for sim01.

   waki@NGIW:/opt/opensim/config$ sudo nano /etc/monit/conf.d/sim01.conf

Make it look like

   # manage the OpenSim process for Your Sim
   #
   # usage:
   #     monit start your_sim
   #     monit stop your_sim
   #     monit restart your_sim
   #
   # see 'daemon' setting in /etc/monit/monitrc for the cycle length.
   # on ubuntu/debian, this is overridden by the CHECK_INTERVALS var in
   # /etc/default/monit .  the below assumes you've set it to 30 seconds.
   #
   # if process dies, will restart sim within 30 seconds.  if process
   # dies 5 times in as many tries, will stop trying and send email
   # alert.
   #
   # if SimFPS drops to 0 for 2 minutes, restart.
   #
   # if process CPU usage stays above 300% for 2 minutes, restart.
   #
   # see ../README for configuration instructions.
   #
   check process sim01 with pidfile /var/run/opensim/sim01.pid
       start program = "/bin/bash -c 'cd /opt/opensim/sim01 && /opt/opensim/sim01/start-sim-in-shared-screen'"
           as uid opensim and gid opensim
       stop program = "/bin/kill -9 `cat /var/run/opensim/sim01.pid`"
   #    if cpu usage > 300% for 4 cycles then restart
   #    if 5 restarts within 5 cycles then timeout
   #    if failed url http://127.0.0.1:9005/jsonSimStats/
   #        and content != '"SimFPS":0.0,' for 4 cycles
   #        then restart
   #    if failed url http://127.0.0.1:9008/jsonSimStats/
   #        and content == '"SimFPS":' for 4 cycles
   #        then restart

You only need the lines with out the # at the beginning, but the other lines are documentation worth keeping. At least the lines with out a # at the beginning need to have those nasty 4 spaces removed.

 

change sim01 to be owned by opensim

We are about to tell monit it's ok to start working. If sim01 is running, stop it now. (Type "backup" and "shutdown" in the sim's console window.) Then we need to change the owner of all the files under /opt/opensim/sim01 to be opensim. Then very shortly after we start monit, it will start sim01, as the user opensim, under a shared screen session.

   waki@NGIW:/opt/opensim/config$ sudo chown -R opensim:opensim /opt/opensim/sim01
   waki@NGIW:/opt/opensim/config$ ls -la /opt/opensim/sim01
   total 16
   drwxr-xr-x 3 opensim opensim 4096 2011-08-04 06:48 .
   drwxr-xr-x 6 waki    waki    4096 2011-08-02 12:20 ..
   lrwxrwxrwx 1 opensim opensim   33 2011-07-31 00:40 current -> ./opensim-0.7.1.1-infinitegrid-03
   drwxr-xr-x 9 opensim opensim 4096 2011-06-19 01:22 opensim-0.7.1.1-infinitegrid-03
   lrwxrwxrwx 1 opensim opensim   34 2011-07-31 01:00 OpenSim.exe.config -> ../config/sim01.opensim.exe.config
   lrwxrwxrwx 1 opensim opensim   27 2011-07-31 00:56 OpenSim.ini -> ../config/sim01.opensim.ini
   -rwxr-xr-x 1 opensim opensim 1381 2011-08-04 06:52 start-sim-in-shared-screen

 

check monit's config file

The monitrc file is giant, kinda like opensim.ini though. Well documented. There are 4 things to check, so start up nano

   waki@NGIW:/opt/opensim/config$ sudo nano /etc/monit/monitrc

and use control-w to search for these sections. Make yours look like

   ## Start Monit in the background (run as a daemon):
   #
   # set daemon  120           # check services at 2-minute intervals
   set daemon 30
   #     with start delay 240  # optional: delay the first check by 4-minutes (by
   #                           # default Monit check immediately after Monit start)

then later

   ## Set syslog logging with the 'daemon' facility. If the FACILITY option is
   ## omitted, Monit will use 'user' facility by default. If you want to log to
   ## a standalone log file instead, specify the full path to the log file
   #
   # set logfile syslog facility log_daemon
   set logfile /var/log/monit.log
   #
   #
   ### Set the location of the Monit id file which stores the unique id for the

then later

   ## Monit has an embedded web server which can be used to view status of
   ## services monitored and manage services from a web interface. See the
   ## Monit Wiki if you want to enable SSL for the web server.
   #
    set httpd port 2812 and
        use address localhost  # only accept connection from localhost
        allow localhost        # allow localhost to connect to the server and
   #     allow admin:monit      # require user 'admin' with password 'monit'

and at the very end

   ## Includes
   ###############################################################################
   ##
   ## It is possible to include additional configuration parts from other files or
   ## directories.
   #
   
   include /etc/monit/conf.d/*

 

tell monit it's OK to run

   waki@NGIW:/opt/opensim/config$ sudo nano /etc/default/monit

The file is small, look down to the place where it tells you to set startup.

   # You must set this variable to for monit to start
   startup=1

 

start monit

We did a command like this before, it is the standard way to start any 'demon' or service on linux. We are going to tell monit to start. If we didn't mess up the configuration files, it will notice that sim01 isn't running, and start it. Then we can connect to the console.

   waki@NGIW:/opt/opensim/config$ sudo /etc/init.d/monit start

Now look for the shared screen console with

   waki@NGIW:/opt/opensim/config$ screen -ls opensim/

Then connect to it with

   waki@NGIW:/opt/opensim/config$ screen -r opensim/screen_console -A

And you should have your sim up, and have console access again. You really need to read the screen manual to understand about switching windows, detaching, and reattaching. All the sim consoles are going to connect to this one screen session, the only way to get to them is by knowing how to use screen.

 

other humans

You probably want to have two or three people, yourself included, who you trust to help keep things running. You and they should understand all the steps in this howto, be comfortable checking out what's going on on a server. They all need to be 'admin' users and have rights to sudo, that's why I recommend only people you trust.

 

The Next Steps

You should now be able to log on to IG and visit your island(s)! Not only that if/when your server goes down for any reason it should restart without any fuss on your part!

 

Getting Content

You can now transfer your exiting content files into the grid. You can use your opensim console to upload your OAR files (to your regions only - sorry :-) ) and upload IAR files to your avatar.

Some Sources of OAR/IAR files:

http://opensimulator.org/wiki/Artist_Home

http://nebadon2025.com/oars/

http://nebadon2025.com/opensim/viewforum.php?f=5&sid=34ebed1d673ae0bf6c3ceff8a0178988

http://opensim-creations.com/

Please add to this list!

 

Further Reading

A different tutorial on linking to a grid (somewhat out of date): https://usvemo.wordpress.com/2011/01/02/setting-up-an-opensim-server-to-osgrid-part-1/

How to configuring your regions: http://opensimulator.org/wiki/Configuring_Regions

The entire opensimulator.org wiki is well worth your time to read!

 

Managing your linked region

tags: