Sunday, 4 October 2009

OpenSim install on Centos 5.x

2) OpenSim install on Centos 5.x


This blog was written after installing OpenSim 0.66 on a CentOS 5.3 box running 32-bit Linux. The simulator was set up to run in standalone mode.

Please note that these instructions should NOT be used as is with an installation of OpenSim on a 64-bit Linux distribution due to package conflict problems.

Note that this process will only work for CentOS 5.3 - I tried it with CentOS 4.x and could not get past installing mono v2.4 base because of failed dependencies.

The process I followed was as follows:

Muuch of the initial information came from the following posting:

http://www.osgrid.org/forums/viewtopic.php?f=14&t=1603&start=0

To be on the safe side login as root and remove any existing outdated packages:

[root@vleinternal ~]# yum erase libgdiplus libgdiplus.i386 libgdiplus-devel.i386 mod_mono.i386 mono-core.i386 mono-data.i386 mono-data-firebird.i386 mono-data-oracle.i386 mono-data-postgresql.i386 mono-data-sqlite.i386 mono-data-sybase.i386 mono-devel.i386 mono-extras.i386 mono-jscript.i386 mono-locale-extras.i386 mono-nunit.i386 mono-nunit-devel.i386

Removed: libgdiplus.i386 0:1.2.5-1.el5.centos

The next step is to make sure the following required packages are installed:

[root@vleinternal ~]# yum install libtool.i386 libpng.i386 libpng-devel.i386 libjpeg.i386 libjpeg-devel.i386 libtiff.i386 libtiff-devel.i386 libexif.i386 libexif-devel.i386 giflib.i386 giflib-devel.i386 bison.i386 bison-devel.i386 automake.noarch autoconf.noarch make.i386 gcc.i386 gtk+.i386 subversion.i386 libX11-devel.i386 freetype.i386 freetype-devel.i386 gettext.i386 glib* fontconfig-devel.i386

Installed: bison-devel.i386 0:2.3-2.1 giflib-devel.i386 0:4.1.3-7.1.el5_3.1 glib-devel.i386 1:1.2.10-20.el5 glib-java-devel.i386 0:0.2.6-3.fc6 glibc-utils.i386 0:2.5-34.el5_3.1 gtk+.i386 1:1.2.10-56.el5 libexif-devel.i386 0:0.6.13-4.0.2.el5_1.1 libjpeg-devel.i386 0:6b-37 libtiff-devel.i386 0:3.8.2-7.el5_3.4
Dependency Installed: gdk-pixbuf.i386 1:0.22.0-25.el5


Just to be on the safe side reboot the server at this point:

[root@vleinternal ~]# reboot

Broadcast message from root (pts/0) (Tue Sep 8 09:53:46 2009):
The system is going down for reboot NOW!


Log back in as root and create an account for user opensim:

[root@vleinternal ~]# useradd opensim
[root@vleinternal ~]# passwd opensim

Become the opensim user:

[root@vleinternal ~]# su - opensim

Download, build and install the latest version of libgdiplus:

[opensim@vleinternal ~]$ lynx http://mono.ximian.com/monobuild/snapshot/sources-trunk/
[opensim@vleinternal ~]$ tar -jxvf libgdiplus-140293.tar.bz2
[opensim@vleinternal ~]$ cd libgdiplus-140293
[opensim@vleinternal libgdiplus-140293]$ ./configure --prefix=/home/opensim/bin/mono

Configuration summary

* Installation prefix = /home/opensim/bin/mono
* Cairo = 1.6.4 (internal)
* Text = cairo
* EXIF tags = yes
* Codecs supported:

- TIFF: yes
- JPEG: yes
- GIF: yes
- PNG: yes
NOTE: if any of the above say 'no' you may install the
corresponding development packages for them, rerun
autogen.sh to include them in the build.


[opensim@vleinternal libgdiplus-140293]$ make
[opensim@vleinternal libgdiplus-140293]$ make install
[opensim@vleinternal libgdiplus-140293]$ cd ..

Download, build and install mono as follows:

