Opensimulator is often referred to as just Opensim and can be set up on multiple operating systems. Even when it is set up on the same operating system, there are many ways to set up and configure opensimulator. This article is specifically written to setup Ubuntu 20.04 for Opensimulator.
Basic setup Requirements of Opensimulator
- A server (can be a standard PC)
- Router with NAT (network address translation) loopback
- Operating system
- Web server software
- Database system
- Mono Complete
- Opensimulator software
Setup Ubuntu 20.04 for Opensimulator using
- Nginx (Web Server) – Click here for Apache Alternative On Windows
- MySQL 8 (database)
- Mono-Complete (latest version)
- Opensimulator (in grid mode with multiple instances of Robust) – later article linked at the end.
Setting Up Ubuntu 20.04 Focal Fossa
These instructions assume a fresh installation of Ubuntu 20.04 Focal Fossa server. While it is perfectly possible to set up on Ubuntu desktop, some of the default packages may vary. Predominantly the two systems should work in the same way.
Install and Setup Nginx
1. Install Nginx
sudo apt install nginx
2. Check the firewall can see Nginx and add a rule to allow it.
sudo ufw app list
Available applications: Nginx Full Nginx HTTP Nginx HTTPS OpenSSH
4. Add Nginx Full to the firewall rules
sudo ufw allow 'Nginx Full'
3. Ensure Nginx Full is using port 80 and 443
Neither of these ports is strictly required for Opensim. However most grids also want a website, so they are included here.
sudo ufw app info "Nginx Full"
Profile: Nginx Full Title: Web Server (Nginx, HTTP + HTTPS) Description: Small, but very powerful and efficient web server Ports: 80,443/tcp
Check Nginx is working correctly by putting the URL or IP address of the server into your web browser. If all is well, the in the browser will be the following display.
sudo apt-get install mysql-server
1. Add two databases which use the UTF8 character set.
Usually, in a grid setup, the Robust databases and the Simulator Instances will be on different servers. However, they are put together here for convenience.
CREATE DATABASE Robust CHARACTER SET utf8 COLLATE utf8_unicode_ci; CREATE DATABASE Instance1 CHARACTER SET utf8 COLLATE utf8_unicode_ci;
2. Add a new user to use like a root user
CREATE USER 'rootLikeUser'@'localhost' IDENTIFIED BY 'password';
3. Create a user for the databases identified with native password
CREATE USER 'OpenSimAdmin'@'localhost'IDENTIFIED WITH mysql_native_password BY 'password';
4. Grant all privileges for ‘rootLikeUser’ to all databases and grant all privileges for OpenSimAdmin to the Opensim databases.
GRANT ALL PRIVILEGES ON *.* TO 'rootLikeUser'@'localhost'; GRANT ALL PRIVILEGES ON Robust.* TO 'OpenSimAdmin'@'localhost'; GRANT ALL PRIVILEGES ON SimulatorInstance1.* TO 'OpenSimAdmin'@'localhost';
Database user names, database names and passwords should all be changed to something unique to the system being set up.
FLUSH PRIVILEGES; Exit;
6. Secure the MySQL installation
**I personally suggest saying “no” to the validate password plugin question and yes to everything else. Regardless of this option, always make secure passwords. Unless you have other users and you need to enforce the passwords, this option is pointless.
7. Make MySQL server uses native password by default
The previous LTS (Ubuntu 18.04) uses MySql 5, however Ubuntu 20.04 uses MySQL 8. As a result, a few changes must be made to the MySql settings. This is because Opensim requires the use of a native password (Please see the Opensim Mantis Post for more details).
Add the following to the bottom of the file /etc/mysql/mysql.conf.d
#changes for opensim use ssl=0 skip_ssl default-authentication-plugin=mysql_native_password
Save and exit with the following key presses
Ctrl+O ENTER Ctrl+x
8. Restart the MySQL server
sudo systemctl restart mysql
Add the rest of the firewall rules.
These firewall ports are based specifically on the guide which follows this one on configuring Opensimulator. The following ports will be allowed.
- 9000 TCP – Used by the simulator instance (one per instance, the value set in OpenSim.ini).
- 8002 TCP – Public port of the robust server – Used by viewers to log in
- 8003 TCP – Private port of the main robust server. S
- 8004 TCP – Private port robust asset instance
- 8005 TCP – Private port robust grid user instance
- 8006 TCP – Private port robust inventory instance
- 8007 TCP – Private port robust map instance
- 9000-9009 UDP – One for each region running on this server (support for 9 regions).
sudo ufw allow 9000/tcp sudo ufw allow 8002:8007/tcp sduo ufw allow 9000/udp
Private ports should only be accessible to computers running simulators which connect to this robust. This example opens the grid so anyone can connect their own simulators to it.
Install and setup Mono-Complete
The version of mono shipped in the Focal Fossa repositories has a memory leak. Consequently, it is a good idea to avoid this by adding the mono repository and install the latest version.
sudo apt install gnupg ca-certificates sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list sudo apt update sudo apt-get install mono-complete
Router – Setup Ubuntu 20.04 for Opensimulator
Covering all possibilities for route configuration is impossible. Also showing ours is pointless. The router must be configured to forward the ports listed in the firewall rules to the server. Additionally, it needs to support NAT loopback Thank you for reading our guide to Setup Ubuntu 20.04 for Opensimulator.
Setup Ubuntu 20.04 for Opensimulator – Related Posts
- Opensim with multiple Robust services on Ubuntu
- Automated Opensim Startup and Shutdown
- Ubuntu Opensim Server Backup.
- Securing An Opensim Ubuntu Server
Final Word – Article Updates
This article was updated on 16th June 2020. Originally Apache was used and this has been changed to Nginx. Additionally, the original showed the installation of Webmin and PHPMyAdmin. Since Apache2 will be used in an upcoming windows article, I felt showing Nginx here displays more choices. After suffering security breaches with both Webmin and PhpMyadmin, I have decided to cover these and SSH key pairs in a separate article.