Setting up a Multiplayer Server: Difference between revisions
No edit summary |
(Reworking + Mono requirement) |
||
Line 2: | Line 2: | ||
===Ad-hoc Server=== | ===Ad-hoc Server=== | ||
If you want a temporary multiplayer experience it is enough to open a single player world | 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.) | |||
For this server to work, your single player world has to stay open | For this server to work, your single player world has to stay open. | ||
---- | |||
===Dedicated Server=== | ===Dedicated Server=== | ||
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. | ||
---- | |||
==== Paid hosts ==== | ==== Paid hosts ==== | ||
Some commercial hosting services offer paid server hosting. Currently Vintage Story hosting is offered by [https://pingperfect.com/ PingPerfect], [https://citadelservers.com/ Citadel Server] and [https://www.creeperhost.net/ Creeperhost] | Some commercial hosting services offer paid server hosting. Currently Vintage Story hosting is offered by [https://pingperfect.com/ PingPerfect], [https://citadelservers.com/ Citadel Server] and [https://www.creeperhost.net/ Creeperhost] | ||
==== Dedicated Servers on Windows ==== | ==== Dedicated Servers on Windows ==== | ||
* Enter the games application folder, by default that is %appdata%/VintageStory | |||
* Enter the games application folder, by default that is | |||
* Start VintagestoryServer.exe | * Start VintagestoryServer.exe | ||
* You might need to set up port forwarding on your router if the server should be accessible from beyond your local network | * You might need to set up port forwarding on your internet router if the server should be accessible from beyond your local network (internet). | ||
---- | |||
==== Dedicated Servers on Linux ==== | ==== Dedicated Servers on Linux ==== | ||
This describes how to set up the server as a service on Linux systems. | |||
===== Requirements for CentOS 7 (RHEL, Fedora, ...) ===== | |||
===== Requirements CentOS 7 (RHEL, Fedora, ...) ===== | |||
'''1. EPEL/screen/wget/curl Install''' | '''1. EPEL/screen/wget/curl Install''' | ||
yum -y install epel-release screen wget curl | |||
'''2. Mono Install''' | '''2. Mono Install''' | ||
Line 37: | Line 36: | ||
yum-config-manager --add-repo http://download.mono-project.com/repo/centos/ | yum-config-manager --add-repo http://download.mono-project.com/repo/centos/ | ||
yum -y install mono mono-devel | yum -y install mono mono-devel | ||
---- | |||
===== Requirements Ubuntu (Debian, Mint, ...) ===== | ===== Requirements for Ubuntu (Debian, Mint, ...) ===== | ||
'''1. screen/wget/curl Install''' | '''1. screen/wget/curl Install''' | ||
sudo apt install -y screen wget curl | |||
'''2. Mono Install''' | '''2. Mono Install''' | ||
sudo apt install -y mono-complete | 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 | |||
'''3. Download the game''' | |||
<span style="color:#E16100">Advice: ''Create a seperate directory for Vintage Story as the tar.gz does not contain a subfolder.''</span> | |||
mkdir server && cd server | |||
''' | 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> | |||
Download with "wget" via console (''Vintage Story version 1.12.7 in this example''). | |||
wget https://cdn.vintagestory.at/gamefiles/stable/vs_server_1.12.7.tar.gz | |||
'''4. Extract tar.gz package''' | |||
tar xzf vs_server_*.*.*.tar.gz | |||
'''5. Make server.sh script executeable''' | |||
chmod +x server.sh | |||
'''6. Edit server.sh file''' | |||
For security reasons you should not run the server as root user, so by default USERNAME is set to vintagestory. | |||
On most linux operating systems you can create a user with the command adduser. | |||
adduser vintagestory | |||
Then change these options for your needs: | |||
' | USERNAME='<your-vs-server-username>' | ||
VSPATH='<your-vs-directory>' | |||
'''7. Open the port at the firewall (if needed)''' | |||
firewalld | |||
firewall-cmd --permanent --zone=public --add-port=42420/tcp | |||
firewall-cmd --reload | |||
iptables | |||
iptables -A INPUT -p tcp -m tcp --dport 42420 -j ACCEPT | |||
'''8. Server start and first steps''' | '''8. Server start and first steps''' | ||
./server.sh start | ./server.sh start | ||
Wait for the startup to finish, then you can give yourself OP with | |||
./server.sh command "/op <youusername>" | ./server.sh command "/op <youusername>" | ||
'''9. Connect to | '''9. Connect to your IP/Domain and have fun''' | ||
---- | |||
===== Requirements Alpine (Advanced, no support) ===== | ===== Requirements for Alpine (Advanced, no support) ===== | ||
'''1. Install mono''' | '''1. Install mono''' | ||
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 | 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 | ||
/etc/apk/repositories | |||
after, run | after, run | ||
apk update | |||
apk add mono mono-dev | |||
'''2. Install tmux''' | '''2. Install tmux''' | ||
apk add tmux | |||
'''3. Certificates''' | '''3. Certificates''' | ||
apk add ca-certificates | |||
then run | then run | ||
cert-sync /etc/ssl/certs/ca-certificates.crt | |||
to update the certs. | to update the certs. | ||
'''4. Simplified Start Script''' | '''4. Simplified Start Script''' | ||
Line 123: | Line 132: | ||
Download and extract the server into a location as normal, then put this into a script: | Download and extract the server into a location as normal, then put this into a script: | ||
#!/bin/ash | |||
mono VintagestoryServer.exe --dataPath ./data | |||
This script will just run the server, putting the world save files into the same folder the server is extracted to. | This script will just run the server, putting the world save files into the same folder the server is extracted to. | ||
Line 131: | Line 140: | ||
Run the script in a tmux session. | Run the script in a tmux session. | ||
The rest of the normal advice applies (firewalling etc) | The rest of the normal advice applies too (firewalling etc.). | ||
== Basic Configuration == | == Basic Configuration == | ||
Once your server is up and running you might want | Once your server is up and running you might want to look over some of the following configuration options. You can configure the server while its running through commands or by editing the serverconfig.json, for which the server needs to be stopped. | ||
On windows, by default this file is located at '''%appdata%/VintageStoryData/serverconfig.json'''. | |||
On Linux it's located at '''./data/serverconfig.json''' of your server directory (e.g. ''/home/vintagestory/server/data/serverconfig.json'' if setup like described here) | |||
Here are some of the configurations set by commands, that you'd typically want to | Here are some of the configurations set by commands, that you'd typically want to set. | ||
* <code>/serverconfig name Peaceful PvE Server</code><br>Set up the server name, visible in the public server listing | * <code>/serverconfig name Peaceful PvE Server</code><br>Set up the server name, visible in the public server listing | ||
Line 145: | Line 156: | ||
* <code>/serverconfig advertise (1|0)</code><br>Whether or not add this server to the public server listing | * <code>/serverconfig advertise (1|0)</code><br>Whether or not add this server to the public server listing | ||
Lastly, you can configure a server that was created with the 'Open | Lastly, you can configure a server that was created with the 'Open to Lan' method in the same way as you do for dedicated ones, be aware though, in that case a few of the configurations are overridden by the client, such as the save file location. |
Revision as of 17:42, 10 March 2020
Basic Setup
Ad-hoc Server
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.)
For this server to work, your single player world has to stay open.
Dedicated Server
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.
Paid hosts
Some commercial hosting services offer paid server hosting. Currently Vintage Story hosting is offered by PingPerfect, Citadel Server and Creeperhost
Dedicated Servers on Windows
- Enter the games application folder, by default that is %appdata%/VintageStory
- Start VintagestoryServer.exe
- You might need to set up port forwarding on your internet router if the server should be accessible from beyond your local network (internet).
Dedicated Servers on Linux
This describes how to set up the server as a service on Linux systems.
Requirements for CentOS 7 (RHEL, Fedora, ...)
1. EPEL/screen/wget/curl Install
yum -y install epel-release screen wget curl
2. Mono Install
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, ...)
1. screen/wget/curl Install
sudo apt install -y screen wget curl
2. Mono Install
As of Vintage Story version 1.12.7 and above Mono version 5 or higher is recommended to use.
This HowTo is written assuming Ubuntu 18.04 as the base OS.
To install the latest stable version for your specific distribution, please follow the instructions from the 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
3. Download the game
Advice: Create a seperate directory for Vintage Story as the tar.gz does not contain a subfolder.
mkdir server && cd server
Goto http://account.vintagestory.at/downloads
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)
Download with "wget" via console (Vintage Story version 1.12.7 in this example).
wget https://cdn.vintagestory.at/gamefiles/stable/vs_server_1.12.7.tar.gz
4. Extract tar.gz package
tar xzf vs_server_*.*.*.tar.gz
5. Make server.sh script executeable
chmod +x server.sh
6. Edit server.sh file
For security reasons you should not run the server as root user, so by default USERNAME is set to vintagestory. On most linux operating systems you can create a user with the command adduser.
adduser vintagestory
Then change these options for your needs:
USERNAME='<your-vs-server-username>' VSPATH='<your-vs-directory>'
7. Open the port at the firewall (if needed)
firewalld
firewall-cmd --permanent --zone=public --add-port=42420/tcp firewall-cmd --reload
iptables
iptables -A INPUT -p tcp -m tcp --dport 42420 -j ACCEPT
8. Server start and first steps
./server.sh start Wait for the startup to finish, then you can give yourself OP with ./server.sh command "/op <youusername>"
9. Connect to your IP/Domain and have fun
Requirements for Alpine (Advanced, no support)
1. Install mono
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
/etc/apk/repositories
after, run
apk update apk add mono mono-dev
2. Install tmux
apk add tmux
3. Certificates
apk add ca-certificates
then run
cert-sync /etc/ssl/certs/ca-certificates.crt
to update the certs.
4. Simplified Start Script
Download and extract the server into a location as normal, then put this into a script:
#!/bin/ash mono VintagestoryServer.exe --dataPath ./data
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.
Run the script in a tmux session.
The rest of the normal advice applies too (firewalling etc.).
Basic Configuration
Once your server is up and running you might want to look over some of the following configuration options. You can configure the server while its running through commands or by editing the serverconfig.json, for which the server needs to be stopped. On windows, by default this file is located at %appdata%/VintageStoryData/serverconfig.json. On Linux it's located at ./data/serverconfig.json of your server directory (e.g. /home/vintagestory/server/data/serverconfig.json if setup like described here)
Here are some of the configurations set by commands, that you'd typically want to set.
/serverconfig name Peaceful PvE Server
Set up the server name, visible in the public server listing/serverconfig description This is a medieval survival server, PvE only, everyone welcome! <3
Set up the servers description, visible in the public server listing/serverconfig motd Hi {playername}! Please remember to follow the rules!
The message shown to players when they join/serverconfig password asdaf
Require a password for players to log in, if desired. Use/serverconfig nopassword
to remove again./serverconfig advertise (1|0)
Whether or not add this server to the public server listing
Lastly, you can configure a server that was created with the 'Open to Lan' method in the same way as you do for dedicated ones, be aware though, in that case a few of the configurations are overridden by the client, such as the save file location.