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

1 post / 0 new
This is intended for people with some familiarity with Windows who know how to navigate around the file system and edit text files. It is aimed at people who want to run one or two regions(sims) on their own home computer.

Pre-installation Requirements

 

Software

  • .Net Framework 3.5 Not required for Windows 7 or Windows Server 2008 R2. Windows Vista, Windows Server 2008, Windows Server 2003 or Windows XP need to upgrade it to 3.5(or later, but NET Framework 4.0 not officially supported by OpenSim yet). Prior versions of Windows(ex. NT or 2000) are NOT supported. Windows XP must be updated to at least Service Pack 2 (SP2).
  • 7-Zip You will need this to unzip and unpack the IG distro of Opensim
  • A Real text editor! I recommend Notepad++ as the built-in Windows Notepad cannot edit .ini files properly
  • Wamp Server This will install the Apache web server, PHP and MySQL onto your PC

 

Home Network Information

  • Your internal IP address. If you don't know what it is, run a command prompt and type ipconfig. Your looking for the IPv4 Address which is normally something like 192.168.0.2. Its a good idea to set this as a static IP address in your router. See Popular broadband router configurations for more information on how to do this.
  • Your external IP address. This site will tell you what it is: http://www.whatismyip.com/ Most people on a home broadband will have a dynamic IP address that can change (normally when your router is restarted). You can use a dynamic IP address in the regions.ini file to test the installation but for regular use you will need to set up a domain name with one of the free services like DynDNS

 

Opening Ports in your Routers Firewall

You will need to open a port (two for the first sim) in your routers firewall and port-forward them to the computer you are running Opensim on for each region(sim) you want to have. See Popular broadband router configurations for more information on how to do this.

 

 

Assumptions

  • IG distro name At the time of writing the downloaded IG disto is called opensim-0.7.1.1-infinitegrid-03.tar.bz2. This name will used throughout this document when referring to the downloaded distro.
  • Avatar Name I will be using the avatar name Connor Baily throughout this document. Substitute it with your own avatar name.

 

 

Installation

 

Install WAMP

Just double-click the downloaded file and accept all deafults. A new icon will appear in your System Tray (the icons to the left of the time on the bottom right of your screen)

 

Set MySQL root password

  • Click on the Wamp icon in the system tray and select phpMyAdmin
  • Type root for the username. Leave the password blank and click Go
  • Along the top of the screen select SQL from the menu items
  • Copy & paste the following into the box, changing your_password to whatever you want it to be, and then click Go:
UPDATE mysql.user SET Password=PASSWORD('your_password') WHERE User='root';
FLUSH PRIVILEGES;
  • Exit phpMyAdmin

 

 

phpMyAdmin Config Changes

  • Edit c:\wamp\apps\phpmyadmin\config.inc.php and make the following changes:
/* Server: localhost [1] */
$i++;
$cfg['Servers'][$i]['verbose'] = 'localhost';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = ;
$cfg['Servers'][$i]['socket'] = ;
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'config';                          <----- Change 'config' to 'cookie'
$cfg['blowfish_secret'] = 'qtdRoGmbc9{8IZr323xYcSN]0s)r$9b_JUnb{~Xz'; <----- Add this line.  Go here to get a nicely generated blowfish_secret
$cfg['Servers'][$i]['user'] = 'root';                                 <----- Delete this line
$cfg['Servers'][$i]['password'] = ' '                                 <----- Delete this line
$cfg['Servers'][$i]['AllowNoPassword'] = true;                        <----- Delete this line
  • Save the changes and exit

 

Set up mysql for opensim: Diva

This is 99% stuff from the Diva distro of Opensim, thanks Diva! All the mistakes are mine.

  • Run phpMyAdmin and log in as root
  • Select SQL from the menu items along the top
  • Copy and paste the following commands into the text box, clicking Go after each one


Create a schema called opensim:

create database opensim;

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

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

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

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

make MySql server reload the user data:

FLUSH PRIVILEGES;

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

 

