Setup LiF:YO Server on CentOS Linux

You are here:
← All Topics

The Life is Feudal: Dedicated Server application is available for Windows only. Fortunately, you can still run the server on a Linux machine through Wine. This guide shows how to setup a headless LiF:YO Dedicated Server on CentOS Linux. It was tested on these versions:

  • CentOS 7
  • Red Hat Enterprise Linux 7

You will need a server or virtual machine running CentOS, a privileged user (root access) and some basic knowledge how to navigate in a Linux environment using a classic command-line interface like Bash.

Before We Begin

I’ll assume that all the configuration is done as the root user. If you’re using a personal account with sudo prvilege, you have to add a sudo before each command.

Before we start installing stuff on the server, let’s make sure all the OS packages are up to date.

yum update

If some kernel packages were updated in the process, you’ll want to reboot the server afterwards.

Database Setup

Install MariaDB

First, we’ll install and configure the MariaDB database on the server.

yum install mariadb-server
MariaDB Package Installation

Next we’ll start the service and add it to the system’s autostart.

systemctl start mariadb
systemctl enable mariadb

The database service is now installed and will launch automatically on every server bootup.

Run Configuration Script

Next, run the mysql_secure_installation script.

mysql_secure_installation

The script guides you through the initial setup of the database. You’ll be promted to set a password for the root user and set some options. Each of them should be confirmed with [Y]. Make sure to write down the root password cause we’ll need it in the next steps.

Configure MariaDB for LiF:YO

Now we’ll set some database options that are required by the LiF server. Create a new file called yoserver.cnf in /etc/my.cnf.d/ and insert this content:

[mysqld]
default_storage_engine=innodb
character-set-server=utf8
innodb_file_per_table=ON
innodb_file_format=Barracuda
innodb_flush_log_at_trx_commit=1
max_sp_recursion_depth=255
max_allowed_packet=10M
query_cache_size=0
query_cache_type=OFF

Then restart the mariadb service:

systemctl restart mariadb

Create Database User

For security reasons, we’ll create a dedicated database user for the YO server. Login to the database through CLI. You’ll need the root password for the database that was set in the previous steps.

mysql -u root -p

Now that we can query the database, let’s create a user with the same name as the future gameserver database (lif_1) with a safe and complex password. Then grant it all access to the database.

CREATE USER 'lif_1'@'%';
GRANT ALL PRIVILEGES ON lif_1.* To 'lif_1'@'%' IDENTIFIED BY 's@fe!Passw0rd';
exit

Note: Make sure to change the s@fe!Passw0rd to something else.

MariaDB User Creation

Now we should be able to connect to the database with the new user. To test the connection, use the mysql command with the lif_1 user:

mysql -u lif_1 -p

If this works, database setup is complete and secured. Do NOT create the YO database yourself yet. The gameserver takes care of that itself.

Gameserver Setup

Install Required Packages

To install and run the YO server, we’ll need to install some software. Some of it comes from the EPEL (Extra Packages for Enterprise Linux) repository, which should be installed first:

yum install epel-release

Now we’ll install wine, xvfb, winbind and some i686 libraries that are needed to run SteamCMD later on.

yum install wine xorg-x11-server-Xvfb samba-winbind-clients glibc.i686 libstdc++.i686
Lots of packages being installed

Create a User

You never want to run wine applications as the root user or on privileged (sudo-enabled) accounts. So we will create a new, unprivileged Linux user for the gameserver and switch to it.

adduser lif_1
su - lif_1
User Creation

Note that all the next steps are done from the lif_1 user account.

SteamCMD Setup

Unlike other Linux distributions, CentOS has no package for SteamCMD. We’ll just download it with curl.

curl -sqL "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" | tar zxvf -

Gameserver Installation

As the new gameserver user (lif_1 in this case), run this SteamCMD command:

./steamcmd.sh +@sSteamCmdForcePlatformType windows +login anonymous +force_install_dir ~/yoserver +app_update 320850 validate +exit

This command forces the SteamCMD tool to download Windows files despite running on Linux. It connects to the Steam Cloud anonymously and downloads the AppID 320850 (YO dedicated server). It then installs the LiF:YO dedicated server to the ~/yoserver/ path of the home directory. We don’t want to use the default path since it would create the gameserver folder with spaces in its name, which makes things complicated on Linux.

SteamCMD YO Installation

Whenever you want to update the server after an official patch release, just run this command again.

We can now cd into the gameserver folder to view the files and make our changes to the server configs:

cd ~/yoserver
ll
YO Server Files

World Setup

Now this part is no different from Windows.

  • Copy the docs/config_local.cs in the main directory and fill in your database access information.
  • Customize config/world_1.xml with the world settings you like.
config_local.cs

Launch Gameserver

Now let’s test if the server is working. We’ll start it in nohup and fake a window manager using xvfb-run.

nohup xvfb-run wine ddctd_cm_yo_server.exe -worldid 1 &

You can watch progress in the logfile. It’s located in the logs directory, in a subfolder with the current date. Let’s tail the newest logfile to see live progress:

tail -f `find logs -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "`
Logfile: Server Booting Up

As long as things are moving in the logfile and the gameserver or database process consumes some CPU, it’s all good. Note that the first startup of a freshly installed server may take a couple of minutes.

If your server fails to boot up and no “logs” directory is created, try to reboot it and run the command again.

Once it’s up and running, you can connect to it using IP and the port specified in the world XML (default: 28000) or find it in the serverlist.

Advanced Configuration

Create a Service Unit

Starting the server through nohup manually is nice for testing, but in a stable (let’s call it semi-professional) environment we want to manage the gameserver as a regular system service with simple start and stop commands.

So let’s create a system-wide service for systemd. You will have to switch back to the root user for this.

Create this new file: /etc/systemd/system/lif_1.service with the following content:

[Unit]
Description=Life Is Feudal Dedicated Server (World 1)
After=mariadb.service

[Service]
Type=simple
User=lif_1
Group=lif_1
ExecStart=/usr/bin/xvfb-run /usr/bin/wine /home/lif_1/yoserver/ddctd_cm_yo_server.exe "-worldid 1"

[Install]
WantedBy=default.target

Then reload the systemd configuration:

systemctl daemon-reload

Now we can manage and monitor the gameserver with systemctl commands:

systemctl start lif_1
systemctl status lif_1
systemctl restart lif_1
systemctl stop lif_1
Systemd Service

We can also enable this service for autostart. It’ll then be launched whenever the server boots up:

sudo systemctl enable lif_1

Telnet Console Access

This is purely optional. If you really need direct access to the gameserver console, you can do this though telnet. The LiF:YO server has a function to open a telnet socket which you can connect to, either locally or from your home machine.

In this example we’ll setup a local telnet socket. Install the telnet package for CentOS first:

yum install telnet

Open the main.cs file in the yoserver directory and append these two lines to the end of it:

$telnet::bindAddress = "127.0.0.1";
telnetSetParameters(28005, "consolePass", "readOnlyPass", "writeOnlyPass", false);

I’m using 28005 as the telnet port in this example, because I’ve used 28000 for the gameserver. You can basically use any free/unused from port between 1024 and 65536, but it’s a good idea to keep it close to the gameserver port. Especially if you’re planning to host multiple server instances. Replace the “consolePass” with a password of your choice and save the file. Then restart the server:

systemctl restart lif_1

After the server is booted up again, you should be able to connect to the telnet socket using the telnet command:

telnet localhost 28005
Server Console (Telnet)