Change font size
It is currently Tue May 21, 2013 1:47 pm

Forum rules


Image
Keep the training material related in some way to OSGrid and OpenSIM or tools that you would use externally to opensim such as image editors and database tools etc... but ultimately the material presented benefits OpenSIM and OSGrid.



Post a new topicPost a reply Page 1 of 1   [ 5 posts ]
Author Message
 Post subject: Quickstart tutorial: Install Opensim on an AWS EC2 instance
PostPosted: Fri Mar 16, 2012 9:06 pm 
Site Admin
User avatar

Joined: Sun Feb 22, 2009 1:39 pm
Posts: 342
Location: Wisconsin, USA
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
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 OpenSim

The 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.

_________________
Help keep our forums a pleasant place. Please report any issues, disputes or flame wars with the Image button, don't try to play moderator. That's our job :)


Top
 Profile  
 
 Post subject: Re: Quickstart tutorial: Install Opensim on an AWS EC2 instance
PostPosted: Tue Mar 20, 2012 2:29 pm 
Site Admin
User avatar

Joined: Sun Feb 22, 2009 1:39 pm
Posts: 342
Location: Wisconsin, USA
Some tips on choosing an Ubuntu image.
There are quite a few special purpose images people have made available to serve a dedicated purpose, these you should probably avoid.
These will have names with words like the following:

Quote:
API-Tools
apache-bench/weighttp
alestic-git-server
milestone
nodejs-stable
cloudsidekick-cato
RStudio
jboss-as-7.1
RightScale
haproxy
starcluster-base
komonzu-sandbox


What you will want is a name like this:
Quote:
ubuntu/images/ebs/ubuntu-oneiric-11.10-i386-server

or this:
Quote:
ubuntu/images/ebs/ubuntu-oneiric-11.10-amd64-server


I have avoided anything with the word "beta" in it, but for all I know that may be ok if you want to try.

Most useable images are 8 gb in size, I would not go any smaller.

Last I looked on o3/20/12 there were 89 total 11.10 images, and I found at least 10 that would work fine. Some may be limited to the type of image they may be loaded as, for example, only the micro instance. Most you can choose when you are setting them up. Here is a list of Ubuntu 11.10 images I felt would be suitable, you can do a search just by using the number:
Code:
ami-5df82f34
ami-6ba27502
ami-8066bbe9
ami-a0ba68c9
ami-a562a9cc
ami-a7f539ce
ami-bf8959d6

_________________
Help keep our forums a pleasant place. Please report any issues, disputes or flame wars with the Image button, don't try to play moderator. That's our job :)


Top
 Profile  
 
 Post subject: Re: Quickstart tutorial: Install Opensim on an AWS EC2 instance
PostPosted: Thu Nov 01, 2012 5:35 pm 

Joined: Sat Nov 14, 2009 1:30 pm
Posts: 5
Got it running. Except MYSQL which I will work on tonight or this weekend. Have you got any idea of what it costs to leave a single region running 24x7 on a micro instance?


Top
 Profile  
 
 Post subject: Re: Quickstart tutorial: Install Opensim on an AWS EC2 instance
PostPosted: Sun May 19, 2013 7:00 pm 

Joined: Sun May 19, 2013 6:59 pm
Posts: 1
Worked like a charm. Except one step was missed and that was the extract command for the unzip.

The security group setting details could be explained further as I didn't know what the 0-65500 == sg-xxxxxx meant.

Make sure you set your internal ip correctly; especially if you're using Amazon's new VPC feature-set.

Thunder


Top
 Profile  
 
 Post subject: Re: Quickstart tutorial: Install Opensim on an AWS EC2 instance
PostPosted: Sun May 19, 2013 11:48 pm 
Site Admin
User avatar

Joined: Sun Feb 22, 2009 1:39 pm
Posts: 342
Location: Wisconsin, USA
I added the unzip command, thanks for the heads up and feedback :)

_________________
Help keep our forums a pleasant place. Please report any issues, disputes or flame wars with the Image button, don't try to play moderator. That's our job :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 5 posts ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
610nm Style by Daniel St. Jules of Gamexe.net