(Kishore has kindly pointed out that the mono check out version can be the most recent version from the repository. It need not be the version number stated below. Subsequent to this posting I ended up using mono-2.4.2.3 and the associated version of libgdiplus, which I downloaded from http://ftp.novell.com/pub/mono/archive/2.4.2.3/sources/ )

[opensim@vleinternal ~]$ lynx http://mono.ximian.com/monobuild/snapshot/sources-trunk/
[opensim@vleinternal ~]$ tar -jxvf mono-140267.tar.bz2
[opensim@vleinternal ~]$ cd mono-140267
[opensim@vleinternal mono-140267]$ ./configure --prefix=/home/opensim/bin/mono
[opensim@vleinternal mono-140267]$ make

Mono complilation takes about half an hour so go away and take a break ;)

[opensim@vleinternal mono-140267]$ make install
[opensim@vleinternal mono-140267]$ cd ..

Edit .bashrc and add the following lines

[opensim@vleinternal ~]$ nano .bashrc

export PATH="/home/opensim/bin/mono/bin:$PATH"
export PKG_CONFIG_PATH="/home/opensim/bin/mono/lib/pkgconfig:$PKG_CONFIG_PATH"
export MANPATH="/home/opensim/bin/mono/share/man:$MANPATH"
export LD_LIBRARY_PATH="/home/opensim/bin/mono/lib:$LD_LIBRARY_PATH"
export MONO_THREADS_PER_CPU=75
export PATH="/home/opensim/bin/mono/:$PATH"

Relog as user opensim

[opensim@vleinternal ~]$ logout
[root@vleinternal ~]# su - opensim

Check that mono is working:

[opensim@vleinternal ~]$ mono -V
Mono JIT compiler version 140267 (tarball Tue Sep 8 10:41:51 BST 2009)
Copyright (C) 2002-2008 Novell, Inc and Contributors. www.mono-project.com
TLS: __thread
GC: Included Boehm (with typed GC and Parallel Mark)
SIGSEGV: altstack
Notifications: epoll
Architecture: x86
Disabled: none


Now download and install the nant tool:

[opensim@vleinternal ~]$ wget http://downloads.sourceforge.net/nant/nant-0.85-bin.tar.gz
[opensim@vleinternal ~]$ tar -xzvf nant-0.85-bin.tar.gz -C /home/opensim/bin/mono/

Create a shell script to start nant containing the following lines:

[opensim@vleinternal ~]$ nano /home/opensim/bin/mono/nant

mono /home/opensim/bin/mono/nant-0.85/bin/NAnt.exe

Make it executable and check the nant script is working:

[opensim@vleinternal ~]$ chmod +x /home/opensim/bin/mono/nant
[opensim@vleinternal ~]$ nant

NAnt 0.85 (Build 0.85.2478.0; release; 10/14/2006)
Copyright (C) 2001-2006 Gerry Shaw
http://nant.sourceforge.net

BUILD FAILED

Could not find a '*.build' file in '/home/opensim'

For more information regarding the cause of the build failure, run the build again in debug mode.

Try 'nant -help' for more information


Nant and mono have now been successfully installed for user opensim.

Once all was up and running went over to http://opensimulator.org/wiki/Build_Instructions and created database for opensim as root and then as user opensim, downloaded and built opensim in /home/opensim/

Creating the database:

[root@vleinternal ~]# mysql -u root -p
mysql> create database opensim;
mysql> create user 'opensim'@'localhost' identified by 'xxxxxxxx';
mysql> grant all on *.* to 'opensim'@'localhost';
mysql> quit

Installing OpenSim:

[root@vleinternal ~]# su - opensim
[opensim@vleinternal ~]$ lynx http://opensimulator.org/wiki/Download
[opensim@vleinternal ~]$ tar -xzvf opensim-0.6.6-release.tar.gz
[opensim@vleinternal ~]$ cd opensim-0.6.6-release
[opensim@vleinternal opensim-0.6.6-release]$ ./runprebuild.sh
[opensim@vleinternal opensim-0.6.6-release]$ nant

BUILD SUCCEEDED

Total time: 151.4 seconds.


Configuring and starting OpenSim:

[opensim@vleinternal opensim-0.6.6-release]$ cd bin
[opensim@vleinternal opensim-0.6.6-release]$ mv OpenSim.ini.example OpenSim.ini
[opensim@vleinternal opensim-0.6.6-release]$ nano OpenSim.ini
[opensim@vleinternal opensim-0.6.6-release]$ mono OpenSim.exe


