Go to file
2022-01-22 00:19:28 +01:00
.gitattributes Initial commit 2021-12-08 22:15:46 +01:00
README.md Update README.md 2022-01-22 00:19:28 +01:00

DarkflameServer Installation

VMWare, VirtualBox, Dedicated Servers / Virtual Private Servers
If you run into any issues, dm VibrantRaven#0001 or Mega#3139

Choosing your host

Before we begin, you need to select a host. Personally, we have dedicated servers located in germany, and while some dedicated servers have a price tag that not everyone want to pay for, there is cheaper solutions such as a Virtual Private Servers, or free solutions such as creating your own virtual machine on your desktop using WMWare or VirtualBox. You should know that regardless of what you choose, the DLU Installation will come of as the same.

Note: This guide does NOT cover WSL Installations, nor the setup of DLU AccountManager

Double Note: This guide expects you to already have a Virtual Machine running Ubuntu setup. There are countless guides on how to do this.

VirtualBox

VMWare (Please note that VMWare's Virtual Networking does not come with the free version by default)

After deciding HOW you wanna host it, you need an OS, or a Linux Distro. In this case, we recommend the use of Ubuntu Server 20.04 Please note that before you start installing a VM, you need to ensure that Intel / OR AMD's Virtualization Technology is enabled in your BIOS.

Note, when you do setup your VM, you can leave everything as default, though we do recommend dedicating at least 10-20gb of storage.

Secondly, for others to connect to a virtual machine, you need to setup virtual networking, that is a step we currently don't have ready quite yet, so other guides on that would be sufficient enough.

File upload

If you want to upload files directly to your Virtual Machine you need to setup shared folders which can be seen in this guide. If you want to use SFTP, you need to do virtual networking which can be a hassle and is not documented here yet. A second method is to create a git repo which can be seen how you do below.

In order to set this up, download Github Desktop Application You also need to create an account over at github.com, and login to the desktop app. After that is done and you are logged in to the desktop app, click "create a new repository on your hardrive".

  • Repository name, can be anything you'd like.
  • For local path, select your desktop or where you want this placed.
  • Click create repository. Please note that this won't be published quite yet.

If you made the repository's path location to your desktop, open up the folder and it should contain .git and .gitattributes. In here, you want to place all the required files such as maps folder, locale.xml, macros folder, BrickModels folder, chatplus_en_us.txt, cdclioent.fdb and fdb_to_sqlite.py. Now you are ready to publish your repository, click the huge "publish repository button".

  • Give it a name that you'd like and a description
  • If you don't make the code private, you should change the visibility to private on the repo settings on your github.com page when you've cloned it.

Prerequisites

Before we can begin the actual installation, we need to update our system and install all the required dependencies. Please note that when you have to start uploading files, the easiest method for a VPS / Dedicated Server is to use an application such as Filezilla. Since this is a VM, I recommend that you use the Github Desktop app to create a private repository that we can clone into our vms. This also works on dedis / vpses and can be removed whenever you're done.

sudo su # Requires you to input a password if you aren't already a superuser.
apt update && sudo apt upgrade
apt-get install -y git gcc cmake build-essential zlib1g-dev mariadb-server python3 python3-pip sqlite3 net-tools dos2unix

Directories

Now that we have all the dependencies, we can start the installation.

git clone --recursive https://github.com/DarkflameUniverse/DarkflameServer
mkdir -p DarkflameServer/build
cd DarkflameServer/build
git clone your_repo # Applies only if you decide to upload files the github way

# If they don't already exist in your build directory
mkdir res
mkdir locale

Compiling

Before we can compile our server, we need to make a change in CMakeVariables.txt

cd .. # If you are in the build directory, change directory to the DarkflameServer directory
nano CMakeVariables.txt # Replace NET_VERSION=171023 with NET_VERSION=171022

Now that our changes are done, we can compile the server. Please note that this process does take a bit of time

cd build # Change directory back to the build directory
cmake ..
make

In our res and locale directories, we need to upload certain files.

# If you are in your build directory
cd res # In here, we need to upload maps, macros, BrickModels and chatplus_en_us.txt (This can be obtained from an unpacked client)
  • Download this, extract it to your desktop and upload the extracted folder to your maps folder located in res.
  • We also need to upload the locale.xml to our locale directory (This can be obtained from an unpacked client)

Setting up our database

Before we can set this up, we need to upload 2 files to the BUILD directory..

  • Download fdb_to_sqlite.py and upload it to your build directory.
  • Upload cdclient.fdb to your build directory (Once again, obtained from an unpacked client).
# Ensure that you are in your build directory
mysql -u your_name #You can add -p to it also if needed "mysql -u your_name -p"
CREATE USER 'darkflame'@'localhost' IDENTIFIED BY 'darkflame';
CREATE DATABASE dlu;
GRANT ALL PRIVILEGES ON dlu.* TO 'darkflame'@'localhost';
FLUSH PRIVILEGES;

USE dlu;
source ../migrations/dlu/0_initial.sql # If you get an error, make sure you are in the BUILD directory BEFORE you run this, and the 0_initial.sql file is in the MIGRATIONS directory.
EXIT;

Now that our first database is created, we can start the migrations. First, we need to convert our cdclient.fdb to a sqlite file

python3 ./fdb_to_sqlite.py ./cdclient.fdb # This must be ran in your BUILD directory.
mv cdclient.sqlite CDServer.sqlite # This essentially just renames the file to what it needs to be.

In order to do the migrations, ensure that you are executing these commands in your build directory.

sqlite3 CDServer.sqlite < ../migrations/cdserver/0_nt_footrace.sql
sqlite3 CDServer.sqlite < ../migrations/cdserver/1_fix_overbuild_mission.sql
sqlite3 CDServer.sqlite < ../migrations/cdserver/2_script_component.sql
mv CDServer.sqlite ./res # This moves the CDServer file from our BUILD directory to our RES directory

Port Forwarding

If a client that is not on the same network as the server wants to connect, you will need to open ports 1001, 2000-2200, and 3000-3200. Port Forwarding is different determined by what ISP you have, thus we cannot offer support. Find a guide on port forwarding that was made for your router.

If you run this in a virtual machine, you need to setup virtual networking and port forward the virtual machine as well. This part is not documented in this guide.

UFW Firewalling

UFW Firewalling is not an absoloute must, but if you want that extra security layer we truly recommend that you follow this step. Personally, we use UFW Firewalling for all of our Dedicated Servers / Virtual Private Servers. Like we mentioned, if you DO want that extra layer, this step covers how you can setup UFW Firewalling on your Linux System for a Dedicated Server, Virtual Private Servers, VirtualBox and VMWare

SSH (Virtual Private Server | Dedicated Servers) Please read the SSH version really carefully.

apt install ufw # If by any chance it isn't installed
ufw enable
ufw allow ssh # This part is VERY crucial that you allow immediately before you reboot your system. If you don't allow SSH, you lock yourself out from the VPS / Dedi and have to do a lot more work to get access again.
ufw allow 1001/udp
ufw allow 2000:2200/udp
ufw allow 3000:3200/udp

reboot # Please note that even if you do enable UFW Firewalling, it won't be fully effective until you've done a system reboot. Once back into the system, do sudo su and input your password again

VirtualBox, VMWare

apt install ufw # If by any chance it isn't installed
ufw enable
ufw allow ssh # You should enable ssh since it's much easier to use an SSH connection to the system.
ufw allow 1001/udp
ufw allow 2000:2200/udp
ufw allow 3000:3200/udp

reboot # Please note that even if you do enable UFW Firewalling, it won't be fully effective until you've done a system reboot. Once back into the system, do sudo su and input your password again

Starting the server

Before you can start the server, you need to edit worldconfig.ini, masterconfig.ini, chatconfig.ini and authconfig.ini. In these files, you need to fill in your database credentials. If you would like others to join you, you need to change the external_IP to reflect your public ip address (This can easily be found at https://www.whatsmyip.org) in the master, chat, and authconfig.ini files. After that is done, you can create your first account by executing

This script made by @eddytronpie#2595 may help for users with eth0. https://github.com/PyEddy/DLU_DynamicIP

./MasterServer -a # Ensure that this is executed in your BUILD directory

Note: You do NOT need AccountManager, each account can be made with ./MasterServer -a Fill in your desired username and password,then start the server by executing

sudo ./MasterServer
# Now that your server has successfully been setup. If you want to use the optional chat patch, turn off the server and execute
cd res
# Then execute
dos2unix chatplus_en_us.txt
cd ..
sudo ./MasterServer

Connecting to the server

To connect from your client, you first need to edit the boot.cfg file located in your clients root directory. Open the file and find where it says AUTHSERVERIP=, this should be set to your public ip address. Now find where it says PATCHSERVERIP=, and set it to cache.lbbstudios.net. Now you can boot up the client and connect.