Rent a server: Difference between revisions

From Open Metaverse Wiki
(Entering this page for the first time)
 
m (Adding backlink to the Grid owners index page)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
''[[Opensimulator]]: [[OpenSimulator Grid Owners Home|Grid Owners]]: Rent a server''
==How Big a System do You Need?==
==How Big a System do You Need?==
There are people who have a formula based on the number of cores and amount of memory. This is based on how many users you expect to visit your grid at once. I think these formula go a little overboard. I have run a 4x4 var region on a Raspberry Pi with 4 cores, 4GB of memory and a 32GB SD card as the disk drive. Probably 32GB memory, 8 processor cores and 200GB of NVMe disk is plenty for a small grid. OpenSim does not use much disk space at the start. The asset database grows without limit, but you can move the assets to another drive or server when disk space runs low. A VPS (Virtual Private Server) is probably OK. For a big serious grid you want a Dedicated Server but those are more expensive.  
There are people who have a formula based on the number of cores and amount of memory. This is based on how many users you expect to visit your grid at once. I think these formula go a little overboard. I have run a 4x4 var region on a Raspberry Pi with 4 cores, 4GB of memory and a 32GB SD card as the disk drive. Probably 32GB memory, 8 processor cores and 200GB of NVMe disk is plenty for a small grid. OpenSim does not use much disk space at the start. The asset database grows without limit, but you can move the assets to another drive or server when disk space runs low. A VPS (Virtual Private Server) is probably OK. For a big serious grid you want a Dedicated Server but those are more expensive.  
Line 27: Line 29:
And it will now be there! This does most of the work for programs that have complicated setups which require not only executable files but special folders, WEB pages and/or services running in the background.
And it will now be there! This does most of the work for programs that have complicated setups which require not only executable files but special folders, WEB pages and/or services running in the background.


==Turn on the firewall==
Continue to the next page: [[Setting up a Linux System]] to Run OpenSim
Ubuntu arrives with the firewall turned off, so one of the first things you should do is enable this. (I think ufw stands for Use Fire Wall). Type the following commands in the root terminal window:
    ufw allow 22
    ufw allow 80
    ufw allow 443
    ufw allow 8002
    ufw allow 8020:8200/tcp
    ufw allow 8020:8200/udp
    ufw allow 10000
    ufw enable
    ufw status verbose
22 is for SSH, 80 is for http WEB pages, 443 is for https. 10000 is for WEBmin, By default OpenSim uses 8002 externally. And is uses 8003 internally (don't export that). A bunch of other OpenSim addons use numbers in the low 8000's so I'm starting with 8020 for all the regions, some people use the 9000's for that. Regions use one TCP port and one UDP port, they can be the same number. It is recommended to run each region in a separate 'instance' (a separate copy of OpenSim.exe) and this instance will need to have a port reserved for it. However, it is common to combine many low-usage regions (like oceans) under one instance. Each of these ocean regions will also need their own port number. At first I kept a list of what ports I was using in a spreadsheet. Or using grep (a Linux search tool) to tell me what ports are used. A database search can also find them. Eventually I wrote grid management code to choose unused ports for me.
 
==Create a Swap File==
 
Ubuntu is usually installed with no or with a small swap file. This is used for 'virtual memory' when a program uses more than all the available memory. Most advice on the Internet says you don't need a big swap file, it should never be over 4GB. Unix Guru's will tell you if a system uses virtual memory then something is wrong. Well, something must be wrong with OpenSim because every once in a while it uses a HUGE amount of memory. If you run out of both real and swap file virtual memory while generating maps or building an OAR file, the OpenSim instance will crash or start failing in strange ways. I'm not sure how much swap space is needed, but making it as big as your memory seems to fix a lot of OpenSim crashes.
    swapoff #if you have an old small swap file
    fallocate -l 30G /storage/swapfile
    chmod 600 /storage/swapfile
    mkswap /storage/swapfile
    swapon /storage/swapfile
    edit /etc/fstab
    ;add the swapfile to the end of /etc/fstab by adding this line:
    /storage/swapfile swap swap defaults 0 0

Latest revision as of 21:57, 27 September 2023

Opensimulator: Grid Owners: Rent a server

How Big a System do You Need?

There are people who have a formula based on the number of cores and amount of memory. This is based on how many users you expect to visit your grid at once. I think these formula go a little overboard. I have run a 4x4 var region on a Raspberry Pi with 4 cores, 4GB of memory and a 32GB SD card as the disk drive. Probably 32GB memory, 8 processor cores and 200GB of NVMe disk is plenty for a small grid. OpenSim does not use much disk space at the start. The asset database grows without limit, but you can move the assets to another drive or server when disk space runs low. A VPS (Virtual Private Server) is probably OK. For a big serious grid you want a Dedicated Server but those are more expensive.

When you order a server you have the choice of operating system. I recommend the most up-to-date version of Ubuntu. As of this writing that is Ubuntu 22.04. The host company will pre-install Ubuntu with LAMP (Linux Apache Mysql Php) (almost) ready to go.

Many tutorials on the WEB about managing a Linux computer fail to mention that instructions are often different for different versions of Ubuntu. For example Mono, the compiler/library used by OpenSim, requires a certification key to install and the key is different for each version of the OS. All my instructions here will assume Ubuntu 22.04. If you have a different version, you will have to search for instructions that match your OS.

When you rent a server, it will come with a private IP address. The cloud sever company will give you a management account for doing things like restarting the server. They will give you a 'root' account AND password to SSH logon to linux on the server. Don't loose that password!

Logging on to Your New Server

Choose an SSH (Secure Shel) app on your PC, like Bitvise, PUTTY, PAC. Given the IP address, root, and root password you can log onto the server. An SSH client is a "Terminal Window" into your server, like a remote DOS box. Bitvise on Windows does both SSH terminals and an SFTP window for file transfers. I have Linux on my home computers, so I'm using PAC to SSH login, FileZilla to do SFTP file transfers. FileZilla has a version for Linux, Mac and even Windows.

Two Ways to Edit Setup Files

Setting up and managing a Linux server involves editing a lot of text files. You can edit them by logging onto an SSH terminal window and learning to use a native text editor. HOWEVER, you will probably find it more convenient to edit files in the window of your SFTP application. You can use your favorite text editor on your PC and the SFTP app does the work behind the scenes of transferring the changes back to the server.

Ignore sudo

When you look for help on the internet, you will often see them insert the word 'sudo ' before every command. This means the command must run as the root user. If you log onto the root account directly, 'sudo' is not necessary. Even 'sudo' only works on accounts that have permission to use it, and I think it is a security risk to give 'sudo' permission to other accounts. So I always log onto root to enter these commands. SSH programs like Bitvise and PAC can remember account and password information for you and make logging on as easy as double-clicking an icon on your screen. Many of the commands in the next few sections of this document are going to assume you are logged on as root.

Installing Apps and Updating a Linux System

On an Ubuntu Linux system there is an app named 'apt' (also named 'apt-get') that makes maintaining your operating system pretty easy. Log onto the root account of your server any time and type:

   apt update
   apt upgrade

The first command goes to the Internet and checks to see if any of your installed programs needs an update, including security updates to the operating system itself. The second line tells 'apt' to go ahead and upgrade anything that needs upgrading. It usually stops and makes you agree to use up the extra disk space. You also use apt to install new programs on your system. For example if you need the source control program 'git' and your server doesn't have it, log in as root and type:

   apt install git

And it will now be there! This does most of the work for programs that have complicated setups which require not only executable files but special folders, WEB pages and/or services running in the background.

Continue to the next page: Setting up a Linux System to Run OpenSim