Once OpenSim was installed I came across serveral problems:

1) Getting the mysql configuration for OpenSim.ini right. The default configuration was for sqllite and there were quite a few directives that needed to be commented in and out before OpenSim would start using mysql successfuly. I found myself using PHPMyAdmin and dropping all the tables in the opensim database several times and rebuilding opensim.

2) Getting MySQL working. Once I uncommented the directive StorageProvider = "OpenSim.Data.MySQL.dll" in OpenSim.ini it was also necessary to add a corresponding ConnectionString directive as shown below:

[DatabaseService]
StorageProvider = "OpenSim.Data.MySQL.dll"
ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=zzzzz;";

3) Getting the Regions.ini file right. This file is created the first time that mono Opensim.exe is run. Unfortunately I had specified the internal IP address of the server and this resulted in the UDP region handshake failing. After advice from Paul Fishwick and Trevarus Ovares on the opensim user mailing list I used 0.0.0.0 for the InternalAddress and 195.194.82.16 for the ExternalHostName and I was able to login remotely using the Hippo client. The final working version is shown below:

[opensim@standbyvle Regions]$ pwd
/home/opensim/opensim-0.6.6-release/bin/Regions
[opensim@standbyvle Regions]$ cat Regions.ini
[Bromley]
RegionUUID = 7613b3c8-39ea-42ed-bfef-e09d34f997e9
Location = 1000,1000
InternalAddress = 0.0.0.0
InternalPort = 9000
AllowAlternatePorts = False
ExternalHostName = 195.194.82.16
MasterAvatarFirstName = Estate
MasterAvatarLastName = Owner
MasterAvatarSandboxPassword = ******

Note: For the ExternalHostName parameter we used the external IP address that the server was accessible on from the Internet. An FQDN will NOT work in the ExternalHostName parameter.

4) Configuring the Hippo client. Installation under Windows Vista was straightforward and the client looked very much like the SL viewer. There was an additional button called Grids. I typed in the URL for the standbyvle server into the Login URI box i.e. http://standbyvle.bromley.ac.uk:9000/ and clicked on the Get Grid info button. The settings for Grid name and Grid nickname were fetched from the server (as specified in OpenSim.ini). It was then just a question of choosing the named grid and clicking on the default button. (Please see note 9 below for information on the Meerkat viewer)

5) Logging in for the first time. I could not initially log on as the master avatar and had to create another avatar account from the OpenSim prompt using the create user command. Once I had created that account and logged on and off the Hippo client using it, I found I could then log on using the master avatar account, which has full control over the land permissions.

6) Getting Physics Working. Initially physics wouldn't work properly. I solved this by changing the physics engine in OpenSim.ini from basicphysics to ODE as shown below and restarting the simulator.

; Choose one of the physics engines below
;physics = basicphysics
;physics = POS
physics = OpenDynamicsEngine
;physics = modified_BulletX

7) MySQL Problems. Additionally I had a problem with agent login failing first thing in the morning. This turned out to be down to a timed backup script stopping and starting mysql around 4 am, whilst OpenSim was still running. As soon as this script was turned off the login problems disappeared :)

8) Object Permissions. By default permissions were turned off, which potentially meant that students could copy each others work. This was easily corrected by changing the following parameter in OpenSim.ini and restarting the simulator.

serverside_object_permissions = true

9) Copying objects from Secondlife to OpenSim. I had initially been using the Hippo viewer, but have now found the Meerkat viewer, which in my opinion is much more fully featured. Meerkat also allows you to copy objects that you have full permissions on directly from Secondlife into Opensim (and vice versa). This is easily achieved by logging into SL using Meerkat, right clicking on the object you wish to copy choosing More> More> Backup from the round menu. Using the Browse option, create a directory on your local hard drive where you then save the objects xml description and texture(s). Change grid to OpenSim and choose viewer top toolbar menu File > Import > Upload textures + Import. Load the object xml file from where you saved it and the object magically appears in front of you in OpenSim :D

