This tutorial is for getting Opensimulator running on Linux Ubuntu 11.10 which is my choice as it has mono 2.10.5 as default and is the quickest, easiest way to get a Linux-hosted sim on an Amazon Web Services EC2 instance. Ubuntu is readily available in the list of Linux images, but there are also a few other distros such as CentOS, Fedora, OpenSuse, Debian, and more. (Update: Ubuntu 12.04 has been available for a while since I wrote this, with a more recent version of mono).
I am skipping over the part about signing up, acquiring and loading an AWS instance to start with, Amazon has very good documentation on that part.
First thing you may need to do is open SSH port 22, safest is to do it only for the IP you will be connected from whether that be at home or where ever you will be remote logging in to the server from. AWS offers a GUI firewall in the control panel, it's called Security Groups.
In your AWS Management Console, in the EC2 tab, will be the Navigation column on the left. Go down and click on Security Groups.
Once there, click on the Inbound tab and choose SSH in the dropdown menu for a new rule. Add 22 for port range, then your home IP for source.
Next, for your simulator's http_listener port (set in the OpenSim.ini [Network] section) create a new Custom TCP rule. You can go for a range of ports to open if you want to plan ahead in case you will want multiple instances. Type 9000-9030 for TCP.
Now for opening region ports, switch to UDP and make a new rule identical to TCP. Your Securities Group for this instance should look something like this:
Attachment:
AWSManagementConsole_2012-03-17_00-03-48.png [ 28.81 KiB | Viewed 1923 times ]
Note that I also added Port 80 to the TCP rules, in case I would be installing a web server. This is optional of course, it's a good idea to not open this if you will not be running a web server.
Next, I have outlined the basic procedures for getting a sim up and running. At this point, your server is still somewhat insecure and needs to be "hardened" or protected from attack. For more info on this, I refer you to this thread:
Guide for Security on an Unmanaged VPS for OpenSimThe following procedures are all included in the above link in more detail, so you can go directly there and continue - or get your sim up and running first with this quickstart, then harden your server up later. Be advised, unscrupulous people are continually trying to find servers to break into so don't let that go for too long!
Log in to your server with Putty if you are on Windows, or with ssh in the terminal if on Linux or Mac. I have not included details for logging in, that should be covered in the AWS help or in the info for your particular instance.
Your server image may not be up to date, so take care of this first:
1.) Run
Code:
ubuntu@domU-12-31-39-xx.xx.xx:~$ sudo apt-get update
2.) install screen:
Code:
ubuntu@domU-12-31-39-xx.xx.xx:~$sudo apt-get install screen
3.) add .screenrc file: in your ubuntu directory, open a new file named .screenrc in the nano text editor by typing:
Code:
ubuntu@domU-12-31-39-xx.xx.xx:~$ nano .screenrc
have the following loaded to clipboard, and in the nano editor, use the right mouse button to paste:
Code:
startup_message off
hardstatus alwayslastline "%{=b}%{G} %H Screen(s): %{b}%w %=%{kG}%C%A %D, %M/%d/%Y "
defscrollback 500
type Ctl-O to write out (save) then Return to accept, then Ctl-x to exit nano
4.)open screen (a command-line window manager which allows you to run multiple processes, each in it's own window) - type:
Code:
ubuntu@domU-12-31-39-xx.xx.xx:~$ screen
open additional windows (screens) by typing Ctl-A + c
Ctl-A is a command prefix for all screen commands. Type Ctl-A ? for a list of commands.
5.) You will need a real time process viewer to refer to often, the Linux binary for this is named "top" so in one of your screens (the first one is fine) just type the word
Code:
ubuntu@domU-12-31-39-xx.xx.xx:~$ top
.
6.) Open a new tab with Ctl-A + c or to move to an existing window, type Ctl-a +n where n=window number as shown at bottom of screen.
7.) Install mono in Ubuntu's root system. Currently at 2.10.5, perfect for running opensim. Make sure you are in a new window with the ubuntu bash prompt like this:
Code:
ubuntu@domU-12-31-39-xx.xx.xx:~$
Now install mono with apt-get using the following command:
Code:
ubuntu@domU-12-31-39-xx.xx.xx:~$ sudo apt-get install mono-complete
Lots of text will quickly scroll by, it will stop momentarily asking if you want to continue - just type Y for yes and hit Return. The text will continue to zip by for several minutes depending on the connection speed and processor speed. This took about 5 minutes on my AWS EC2 instance.
8.) Create the opensim directory where you will install Opensim:
Code:
ubuntu@domU-12-31-39-xx.xx.xx:~$ mkdir opensim
9.) Move into that directory and create another for the type of Opensim you wish to install - use the cd command, which means "change directory" with the directory's name after the cd command:
Code:
ubuntu@domU-12-31-39-xx.xx.xx:~$ cd opensim
If I will be installing multiple instances of OpenSim, I'll want each in it's own subdirectory. I will be hooking up to OSGrid first, then later I will install a seperate instance as a standalone so I created two subdirectories:
Code:
ubuntu@domU-12-31-39-xx.xx.xx:~$ mkdir osgrid
Code:
ubuntu@domU-12-31-39-xx.xx.xx:~$ mkdir opensim
10.) Now we can install Opensimulator. You need the download link so get the one for OSGrids release from
http://www.osgrid.org/index.php/downloads and copy to clipboard.
wget is the command download tool for Linux, just type that followed by the link to the zip file to start the download. You will want to be in the directory where the install will be, so first use the change directory command to get there:
Code:
ubuntu@domU-12-31-39-xx.xx.xx:~$ cd osgrid
Then type:
Code:
ubuntu@domU-12-31-39-xx-xx-xx:~$ wget http://osgrid.googlecode.com/files/osgrid.opensim-03012012.v0.7.4.0007711.zip
The download should take only a few seconds on an AWS server intance.
Now, unzip the file. You will probably need to install "unzip" with this command:
Code:
sudo apt-get install unzip
Extract the downloaded file with the "unzip" command:
Code:
unzip http://osgrid.googlecode.com/files/osgrid.opensim-03012012.v0.7.4.0007711.zip
11.) OK! We are ready to start up the sim. You should be in the osgrid subdirectory, with the command prompt looking similar to this:
Code:
ubuntu@domU-12-31-39-xx.xx.xx:~/opensim/osgrid$
Use the "ls" command to see a short list of the directory contents.
Code:
ubuntu@domU-12-31-39-xx.xx.xx:~/opensim/osgrid$ ls
You should see something like this:
Code:
bin optional osgrid.opensim-03012012.v0.7.4.0007711.zip version.txt
go into the bin directory:
Code:
ubuntu@domU-12-31-39-xx.xx.xx:~/opensim/osgrid$ cd bin
Now start up Opensim, invoking it with mono:
Code:
ubuntu@domU-12-31-39-xx.xx.xx:~/opensim/osgrid/bin$ mono OpenSim.exe
Linux is case-sensitive, so be sure to type the capital letters!
Have your region name, location, and external IP ready for the startup process. You can use the Public DNS address given in your AWS Management Control Panel, for that particular instance which will be similar to this:
Code:
ec2-50-1x-1x8-xx.compute-1.amazonaws.com
At this point, you can run your sim on the default Sqlite database included with Opensimulator. If you desire to use MySQL, which is highly recommended, it's a trival task to install MySQL with the following command:
Code:
sudo apt-get install mysql-server
You will be prompted for a root password. Choose a long secure one.
Then, create a MySQL database, a user, and grant that user rights to the database:
Code:
mysql> create database opensim;
Code:
mysql> create user 'ubuntu'@'localhost' identified by 'xxxxxx';
Code:
mysql> grant all on *.* to 'ubuntu'@'localhost';
Shut down the sim, and open config-include/GridCommon.ini to edit the database connection strings, comment out Sqlite, uncommenting MySQL and adding the above database info into the string.
Now before starting the sim back up, you need to change the default MONO_THREADS_PER_CPU setting, which is generally too low for good Opensim performance. Move back up to the root level of your home/ubuntu user directory with this command:
Code:
cd ~
Now if you do the ls command to see a list of files and folders, you should see a file named .bashrc but files beginning with a period are invisible, so you add the -a option for "all" to see everything:
Code:
ubuntu@domU-12-31-39-xx.xx.xx:~ ls -a
Code:
. .bash_history .bashrc install.sh opensim readme.txt .ssh
.. .bash_logout .cache .mysql_history .profile .screenrc .sudo_as_admin_successful
You want to edit the .bashrc file with nano to add the new setting for MONO_THREADS_PER_CPU at the end of that file.
Code:
ubuntu@domU-12-31-39-xx.xx.xx:~ nano .bashrc
Copy the following line into your clipboard:
Code:
add export MONO_THREADS_PER_CPU=100
looking at the .bashrc file in nano, jump down to the end of the page using Ctl-v and use the Down arrow key to get the cursor all the way to the bottom.
Use the right mouse button to dump the clipboard contents into the last line, be sure to click only once.
Save the file with Ctl + o
Hit the Return key to accept changes
exit nano with Ctl + x
Now start the sim back up and see if all is well.
I'll continue to add more tips as time goes by and questions/suggestions are added to this thread.