Unzip and Unpack the Distro

  • Go to where you downloaded the IG distro and right-click on opensim-0.7.1.1-infinitegrid-03.tar.bz2.
  • Select 7-Zip and then Extract Here. This will create a new folder called opensim-0.7.1.1-infinitegrid-03.tar. Open this folder.
  • Right-click on opensim-0.7.1.1-infinitegrid-03.tar (file not folder, they both have the same name!), select 7-Zip and then Extract Here. This will create a folder called opensim-0.7.1.1-infinitegrid-03.
  • Rename this folder to igopensim.

 

Make your regions.ini!

Here we make a new region(sim)! You will need a cool name for your region(sim) (maybe "Connor 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 for the region(sim). 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.

  • Open the folder /igopensim/bin/regions
  • Create a new text document and call it regions.ini
  • Edit the regions.ini file

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 ExternalHostName to be the external IP of your router or a DNS name (URL).

[Connor Test]
RegionUUID = 6c38e16d-9a4f-42db-9d71-102529d4437a  <----- what is there about "UNIQUE" that you did not understand? see: Wiki:UUID
Location = 9996,10007                              <----- again UNIQUE (i.e. ONLY ONE) per grid in THIS case!
InternalAddress = 0.0.0.0
InternalPort = 9003                                <----- 9002 is used for HTTP/UDP so START with port 9003!
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
  • Close and save the file

 

Change port in opensim.ini

  • Open the folder /igopensim/bin
  • Edit opensim.ini
  • Search 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.} {}
  • Close and save the file

 

MySql changes in gridcommon.ini

  • Open the folder /igopensim/bin/config-include and edit 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;"
  • Close and save the file

 

Create a shortcut to start the Opensim server

 

Windows XP and Windows 7 32-bit

  • Right-click on OpenSim.exe and select Create shortcut
  • Rename the shortcut to OpenSim Server (or whatever you want)

 

Windows 7 64-bit

  • Right-click on OpenSim.32BitLaunch.exe and select Create shortcut
  • Rename the shortcut to OpenSim Server (or whatever you want) and copy/paste it on your desktop

 

Extra step for Windows 7 32-bit and 64-bit

  • Right-click the shortcut you just created and select Properties
  • Click on the Advanced... button and select Run as administrator
  • Click OK twice to close the properties windows

 

 

NAT Loopback - Running Opensim and Viewer on same PC

In order for you to connect to the grid using the viewer on the same computer that you are running Opensim on you need to enable NAT Loopback in your router. Unfortunately most home broadband routers do not have this option.

A workaround is to create a NAT Loopback Adapter on your computer: NAT Loopback and Windows 7

(from Infinite Grid Forums: http://forums.infinitegrid.org/viewtopic.php?f=10&t=220)

 

Start Opensim for the first time!

Now we are ready to find all the mistakes we made. Try starting opensim.

  • Double-click the shortcut you just made

If things work well (i.e you have EVERYTHING right!), your screen will be spammed with zillions of messages, and every so often a few questions related to the "Estate" and the owner of the regions.

 

Estate and Region Owner Questions

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 brining up multiple new regions in one sim 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]: Connor Estate
...
The current estate has no owner set.
Estate owner first name [Test]: Connor  <---- your IG avatar's first name
Estate owner last name [User]: Baily    <---- your IG avatar's last name
...

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]: Connor Estate

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!

 

Stop the SIM

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

 

Read the ini files

Now, read every line of every file in the config directory and opensim.ini, you need to know what options you have. This is the time to review those config (ini) files and change any settings that you want to change.

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

TEST TEST TEST! Don't proceed until you are sure you have the system working with any changes you might have made to the .ini files

 

Improvements

 

Restart simulator automatically

We want to make the simulator restart automatically if it crashes

<To be completed>

 

Log rolling

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

 

Tell Opensim

  • Edit /igopensim/config/opensim.exe.config

Here's what to put in /igopensim/config/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! We can use Windows Task Scheduler to do that.

 

Delete old logs

<To be completed>

 

Windows Task Scheduler

<To be completed>

 

Credits

I unashamedly admit to copying & pasting chunks from How to link your OpenSim region to Infinite Grid (Linux/MySQL). My thanks to Infinite Crush and Karen Palen for their excellent guide.

tags: