Setting up a Multiplayer Server: Difference between revisions

From Vintage Story Wiki
update to 1.18.8 net7
No edit summary
(update to 1.18.8 net7)
Line 3: Line 3:
== Basic Setup == <!--T:1-->
== Basic Setup == <!--T:1-->


===Ad-hoc Server=== <!--T:2-->
=== Ad-hoc Server === <!--T:2-->
If you want a temporary multiplayer experience it is enough to open a single player world, then click on "Open to Lan" in the escape menu. This will allow players in your local network to join.
If you want a temporary multiplayer experience it is enough to open a single player world, then click on "Open to Lan" in the escape menu. This will allow players in your local network to join.
If you want to allow players outside of your local network to join, you can then also click "Open to Internet" which will attempt to set up an external connection to join your server from the internet. This is done by a technique called UPnP and has to be enabled on your internet router, which it often is by default. In short, we estimate there's about a 60% success chance that 'Open to Internet' works instantly without issues. If it doesn't you would need to set up a so called "port forwarding" on your internet router, which can be tricky and frustrating at times, unfortunately. You would need to forward TCP Port 42420 to your computer in that case. (Google 'Port forwarding' with the name or model of your internet router to find help.)
If you want to allow players outside of your local network to join, you can then also click "Open to Internet" which will attempt to set up an external connection to join your server from the internet. This is done by a technique called UPnP and has to be enabled on your internet router, which it often is by default. In short, we estimate there's about a 60% success chance that 'Open to Internet' works instantly without issues. If it doesn't you would need to set up a so called "port forwarding" on your internet router, which can be tricky and frustrating at times, unfortunately. You would need to forward TCP Port 42420 to your computer in that case. (Google 'Port forwarding' with the name or model of your internet router to find help.)
Line 11: Line 11:
----
----


===Dedicated Server=== <!--T:4-->
=== Dedicated Server === <!--T:4-->
Alternatively the game ships with a dedicated server program that you can start and leave on permanently without needing to log in yourself.
Alternatively the game ships with a dedicated server program that you can start and leave on permanently without needing to log in yourself.
There are several ways to get a dedicated server up and running.
There are several ways to get a dedicated server up and running.
Line 24: Line 24:
----
----


=== Dedicated Servers on Linux === <!--T:7-->
==== Dedicated Servers on Linux ==== <!--T:7-->
This describes how to set up the server as a service on Linux systems.
This describes how to set up the server as a service on Linux systems.


===== Requirements for CentOS 7 (RHEL, Fedora, ...) ===== <!--T:8-->
===== Requirements ===== <!--T:8-->
'''1. EPEL/screen/wget/curl Install'''


  <!--T:9-->
