Getting Started with Server: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
No edit summary
Line 23: Line 23:


==Installing the server==
==Installing the server==
===Debian, Ubuntu, and derivatives===


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
Line 30: Line 28:
cd /tmp
cd /tmp
wget https://cdn.rage.mp/lin/server
wget https://cdn.rage.mp/lin/server
mkdir ~/ragemp_server
mkdir ~/srv
mv server ~/ragemp_server
mv server ~/srv
cd ~/ragemp_server
cd ~/srv
chmod +x server
chmod +x server
./server
./server
Line 41: Line 39:
</syntaxhighlight>
</syntaxhighlight>


===CentOS 7, Fedora 19 (and later), and derivatives===
<syntaxhighlight lang="bash">
# Downloading server
cd /tmp
wget https://cdn.rage.mp/lin/server
mkdir ~/ragemp_server
mv server ~/ragemp_server
cd ~/ragemp_server
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
</syntaxhighlight>


==Setting up==
==Setting up==
Line 73: Line 56:
===Starting the server===
===Starting the server===
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
screen -dmS RAGEMPSERVER -L bash -c 'cd ~/ragemp_server && ./server' &
screen -dmS GTASERVER -L bash -c 'cd ~/srv && ./server' &


# Parameter explanation
# Parameter explanation
Line 88: Line 71:
'''RECOMMENDED:'''
'''RECOMMENDED:'''
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
kill $(ps h --ppid $(screen -ls | grep RAGEMPSERVER | cut -d. -f1) -o pid)
kill $(ps h --ppid $(screen -ls | grep GTASERVER | cut -d. -f1) -o pid)
</syntaxhighlight>
</syntaxhighlight>


'''NOT RECOMMENDED:''' It does not shut down the server gracefully
'''NOT RECOMMENDED:''' It does not shut down the server gracefully
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
screen -S RAGEMPSERVER -X quit  
screen -S GTASERVER -X quit  
</syntaxhighlight>
</syntaxhighlight>


== Troubleshooting ==
== Troubleshooting ==

Revision as of 14:28, 12 November 2017

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 so make sure to have done the port forwarding on your router process and have also unblocked the port on your firewall before running the server.

Windows

Troubleshooting

Linux

Installing GCC 6

Debian, Ubuntu, and derivatives

Ubuntu 16.04

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

Installing the server

# Downloading server
cd /tmp
wget https://cdn.rage.mp/lin/server
mkdir ~/srv
mv server ~/srv
cd ~/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


Setting up

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