Server/Getting started/Linux Server
From JC2-MP Documentation
This page will explain the very basics of setting up a JC2-MP server on GNU/Linux. This tutorial assumes you already have some basic GNU/Linux knowledge.
- 1 Preparation
- 2 Running SteamCMD and downloading server files
- 3 Changing server options
- 4 Starting up the server
- 5 Updating the server
- 6 Troubleshooting
First we need to download SteamCMD. SteamCMD is a command-line version of Steam client. Their libraries are currently 32-bit only, so to run it on 64-bit system you need to install additional libraries as specified below.
Installing additional dependencies for SteamCMD
This should work on any other Debian-based distribution like Linux Mint etc. Currently tested on Ubuntu Server 14.04 LTS.
apt-get update apt-get install lib32gcc1 libc6-i386 lib32stdc++6
yum install glibc.i686 libstdc++.i686
Creating a new user (optional)
You may want to create a separate user on your system specially for JC2-MP server related stuff. This is optional step and you may skip it if you don't see any advantages of this in your case.
Create a new system user and set password for it
useradd -m -s $(which bash) jcmp passwd jcmp
Now you can login as jcmp or switch to it like this
su jcmp cd ~
Login to your server and create steamcmd directory.
mkdir ~/steamcmd cd ~/steamcmd
Now download SteamCMD and extract it.
wget http://media.steampowered.com/installer/steamcmd_linux.tar.gz tar -xvzf steamcmd_linux.tar.gz rm steamcmd_linux.tar.gz
In case you want to make your server public see this guide on how to set up your router.
Running SteamCMD and downloading server files
You can just type this command to install/update your JC2-MP server:
./steamcmd.sh +login anonymous +force_install_dir ./jc2mp-server +app_update 261140 +quit
Alternatively, you can install the public beta testing release. Although keep in mind that only players who opt-in to the public beta will be able to join your server
./steamcmd.sh +login anonymous +force_install_dir ./jc2mp-server +app_update 261140 -beta publicbeta +quit
Changing server options
First, let's move to the JC2-MP server directory.
By default, your server will not come with a config.lua - instead, it comes with a default config. To use it, simply copy it into place
cp default_config.lua config.lua
Now, use your favorite editor to edit your server configuration file. For most people, nano will be sufficient
Every possible server option is explained in the configuration file. Simply follow the instructions.
Starting up the server
To avoid a possible error, it's better to create a symlink to the libstdc++.so.6 library file
ln -s ~/steamcmd/linux32/libstdc++.so.6 libstdc++.so.6
Now that you have successfully downloaded the server and configured it, you can now start it up.
It should now say that server has successfully started.
You may see some warnings in the output like "[S_API FAIL] SteamAPI_Init() failed; SteamAPI_IsSteamRunning() failed." - ignore that, this is perfectly normal. As long as your server says "Server started up successfully", your server is fine.
You are now ready to play on your own server and you can start adding scripts and gamemodes. If you experience any issues launching your JC2-MP server, see #Troubleshooting section before asking someone for help.
Using GNU Screen
If you do not have GNU Screen installed type (Debian-based):
apt-get install screen
or for RedHat-based systems:
yum install screen
And follow the instructions.
Now start the Screen and the server.
screen -dmS jcmp ./Jcmp-Server
This will run a silent screen in the background.
To access the Screen / JC2-MP server type the following:
screen -x jcmp
You can press CTRL+A then CTRL+D to exit the screen safely without stopping the server.
To stop the server and kill the screen type:
screen -S jcmp -X quit
If you get "There is no screen to be attached matching jcmp." message, it means that your JC2-MP server failed to start for some reason. Run it without GNU Screen as specified above to investigate, it should say in the output what's gone wrong.
Updating the server
To update the server to the latest version you will need to repeat the procedure #Running SteamCMD and downloading server files again.
See also SteamCMD#Known_issues for SteamCMD-related issues.
/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15` not found (required by ./libsteam_api.so)
To solve this, you should create a symlink to the
libstdc++.so.6 in your JC2-MP server directory like this:
ln -s ~/steamcmd/linux32/libstdc++.so.6 ~/steamcmd/jc2mp-server/libstdc++.so.6
[S_API FAIL] SteamAPI_Init() failed; SteamAPI_IsSteamRunning() failed.
This is a valid warning. As long as you see "Server started up successfully" message, just ignore it.
Default script is not working
This is caused most likely because the scripts that you downloaded with the server are outdated, so you will need to download and install the updated ones from GitHub.
Server is not accessible to anyone but me
Make sure you have properly set up a port forward in your router if you're connected to one. Also make sure that your system firewall, in case it's enabled, doesn't block connections as well.