Getting Started with Server: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
No edit summary
Line 43: Line 43:
</syntaxhighlight>
</syntaxhighlight>


==Setting up==
==Installing screen==
===Installing screen===
For running the server in background, we recommend using screen mainly for its ease of use
For running the server in background, we recommend using screen mainly for its ease of use


====Debian based (Ubuntu & derivatives)====
===Debian based (Ubuntu & derivatives)===
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
sudo apt-get install screen
sudo apt-get install screen
</syntaxhighlight>
</syntaxhighlight>


====CentOS 6.x/7.x====
===CentOS 6.x/7.x===
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
yum install screen
yum install screen
</syntaxhighlight>
</syntaxhighlight>


===Starting the server===
==Starting the server==
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
screen -dmS GTASERVER -L bash -c 'cd ~/srv && ./server' &
screen -dmS GTASERVER -L bash -c 'cd ~/srv && ./server' &
Line 69: Line 68:
</syntaxhighlight>
</syntaxhighlight>


===Stopping the server===
==Stopping the server==
To stop the server, there's usually two ways to do that, one that we call a '''graceful''' shutdown that sends the server a signal for termination and the other, well, a '''crash''' since it does not allow the code to run through the termination process correctly.
To stop the server, there's usually two ways to do that, one that we call a '''graceful''' shutdown that sends the server a signal for termination and the other, well, a '''crash''' since it does not allow the code to run through the termination process correctly.



Revision as of 19:58, 23 February 2018

Introduction

This brief tutorial will show you how to run your server on both Windows and Linux distributions.

By default, the server makes use of port 22005 UDP for server access and the port after (here 22006) for the HTTP server hosting the client packages for the clients to download from.
So make sure to have done the ports forwarding on your router process and have also unblocked the ports on your firewall before running the server.

Requirements

For a hassle-less installation and operation, the latest VC Redist is recommended to have.

Microsoft Visual C++ Redistributable 2017

Bridge

The following tutorial is found on Setting up the Bridge on Linux/Windows

Windows

1. Download the latest updater.exe

2. Run the downloaded updater.exe

3. Launch server.exe and you should be able to connect to it.

Linux

This bash snippet should automate the server installation.

# Downloading server
cd /tmp
wget https://cdn.rage.mp/lin/ragemp-srv.tar.gz

# Extract the server files
tar -xzf ragemp-srv.tar.gz
mv ragemp-srv ~/ragemp-srv

# Run the server
cd ~/ragemp-srv
chmod +x server
./server

# Firewall commands (iptables only) (dont forget to save the rule after adding it)
iptables -A INPUT -p udp --dport 22005 -j ACCEPT
iptables -A INPUT -p tcp --dport 22006 -j ACCEPT

Installing screen

For running the server in background, we recommend using screen mainly for its ease of use

Debian based (Ubuntu & derivatives)

sudo apt-get install screen

CentOS 6.x/7.x

yum install screen

Starting the server

screen -dmS GTASERVER -L bash -c 'cd ~/srv && ./server' &

# Parameter explanation
# screen -dmS = starts a separate shell without directly opening an interface towards it (detached mode). The S param defines a session name for the newly created session, so that it is easier to manage in the future.
# screen -L = basically logs whatever error that is shown by the server through the separate shell into a file for easier reference in the future.
# !IMPORTANT!
# Log output will be saved as screenlog._number_ in the server directory.
# &: IS IMPORTANT IF YOU WANT TO TERMINATE THE PROCESS GRACEFULLY

Stopping the server

To stop the server, there's usually two ways to do that, one that we call a graceful shutdown that sends the server a signal for termination and the other, well, a crash since it does not allow the code to run through the termination process correctly.

RECOMMENDED:

kill $(ps h --ppid $(screen -ls | grep GTASERVER | cut -d. -f1) -o pid)

NOT RECOMMENDED: It does not shut down the server gracefully

screen -S GTASERVER -X quit

Troubleshooting

Linux

  • Launching the server throws a the following message:
./server: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.22' not found (required by ./server)

Solution (Debian based (Ubuntu & derivatives)):

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-6 g++-6