- Most cloud service providers offer both a FREE TRIAL and a FREE TIER. THESE ARE NOT THE SAME.
- The FREE TRIAL gives you credits that can be used to create services that normally aren't free. When you use up the credits, you will get charged for any services you have running that aren't free.
- The FREE TIER has services that are 100% free. They do not use a credit system; they remain free as long as the free tier is still being offered by the cloud service provider. Choose this option if you don't want to spend any money.
- This guide will run you through the steps of setting up a DLU Server on a VPS from a cloud service provider such as Oracle Cloud or AWS.
- Setting up DLU is a challenging task for anyone who does not consider themselves "techy". If you want to forgo setting up a server and would like to join one instead, send me a message on Discord, Saymoan#6969, for information on joining a friends-only private server.
- Knowing basic directory navigation commands helps tremendously with following all DLU guides. The main command you should know how to use is
cd
. - Some service providers offer a "free tier" VPS. This VPS should be capable of handling a small private server, but most certainly should not be used for larger servers.
- If you sign up for a "free tier" VPS and are later charged for it, I am not responsible for any charges you receive. Ensure you choose the free VPS option.
- Frequently Asked Questions (FAQ)
- Prerequisites
- VPS Creation (Oracle Cloud)
- VPS Creation (AWS)
- SSH Client Setup
- SFTP Client Setup
- Ubuntu Setup
- Get DLU Server Files
- Server Setup
- Firewall Setup
- Client Setup
- Admin Account Creation
- Installing AccountManager
- Managing DLU & AccountManager
- Contributions
- The Lego Group is not allowing the mass distribution to their client. You will have to do some searching around to get one.
- For the easiest installation process, you need an unpacked client, version 1.10.64
- You could also get a packed client and unpack it using lcdr's utils.
- You can verify your client is the correct one using the known good SHA256 checksums found here.
- I asked Mick from the DLU Team what kind of resources a server should have and this was his response:
- Our test server always ran on the free Google Cloud tier and could comfortably handle 4-5 people.
- The "free tier" VPS from Oracle Cloud, AWS, and Google Cloud all have the same specs of
1 vCPU
and1GB of RAM
.
- The process for each is the same for each, with the exception being creating the VPS. I personally found Oracle Cloud the easiest to navigate around, but your mileage may vary.
- You haven't followed the steps for setting up the firewall on your VPS. You must follow the instructions in both the
VPS Creation
andFirewall Setup
parts of the guide.
- An unpacked client or a packed client that you can unpack.
An SSH Client (https://www.putty.org/)
- Any will do, I will be using PuTTY.
An SFTP Client (https://filezilla-project.org/)
- Any will do, I will be using FileZilla.
- Make sure you download the FileZilla client, not the server.
These instructions are for an Oracle Cloud VPS. If you are using something else, skip these steps.
- Go to https://www.oracle.com/ca-en/cloud/ and create a free account. You will be prompted to enter payment information, but you will not be charged unless you upgrade your account.
- Go to Compute > Instances > Create instance or press Create a VM instance if the option is available.
- Change the image to Canonical Ubuntu.
- Change the shape to VM.Standard.E2.1.Micro.
- Scroll down to Add SSH keys and download the private key.
DO NOT LOSE THESE KEYS. YOU WILL NOT BE ABLE TO ACCESS THE INSTANCE WITHOUT THEM
- After you download your keys, press
create
and your VPS will start to boot up.
- After your VPS is created, you will be taken to your VPS dashboard.
- On the right-hand side, there is a Public IP address. Copy this to your clipboard, as we will need it.
- On your VPS Dashboard, click on the
Virtual cloud network
under Instance details on the left-hand side. - Click on
Security Lists
on the left-hand side. - Click on
Default Security List
for your VCN (name may differ). - Click
Add Ingress Rules
and use these settings:
Source Type: CIDR
Source CIDR: 0.0.0.0/0
IP Protocol: UDP
Destination Port Range: 1001,2000-2200,3000-3200
- Once you are done, add another rule with these settings.
Source Type: CIDR
Source CIDR: 0.0.0.0/0
IP Protocol: TCP
Destination Port Range: 5000
These instructions are for an AWS VPS. If you are using something else, skip these steps.
- Go to https://aws.amazon.com/free/ and create a 12-month free account. You will be prompted to enter payment information, but you will not be charged unless you use a service that is not free. It may take several hours for your account to be created.
- Once your account is made, go to the AWS Management Console and click on Launch a virtaul machine.
- Choose Ubuntu Server 20.04 LTS as your machine image and choose 64-bit (x86) as your architecture.
- Click on
select
. - Choose t2.micro as your instance type (It should said "Free tier eligible" under it).
- Click on "Next: Configure Instance Details" in the bottom right-hand corner to continue.
- Find Auto-assign Public IP and ensure it is enabled.
- Click on
Next: Add Storage
in the bottom right-hand corner to continue. - Set your volume size to 30GB.
- Click on
Next: Add Tags
in the bottom right-hand corner to continue. - Click on
Next: Configure Security Group
in the bottom right-hand corner to continue.
Don't touch the SSH rule, as it is needed to SSH into the VPS.
- Add 4 new rules using the
Add Rule
button. - Use these settings for your rules:
# First rule
Type: Custom UDP Rule
Protocol: UDP
Port Range: 1001
Source: Custom - 0.0.0.0/0
# Second rule
Type: Custom UDP Rule
Protocol: UDP
Port Range: 2000-2200
Source: Custom - 0.0.0.0/0
# Third rule
Type: Custom UDP Rule
Protocol: UDP
Port Range: 3000-3200
Source: Custom - 0.0.0.0/0
# Fourth rule
Type: Custom TCP Rule
Protocol: TCP
Port Range: 5000
Source: Custom - 0.0.0.0/0
- Click on
Review and Launch
in the bottom right-hand corner to continue. - Click on
Launch
to start your VPS.
- Scroll down to Add SSH keys and download the private key.
DO NOT LOSE THESE KEYS OR YOU WILL NOT BE ABLE TO ACCESS YOUR VPS AND WILL HAVE TO RESTART
- After your VPS is created, you will be taken to your VPS dashboard.
- On there is a Public IP address. Copy this to your clipboard, as we will need it.
- Open the
PuTTY
application and paste the Public IP address you got into the Host Name section. - Navigate to Connection > Data and enter
ubuntu
into the Auto-login username field. - Open the
PuTTYgen
application and go to Conversions > Import key. - Find the private key you downloaded earlier and select it.
- Under Actions, click
Save private key
and say yes to the warning. - Save the key somewhere on your computer.
- Go back to PuTTY and navigate to Connection > SSH > Auth.
- At the bottom, select your private key.
- Go back to Session and type in a name for this configuration. Press
save
, and now you can easily load this configuration in the future.
- Press
Open
and when prompted to, accept the certificate. - You are now connected to your VPS!
- Open the 'FileZilla' application. In the top left-hand corner, goto File > Site Manager.
- In the new window that opened, click on
New site
. - On the right-hand side, set Protocol: to
SFTP - SSH File Transfer Protocol
via the drop-down menu. - Paste your public IP address into the Host: field.
- Set Logon Type: to
Key file
. - Set User: to
ubuntu
. - Click
Browse...
and select your private key. - Click
Rename
in the bottom left-hand corner and give this site a name such asDLU Server
. - Click
Connect
and you should now be connected to your VPS.
- Update your package information using:
sudo apt update && sudo apt upgrade -y
- Install DLU software dependencies using:
sudo apt-get install -y git gcc cmake zlib1g-dev build-essential mariadb-server sqlite python3 python3-pip net-tools unzip dos2unix tmux
- Clone the DarkflameServer Repository to your
ubuntu
directory using:
If you have just logged in, you should already be in your ubuntu
directory. You can verify by using pwd
. The output should be /home/ubuntu
.
git clone --recursive https://github.com/DarkflameUniverse/DarkflameServer
- Go to the
DarkflameServer
directory and create a folder calledbuild
.
# Navigate to the DarkflameServer directory
cd DarkflameServer
- Make a directory called
build
and navigate to it.
# Make the build directory
mkdir -p build
# Navigate to the build directory
cd build
- Compile the DLU server files.
# Run CMake to generate needed files
cmake ..
# Run make to build the server files
make
This will take a very long time if you are using a frree VPS, as it only one core. If your VPS has more than one core, you can append -j
to the end of make
to utilize more cores. Ex. -j4
- While still in the
build
directory, start the MySQL service.
sudo service mysql start
- Run the MySQL Secure Installation script.
sudo mysql_secure_installation
- You will be asked several questions to setup MySQL. Answer them like this.
# Enter current password for root (enter for none):
<enter>
# Set root password? [Y/n]
y
# New password:
<password>
# Re-enter new password:
<password>
# Remove anonymous users? [Y/n]
y
# Disallow root login remotely? [Y/n]
n
# Remove test database and access to it? [Y/n]
y
# Reload privilege tables now? [Y/n]
y
- Login to MySQL as the root user.
sudo mysql -u root
- Create a database for the server to use. You can change the database name if you'd like.
# Create a database
# USAGE: CREATE DATABASE <database name>;
CREATE DATABASE DLU;
# Set it as your active database
# USAGE: USE <database name>;
USE DLU;
# Setup the database based on DarkflameServer files
SOURCE ../migrations/dlu/0_initial.sql;
- Create a user for the server to use. You can change the user credentials if you'd like.
# Create a user for the server to use
# USAGE: CREATE USER '<username>'@'localhost' IDENTIFIED BY '<password>';
CREATE USER 'dluserver'@'localhost' IDENTIFIED BY 'darkflame';
# Give the user permission for the database
# USAGE: GRANT ALL PRIVILEGES ON <database>.* TO '<username>'@'localhost';
GRANT ALL PRIVILEGES ON DLU.* TO 'dluserver'@'localhost';
# Flush out the privileges
FLUSH PRIVILEGES;
# Exit MySQL
exit
- In the
build
directory, make a new directory calledres
and navigate to it.
# Make the res directory
mkdir -p res
# Navigate to the res directory
cd res
- Open your SFTP Client and connect to your VPS.
- Navigate to
home/ubuntu/DarkflameServer/build/res
on your VPS (right pane). - Navigate to the
res
directory in your unpacked client on your PC (left pane). - Copy
macros
,BrickModels
,chatplus_en_us.txt
,names
, andmaps
from your unpacked client'sres
directory over to the newly createdres
directory on your VPS.
This can take a few minutes because of all the individual files. To speed it along, you can zip the required files on your PC, move the zip to your VPS, and unzip it using unzip res.zip
in the directory your zip file is in.
- Unzip the
navmeshes.zip
file into yourbuild/res/maps
directory
unzip ../../resources/navmeshes.zip -d maps
- Navigate to the
build
directory and make a directory calledlocale
.
# Make the locale directory
mkdir -p locale
- On your SFTP Client, navigate to the
locale
directory in your unpacked client. - Copy the
locale.xml
file to thelocale
directory on your VPS.
- On your SFTP Client, navigate to the
res
directory in your unpacked client. - Locate the
cdclient.fdb
file and copy it to thebuild
directory on your VPS. - Navigate to the
ubuntu
directory on your VPS and install lcdr's utils.
The ubuntu
directory is located one level above the DarkflameServer
directory.
# Install lcdr's utils and all of its dependencies
pip3 install git+https://github.com/lcdr/utils
# Clone lcdr's utils to your ubuntu directory to make them easy to access
git clone https://github.com/lcdr/utils
- Once lcdr's utils are installed, convert the
cdclient.fdb
file to asqlite
file.
python3 utils/utils/fdb_to_sqlite.py DarkflameServer/build/cdclient.fdb --sqlite_path DarkflameServer/build/res/CDServer.sqlite
- After the file is converted, navigate to the
build
directory and run these commands.
sqlite3 res/CDServer.sqlite < "../migrations/cdserver/0_nt_footrace.sql"
sqlite3 res/CDServer.sqlite < "../migrations/cdserver/1_fix_overbuild_mission.sql"
sqlite3 res/CDServer.sqlite < "../migrations/cdserver/2_script_component.sql"
If nothing happens after you run each command, then you did it right.
- There is a problem with
gmlevel 0 users
and chat. - To fix this, navigate to the
res
directory and rundos2unix chatplus_en_us.txt
. - Chat should now work.
- Navigate to the
build
directory. - Edit the
worldconfig.ini
using thenano <filename>
command to include your database login credentials. - NOTE: You can enable single-player racing by setting
solo_racing=
to1
. This is not required (iEvillan).
# MySQL connection info:
mysql_host=localhost
mysql_database=DLU
mysql_username=dluserver
mysql_password=darkflame
- Edit the
authconfig.ini
andchatconfig.ini
using thenano <filename>
command to include your database login credentials and public IP.
This is the same one as your used in your SSH client.
# MySQL connection info:
mysql_host=localhost
mysql_database=DLU
mysql_username=dluserver
mysql_password=darkflame
# The public facing IP address. Can be 'localhost' for locally hosted servers
external_ip=<public ip>
- Edit the
masterconfig.ini
using using thenano <filename>
command to include your database login credentials, public IP, and enable sudo for theauth
,chat
, andworld
configurations.
# MySQL connection info:
mysql_host=localhost
mysql_database=DLU
mysql_username=dluserver
mysql_password=darkflame
# The public facing IP address. Can be 'localhost' for locally hosted servers
external_ip=<public ip>
# Use sudo when launching the auth server.
# Required by default if on Linux as auth runs on port 1001
use_sudo_auth=1
# Use sudo when launching the chat server
use_sudo_chat=1
# Use sudo when launching world servers
use_sudo_world=1
- These instructions are only needed if your Ubuntu installation came with an already configured firewall (Oracle Cloud).
- If
sudo ufw status
comes back asinactive
, you can ignoreUFW
. - If
sudo iptables -L
comes back looking like the following, you can ignoreIPTables
.
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
- If you are using
UFW
as your firewall, run these commands to open the correct ports.
sudo ufw allow 1000:1001/udp
sudo ufw allow 2000:2200/udp
sudo ufw allow 3000:3200/udp
sudo ufw allow 5000/tcp
- Navigate to the
ubuntu
directory and backup your current firewall settings.
sudo iptables-save > FirewallBackup.rules
- Enable all of the required ports for DarkflameServer and AccountManager.
# Enable ports required by DarkflameServer and AccountManger
sudo iptables -I INPUT 1 -p tcp -m multiport --dports 5000 -j ACCEPT
sudo iptables -I INPUT 1 -p udp -m multiport --dports 1000,1001,2000:2200,3000:3200 -j ACCEPT
- Login as the root user and save the firewall configuration as the default.
# Login as the root user
sudo su
# Save the firewall configuration as the default
iptables-save > /etc/iptables/rules.v4
# Exit the root user
exit
- You can find the official guide here.
- In your unpacked client, find the
boot.cfg
file. - Open it in a text editor, such as Notepad++.
- Find where it says
AUTHSERVERIP=0:localhost,
. - Replace
localhost
with your public IP. - Save and exit the file.
- In your unpacked client, navigate to
res/scripts/ai/minigame/survival
. - Right-click on the
l_zone_survival_client.lua
file and clickproperties
. - Under attributes, make sure
Read-only
is unchecked. - Open
l_zone_survival_client.lua
with a text editor. - Scroll down to line
617
(near the bottom). - Change
PlayerReady(self)
toonPlayerReady(self)
. - Save and exit the file.
Brick-By-Brick Building on properties can soft-lock your character. Users beware.
- In your unpacked client, find the
boot.cfg
file. - Open it in a text editor, such as Notepad++.
- Find where it says
PATCHSERVERIP=0:localhost,
. - Replace
localhost
with404.maxoverlack.dev
- Save and exit the file.
- Navigate to the
build
directory on your VPS. - Run
./MasterServer -a
to make an admin account. - You will be prompted to enter a
username
andpassword
.
- In the
ubuntu
directory, clone the AccountManager repository.
# Clone the AccountManager repository
git clone https://github.com/DarkflameUniverse/AccountManager
- Run
sudo apt-get install -y python3-testresources
to install a dependency. - Enter the
AccountManager
directory that was just cloned from the repository. - Run
pip3 install -r requirements.txt
to install the dependencies.
- In the
AccountManager
directory, create thecredentials.py
file using thenano <filename>
command. - The
SECRET_KEY
can be any string of numbers and characters. - Make sure to enter your database credentials.
# credentials.py
# Make sure this is a long random string
SECRET_KEY = 'long-random-string'
# Replace instances of <> with the database credentials
DB_URL = 'mysql+pymysql://<mysql-user>:<mysql-password>@<mysql-host>/<mysql-database>'
You can copy-paste in PuTTY by copying your text, and using right-click to paste.
- In the
AccountManager
directory, create theresources.py
file usingnano <filename>
command.
# resources.py
# Path to the logo image to display on the application
LOGO = 'logo/logo.png'
# Path to the privacy policy users have to agree to
PRIVACY_POLICY = 'policy/Privacy Policy.pdf'
# Path to the terms of use users have to agree to
TERMS_OF_USE = 'policy/Terms of Use.pdf'
- AccountManager should now be installed.
- Run
tmux ls
to see if thedlu-server
ordlu-accountmanager
sessions are already running. - If they are already running, skip the
tmux new -s <session name>
step. - If you get an error saying
error connecting to /tmp//tmux-1001/default (No such file or directory)
, continue as though the sessions are not already running.
- Run the command
tmux new -s dlu-server
to start a new session. - In the new session, navigate to the
DarkflameServer/build
directory. - Run
sudo ./MasterServer
to start the server. - Press
CTRL + B
and thenD
to detach from the session. - You can reattach to the
dlu-server
session withtmux a -t dlu-server
. This will let you see the server console. - Your server should now be running.
- Reattach to the
dlu-server
session withtmux a -t dlu-server
. - Press
CTRL + C
to stop the server. - Press
CTRL + B
and thenD
to detach from the session.
UPDATING THE SERVER IS DONE AT YOUR OWN RISK
- When the DarkflameServer repository is updated, you'll need to pull the changes and recompile.
- Stop your server using the steps above.
- Stop your MySQL database with
service mysql disable
. - In the
DarkflameServer
directory, pull the changes withgit pull --recurse-submodules
. - If any changes are in the
migrations
folder, you'll have to redo that files SQL command as well. - Refer to Build the Repository for re-building the server.
- Refer to MySQL Database or CDServer.sqlite for any migration file commands.
- Start your MySQL database with
service mysql enable
.
- Run the command
tmux new -s dlu-accountmanager
to start a new session. - In the new session, navigate to the
AccountManager
directory. - Run
python3 app.py
to start AccountManager. - Press
CTRL + B
and thenD
to detach from the session. - You can reattach to the
dlu-accountmanager
session withtmux a -t dlu-accountmanager
. This will let you see the AccountManager console. - AccountManager should now be running.
- You can access the AccountManager from your web browser.
# Login as an Admin and create CD keys
http://yourpubliciphere:5000/login
# Create a new account as a non-admin user
# You will require a CD key from the admin login
http://yourpubliciphere:5000/activate
- Reattach to the
dlu-accountmanager
session withtmux a -t dlu-accountmanager
. - Press
CTRL + C
to stop the server. - Press
CTRL + B
and thenD
to detach from the session.
- Created a video tutorial that help me make this guide.
- Check it out here.
- Created a guide that help me make this guide.
- Check it out here.
- Providing a
Brick-By-Bricking Building
solution that forgoes the need to have an HTTP server running.
- Suggestion to add the fix for the gmlevel 0 user chat issue.
- Suggestion to add that you can turn on single-player races in the
worldconfig.ini
. - Clarification that these instructions work on ALL VPS, not just Oracle Cloud.
Excellent write-up! It was very clear and informative ;)
To clarify for other readers, this works for ALL VPS, not just Oracle.
One thing I would consider adding is a quick fix for the chat problem for gmlevel 0 users, which is to install dos2unix with
sudo apt install dos2unix
and rundos2unix chatplus_en_us.txt
in /build/res before restarting the server.Another note is that it's possible to run AccountManager and MasterServer at the same time if you want to do that, I saw a script on discord for that purpose and there are also hacky ways to do that.