10) Frozen Avatar. We have two servers running OpenSim. On one I could connect from the client and use the simuator with no problems. On the second I could connect from the client, but then the avatar remained frozen in a T position. After extensive investigation, it turned out eventually to be an issue with our institutional ISA firewall that was dropping the UDP connection on port 9000 between client and server after login. Once the firewall tunnel settings were amended the second server worked fine.

11) Changing the master avatar user I wanted to change the name of the user who was master avatar for a particular region. With the help of kind advice from the opensim users mailing list this eventually turned out to be quite simple (duh!) It was just a case of changing the name of the master avi user in Regions.ini, restaring the sim, logging on using the new master avatar user account and reclaiming the land from the previous owner. (About Land > Reclaim Land...)

12) Missing prims A colleague of mine, Barry Spencer, had been experimenting with physical rocketry in OpenSim. The scripted rockets usually returned to their launch pad once they reached a certain height. Unfortunately for reasons unknown some rockets just disappeared. When I checked the prims table in the opensim database (which contains a record for every individual prim) I found some of the rocket prims were at impossible heights and rotations (both positive and negative!). I managed to remove the rogue prims as follows:

i) Stop the client and the simulator
ii) Use PHPMyAdmin to look at the prims table in the database and locate anything that was well out of position
iii) Delete the rows in the prims table in the database corresponding to these "rogue" prims
iv) Restart MySQL, start the simulator and the client in that order.

It appears that if you have the simulator running and try to delete rows from the prims table in the database it re-creates them as soon as your back is turned!

13) Loading a new terrain file As an experiment I wanted to try out loading a terrain file. I found a suitable image using the following URL:

http://www.virtualwhite.com/wp-content/uploads/2008/07/os_terrain_8.png

I uploaded the image to the opensim-0.6.6-release/bin directory, However when I issued the terrain load command at the console I got the following message:

Region (Rookery) # terrain load os_terrain_8.png

** (./OpenSim.exe:5430): WARNING **: PNG images with 16bpp aren't
supported by libgdiplus.
06:35:19 - Command error: System.NotSupportedException: Either the
image format is unknown or you don't have the required libraries to
decode this format [GDI+ status: UnknownImageFormat]


The solution turned out to be to use imagemagick as user opensim to convert the filetype from .png to .bmp as follows:

[opensim@standbyvle bin]$ convert os_terrain_8.png os_terrain_8.bmp

The .bmp file loaded successfully into the console and I now have a new mountainous terrain in my sim :)

In retrospect it looks as it there was something wrong with the format of the os_terrain_8.png file as subsequently I have successfully downloaded and loaded some .png format terrain files.

I found a number of useful 256x256 terrain files that worked first time on the following site:

http://opensimulator.org/wiki/Free_Terrains

I was especially pleased to see that I could load a new terrain in the OpenSim server and the change would immediately be applied in the client without having to relog :)

14) Creating New Regions I have just added three new regions to our standalone installation of OpenSim on our test server. I can now login to the original region using the client and then fly or teleport between regions.

The help menu suggested that region data should be saved in xml region file, but apparently this has been deprecated and all region data is now stored in Regions.ini

The console commands I used are listed below:

Region (Bromley) # create region Lewisham Regions.ini
Region UUID [9b651539-73ca-43fe-a53d-1b9e98a1d42e]:
Region Location [1000,1000]: 1000,1001
Internal IP address [127.0.0.1]: 0.0.0.0
Internal port [9000]: 9001
Allow alternate ports [False]:
External host name [SYSTEMIP]: 195.194.82.16
Master Avatar UUID [00000000-0000-0000-0000-000000000000]:
Master Avatar first name (enter for no master avatar) []: Estate
Master Avatar last name []: Manager
Master Avatar sandbox password []:

Region (root) # create region Bexley Regions.ini
Region UUID [4c7bb355-fe29-4b76-a213-665dcb3c1cdc]:
Region Location [1000,1000]: 1001,1001
Internal IP address [127.0.0.1]: 0.0.0.0
Internal port [9000]: 9002
Allow alternate ports [False]:
External host name [SYSTEMIP]: 195.194.82.16
Master Avatar UUID [00000000-0000-0000-0000-000000000000]:
Master Avatar first name (enter for no master avatar) []: Estate
Master Avatar last name []: Manager
Master Avatar sandbox password []:

Region (root) # create region Sevenoaks Regions.ini
Region UUID [6be666ff-dfa0-4a71-9a81-929f503695fb]:
Region Location [1000,1000] = 1001,1000
Internal IP Address [127.0.0.1]: 0.0.0.0
Internal port [9000]: 9003
Allow alternate ports [False]:
External host name [SYSTEMIP]: 195.194.82.16
Master Avatar UUID [00000000-0000-0000-0000-000000000000]:
Master Avatar first name (enter for no master avatar) []: Estate
Master Avatar last name []: Manager
Master Avatar sandbox password []:

OpenSim automatically wrote this data into Regions.ini and after restarting the simulator (just to be on the safe side) the new regions were available :)

15) Internal and External Access

We wanted to provide access to the simulator both externally from the Internet (via a GNAT box) and internally from the staff and student intranets (via an ISA Server Firewall). The main problem we enountered with internal and external access related to the region handshake failing. During login, it appears that the client initially uses the address associated with the client Login URI box (FQDN accepted here) to connect to the server and exchange authentication information using the TCP protocol. Before the region handshake takes place the server provides the client with a new IP address to use in client server communications. This is derived from the ExternalHostName parameter in Regions.ini (FQDN NOT accepted here). When the client reaches the point of the region handshake, it switches to using a mix of TCP & UDP protocols and the new server IP address. This change of address for the server can easily result in the region handshake failing if the client cannot reach the server on the new address. The client initiates the region handshake by sending UDP packet(s) and times out if these packets are undeliverable.

The problem with internal access was eventually solved by a change of protocol definition associated with the appropriate ISA UDP rule. The protocol definition for UDP needed to include both "Send Receive" and "Receive Send", so that two-way UDP traffic was allowed.

We now have both internal and external access to the simulator working fine, using the external IP address in each of the ExternalHostName parameter(s) in Regions.ini :)))

An additional problem we had with internal access was that the client inexplicably timed out whilst waiting for the region handshake when the avatar had been last left in the default region. If the avi had been left in another region e.g. Lewisham, login was fine! Our solution to this was to move the default region from port 9000 to port 9004 in Regions.ini

16) Groups and offline IM's

Groups are a complex concept and the code to support them is not yet fully integrated into the OpenSim core. The OpenSimulator Testing group can be enabled using the following parameters in OpenSim.ini:-

[Groups]
Enabled = true

; This is the current groups stub in Region.CoreModules.Avatar.Groups
Module = Default

All users on the simulator then belong to this group. With the above settings it does not appear possible to create new groups using the client. There is 3rd party group managment software available for download but I have not tried it yet. For more information on the group module in OpenSim see the link below:

http://www.osgrid.org/forums/viewtopic.php?f=9&t=1595

Offline IM's are not supported in the OpenSim core either but once again there is 3rd party software available to download to fill this gap. However the installation instructions are not very clear!

Return to Menu

4 comments:

  1. Hey,

    After I install mono-142439 from the source trunk. I use mono -v to find if its working. I get a response command not found.

    I am using CentOS5.3 on my webserver.

    I am sure DSPACE and LAMS are not prerequisite to install mono on CentOS 5.3?

    Everything else until the installation of mono, I have done as per the details mentioned above.

    Please help me.

    I am new to linux and opensim.

    Thank you.

    Kishore

    ReplyDelete
  2. Hi Kishore

    DSpace and LAMS are nothing whatsoever to do with OpenSim.

    1) What user are you logged in as when you type mono -V ?
    2) Have you installed mono as that user?
    3) Do you have the relevant paths for mono in that user's .bashrc file?

    Good luck

    Clive

    ReplyDelete
  3. Hi Clive,

    Thank you for the response.

    I have solved the issue.

    The issue being in mono mcs/docs was not building. I figured it out with help of a friend.

    I have disabled the docs building for mcs in the makefile and tried to build mono (The latest revision number) and got it working.

    Once again thank you for the response.

    Cheers,
    Kishore

    ReplyDelete
  4. Dear Clive

    Thank you for this excellent series of tutorials. Thanks to your assistance, I not only installed Diva on two spanking new CentOS VPS's, I also learned to love Linux! I deeply appreciate your help. Please keep up the great work!

    Best wishes,
    Chris

    ReplyDelete