* [https://dotnet.microsoft.com/en-us/download/dotnet/7.0 .NET Runtime 7.0] This should be all needed to run a Vintagestory server. Everything else is just for convenience to start and manage it.
yum -y install epel-release screen wget curl
* install <code>pgrep</code>, <code>screen</code> and <code>wget</code> using your systems package manager.


<!--T:10-->
'''2. Mono Install'''


  <!--T:11-->
===== Setup the server =====
yum -y install yum-utils
  rpm --import "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF"
  yum-config-manager --add-repo http://download.mono-project.com/repo/centos/
  yum -y install mono mono-devel
----
 
===== Requirements for Ubuntu (Debian, Mint, ...) ===== <!--T:12-->
'''1. screen/wget/curl Install'''
 
  <!--T:13-->
sudo apt install -y screen wget curl
 
<!--T:14-->
'''2. Mono Install'''
 
<!--T:15-->
As of '''Vintage Story version 1.12.7''' and above '''Mono version 5 or higher''' is recommended to use.<br>
This '''HowTo is written assuming Ubuntu 18.04''' as the base OS.<br>
To install the latest stable version for your specific distribution, please follow the instructions from the [https://www.mono-project.com/download/stable/#download-lin Official Mono Project Download Page].
  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-bionic main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
  sudo apt update
  sudo apt install -y mono-complete
 
<!--T:16-->
----<br>


<!--T:17-->
<!--T:17-->
'''3. Download the game'''
'''1. Download the game'''


<!--T:18-->
<!--T:18-->
<span style="color:#E16100">Advice: ''Create a seperate directory for Vintage Story as the tar.gz does not contain a subfolder.''</span>
<span style="color:#E16100">Advice: ''Create a separate directory for Vintage Story as the tar.gz does not contain a subfolder.''</span>
   mkdir server && cd server
   mkdir server && cd server


<!--T:19-->
<!--T:19-->
Goto http://account.vintagestory.at/downloads<br>
Goto http://account.vintagestory.at/downloads<br>
Copy the link of the newest "vs_server_*.*.*.tar.gz" package ('''Tar.gz Archive/Linux (server only)''' under '''Show other available downloads of Vintage Story''')<br>
Copy the link of the newest "vs_server_linux-x64_*.*.*.tar.gz" package ('''Linux Server (.tar.gz)''' under '''Show other available downloads of Vintage Story''')<br>
Download with "wget" via console (''Vintage Story version 1.12.9 in this example'').
Download with "wget" via console (''Vintage Story version 1.18.8 in this example'').


   <!--T:20-->
   <!--T:20-->
wget https://cdn.vintagestory.at/gamefiles/stable/vs_server_1.12.9.tar.gz
wget https://cdn.vintagestory.at/gamefiles/stable/vs_server_linux-x64_1.18.8.tar.gz


<!--T:21-->
<!--T:21-->
'''4. Extract tar.gz package'''
'''2. Extract tar.gz package'''


   <!--T:22-->
   <!--T:22-->
tar xzf vs_server_*.*.*.tar.gz
tar xzf vs_server_linux-x64_*.*.*.tar.gz


<!--T:23-->
<!--T:23-->
'''5. Make server.sh script executeable'''
'''3. Make server.sh script executable'''


   <!--T:24-->
   <!--T:24-->
Line 93: Line 63:


<!--T:25-->
<!--T:25-->
'''6. Edit server.sh file'''
'''4. Edit server.sh file'''


<!--T:26-->
<!--T:26-->
Line 110: Line 80:


<!--T:30-->
<!--T:30-->
'''7. Open the port at the firewall (if needed)'''
'''5. Open the port at the firewall (if needed)'''


<!--T:31-->
<!--T:31-->
Line 120: Line 90:


<!--T:32-->
<!--T:32-->
'''8. Server start and first steps'''
'''6. Server start and first steps'''


   <!--T:33-->
   <!--T:33-->
./server.sh start
  ./server.sh start
 
   Wait for the startup to finish, then you can give yourself OP with
   Wait for the startup to finish, then you can give yourself OP with
   ./server.sh command "/op <youusername>"
   ./server.sh command "/op <youusername>"


<!--T:34-->
<!--T:34-->
'''9. Connect to your IP/Domain and have fun'''
'''8. Connect to your IP/Domain and have fun'''
----
----


===== Requirements for Alpine (Advanced, no support) ===== <!--T:35-->
==== Simple Server start command ====
'''1. Install mono'''
If you want to use a custom script or just manually start your server you can run  
 
dotnet VintagestoryServer.dll --dataPath /path/to/data
<!--T:36-->
Or
As mono is in testing in Alpine, the testing URL (http://dl-cdn.alpinelinux.org/alpine/edge/testing) will have to be uncommented out in
./VintagestoryServer --dataPath /path/to/data
 
if you have the <code>DOTNET_ROOT</code> environment variable set.
  <!--T:37-->
/etc/apk/repositories
 
<!--T:38-->
after, run  
 
  <!--T:39-->
apk update
  apk add mono mono-dev
 
<!--T:40-->
'''2. Install tmux'''
 
  <!--T:41-->
apk add tmux
 
<!--T:42-->
'''3. Certificates'''
 
  <!--T:43-->
apk add ca-certificates
 
<!--T:44-->
then run
 
  <!--T:45-->
cert-sync /etc/ssl/certs/ca-certificates.crt
 
<!--T:46-->
to update the certs.
 
<!--T:47-->
'''4. Simplified Start Script'''
 
<!--T:48-->
Download and extract the server into a location as normal, then put this into a script:
 
  <!--T:49-->
#!/bin/ash
  mono VintagestoryServer.exe --dataPath ./data
 
<!--T:50-->
This script will just run the server, putting the world save files into the same folder the server is extracted to.
As an advanced user, you don't need to worry about having the dependancies, checking for new versions, or installing the server or save files under different users and locations.
 
<!--T:51-->
Run the script in a tmux session.
 
<!--T:52-->
The rest of the normal advice applies too (firewalling etc.).


==== Updating Servers ==== <!--T:89-->
==== Updating Servers ==== <!--T:89-->
Line 240: Line 161:
==== Installation ==== <!--T:61-->
==== Installation ==== <!--T:61-->


<!--T:62-->
'''1. mono Install Debian 9'''
  sudo apt install apt-transport-https dirmngr gnupg ca-certificates wget nano
  sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
  echo "deb https://download.mono-project.com/repo/debian stable-stretch main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
  sudo apt update
  sudo apt install mono-devel
<!--T:63-->
For Debian 10 use
  echo "deb https://download.mono-project.com/repo/debian stable-buster main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list


<!--T:64-->
<!--T:64-->
'''2. create a user'''
'''1. create a user'''
   adduser --shell /bin/bash --disabled-password gameserver
   adduser --shell /bin/bash --disabled-password gameserver


Line 263: Line 173:


<!--T:66-->
<!--T:66-->
'''3. Download the game'''
'''2. Download the game'''
   cd /srv/gameserver/vintagestory
   cd /srv/gameserver/vintagestory


<!--T:67-->
<!--T:67-->
Goto http://account.vintagestory.at/downloads<br>
Goto http://account.vintagestory.at/downloads<br>
Copy the link of the newest "vs_server_*.*.*.tar.gz" package ('''Tar.gz Archive/Linux (server only)''' under '''Show other available downloads of Vintage Story''')<br>
Copy the link of the newest "vs_server_linux-x64_*.*.*.tar.gz" package ('''Linux Server (.tar.gz)''' under '''Show other available downloads of Vintage Story''')<br>
Download with "wget" via console (''Vintage Story version 1.12.9 in this example'').
Download with "wget" via console (''Vintage Story version 1.18.8 in this example'').


   <!--T:68-->
   <!--T:68-->
wget https://cdn.vintagestory.at/gamefiles/stable/vs_server_1.12.9.tar.gz
wget https://cdn.vintagestory.at/gamefiles/stable/vs_server_linux-x64_1.18.8.tar.gz


<!--T:69-->
<!--T:69-->
'''4. Extract tar.gz package'''
'''3. Extract tar.gz package'''


   <!--T:70-->
   <!--T:70-->
tar xzf vs_server_1.12.9.tar.gz
tar xzf vs_server_linux-x64_1.18.8.tar.gz
'''5. Change owner'''
 
'''4. Change owner'''


<!--T:71-->
<!--T:71-->
Line 286: Line 197:


<!--T:72-->
<!--T:72-->
'''6. Create systemd service unit file'''
'''5. Create systemd service unit file'''


<!--T:73-->
<!--T:73-->
Line 298: Line 209:
   [Service]
   [Service]
   WorkingDirectory=/srv/gameserver/vintagestory
   WorkingDirectory=/srv/gameserver/vintagestory
   ExecStart=/usr/bin/mono VintagestoryServer.exe --dataPath /srv/gameserver/data/vs
   ExecStart=dotnet VintagestoryServer.dll --dataPath /srv/gameserver/data/vs
   Restart=always
   Restart=always
   RestartSec=30
   RestartSec=30
Line 309: Line 220:
   [Install]
   [Install]
   WantedBy=multi-user.target
   WantedBy=multi-user.target
Make sure the new user has access to the <code>dotnet</code> command or replace the command with the full path to where you installed the dotnet runtime (if you picked a custom install). Or you can also use <code>ExecStart=VintagestoryServer --dataPath /srv/gameserver/data/vs</code> if you have the <code>DOTNET_ROOT</code> environment variable set.


<!--T:74-->
<!--T:74-->
'''7. Create config file for rsyslog'''
'''6. Create config file for rsyslog'''


<!--T:75-->
<!--T:75-->
Line 338: Line 251:
   # Discard  
   # Discard  
   if $programname == 'VSSRV' then ~
   if $programname == 'VSSRV' then ~
'''8. restart rsyslog / enable service'''
'''7. restart rsyslog / enable service'''
To activate rsyslog and your vintagestory server type these commands
To activate rsyslog and your vintagestory server type these commands
   systemctl restart rsyslog.service;
   systemctl restart rsyslog.service;
Line 405: Line 318:
Copy from step 6 and change these lines:
Copy from step 6 and change these lines:
   Description=Vintage Story Server 2 Unit
   Description=Vintage Story Server 2 Unit
   ExecStart=/usr/bin/mono VintagestoryServer.exe --dataPath /srv/gameserver/data/vs2
   ExecStart=dotnet VintagestoryServer.dll --dataPath /srv/gameserver/data/vs2
   SyslogIdentifier=VSSRV2
   SyslogIdentifier=VSSRV2
Create rsyslog file and copy code from step 7
Create rsyslog file and copy code from step 7
Confirmedusers, editor
18

edits