Far from a Linux expert here, but between the excellent Raspberry Pi 3 guide, the Build the Server wiki entry, and a decent amount of searching I was able to get the server going on a Raspberry Pi 4 running Raspbian Buster. So figured I'd share...
First a few housekeeping items...
su vs sudo - I prefer using sudo on individual commands to limit how much I can possibly screw things up, if you prefer switching to a privileged shell (su) instead feel free to su and ignore the sudo's
PASSWORD_HERE / USERNAME_HERE / etc - These are spots where YOU need to insert your own password / username / etc.
OR options - While searching / reading various guides, some things ended up having multiple options. The first / top option is what I ended up using while other options either did not work for me or I just didn't need to use.
cd /path/to/SOMEWHERE - Make sure you are using the correct path for YOUR installation.
1) I recommend a clean install of Buster followed by updating things:
Code: Select all
sudo apt-get update
sudo apt-get upgrade
sudo apt autoremove (only if prompted)
sudo apt-get dist-upgrade
2) Install the DB... MySQL seems to be unavailable in Buster by default. There might be a backport available, but I went with MariaDB as was suggested when "apt-get install mysql" failed:
Code: Select all
sudo apt-get install mariadb-server-10.0
sudo apt-get install mariadb-server-core-10.0
sudo apt-get install mariadb-client-10.0
sudo apt-get install mariadb-client-core-10.0
sudo apt-get install libmariadbclient-dev
sudo apt-get install libmariadb-dev-compat
sudo apt-get install libmariadb-dev
Important note - I do know that make kept failing on me without something... I suspect it was "libmariadb-dev-compat" as the error had something to do with "mysql.h" but I'm not 100% on that.
3) Recommend running the script to secure the DB installation:
Note - I used default options.
Code: Select all
sudo mysql_secure_installation // INITIALLY I RAN THIS WITHOUT SUDO AND IT FAILED
-----MANUAL RESET-----
Code: Select all
sudo mysql -u root -p
ENTER / Should have an empty password on a clean install
FLUSH PRIVILEGES;
UPDATE mysql.user SET authentication_string = PASSWORD('PASSWORD_HERE') WHERE User = 'root' AND Host = 'localhost';
OR
ALTER USER 'root'@'localhost' IDENTIFIED BY 'PASSWORD_HERE';
exit
sudo systemctl stop mysql
sudo systemctl start mysql
sudo mysql_secure_installation // ONLY IF PASSWORD WAS MANUALLY RESET
4) Setup remote DB access... this is only necessary if you want to access your DB from another device:
Code: Select all
sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
Add # in front of bind-address = 127.0.0.1
ctrl+o
ctrl+x
sudo systemctl stop mysql
sudo systemctl start mysql
Code: Select all
sudo apt-get install git
sudo apt-get install autoconf
sudo apt-get install pkg-config
sudo apt-get install libzmq3-dev
sudo apt-get install luajit-5.1-dev
sudo apt-get install libluajit-5.1-dev
sudo apt-get install build-essential
sudo apt-get install screen
sudo apt-get install g++-7
I'm not sure if this command is necessary... but I ran it anyway, didn't seem to hurt anything:
Code: Select all
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 90
Code: Select all
sudo apt-get update
sudo apt-get upgrade
sudo apt autoremove (only if prompted)
sudo apt-get dist-upgrade
7) Getting / building the server:
Code: Select all
sudo git clone http://github.com/DarkstarProject/darkstar.git/
cd /path/to/darkstar
sudo git checkout stable
sudo sh autogen.sh
sudo ./configure --enable-debug=gdb
sudo make
OR
sudo ./configure LIBS='-lm' // NOT SURE WHAT THE DIFFERENCE IS HERE
sudo make -j2 // THIS APPEARS TO LIMIT THINGS TO TWO "MAKES" AT TIME?
Note - In some of the commands below, either use @'%' if you want your DB accessible from other devices OR use @'localhost' to restrict access to the localhost / device.
Code: Select all
sudo mysql -u root -p
CREATE USER 'USERNAME_HERE'@'%' IDENTIFIED BY 'PASSWORD_HERE';
OR
CREATE USER 'USERNAME_HERE'@'localhost' IDENTIFIED BY 'PASSWORD_HERE';
CREATE DATABASE dspdb;
USE dspdb;
GRANT ALL PRIVILEGES ON dspdb.* TO 'USERNAME_HERE'@'%';
OR
GRANT ALL PRIVILEGES ON dspdb.* TO 'USERNAME_HERE'@'localhost';
exit
Code: Select all
cd /path/to/darkstar/sql
for f in *.sql
do
echo -n "Importing $f into the database..."
mysql dspdb -u USERNAME_HERE -pPASSWORD_HERE < $f && echo "Success" // BELIEVE I GOT A WARNING HERE
done
mysql -u USERNAME_HERE -p
USE dspdb;
UPDATE zone_settings SET zoneip = 'IP_HERE';
exit
Short version - Use 127.0.0.1 if your server / client are on the same device OR use your server's public / private IP if the client connects from another device.
10) Edit config files for DB access:
Code: Select all
cd /path/to/darkstar/conf
sudo nano login_darkstar.conf
mysql_login = USERNAME_HERE
mysql_password = PASSWORD_HERE
ctrl+o
ctrl+x
sudo nano map_darkstar.conf
mysql_login = USERNAME_HERE
mysql_password = PASSWORD_HERE
ctrl+o
ctrl+x
sudo nano search_server.conf
mysql_login = USERNAME_HERE
mysql_password = PASSWORD_HERE
ctrl+o
ctrl+x
Note - This is REQUIRED if you DO NOT want to run dsconnect / dsgame as root or a privileged user!
Code: Select all
sudo chown -R USERNAME_HERE:USERNAME_GROUP_HERE /path/to/darkstar
12) Creating services:
Code: Select all
cd /lib/systemd/system/
Code: Select all
sudo nano dsconnect.service
Code: Select all
[Unit]
Description=Connect Service
After=multi-user.target
[Service]
User=USERNAME_HERE
Group=USERNAME_GROUP_HERE
Type=simple
WorkingDirectory=/path/to/darkstar
ExecStart=/path/to/darkstar/dsconnect
Restart=always
[Install]
WantedBy=multi-user.target
Code: Select all
ctrl+o
ctrl+x
sudo chmod 644 dsconnect.service
sudo systemctl daemon-reload
sudo systemctl enable dsconnect.service
sudo systemctl start dsconnect.service
Code: Select all
sudo nano dsgame.service
Code: Select all
[Unit]
Description=Game Service
After=multi-user.target
[Service]
User=USERNAME_HERE
Group=USERNAME_GROUP_HERE
Type=simple
WorkingDirectory=/path/to/darkstar
ExecStart=/path/to/darkstar/dsgame
Restart=always
[Install]
WantedBy=multi-user.target
Code: Select all
ctrl+o
ctrl+x
sudo chmod 644 dsgame.service
sudo systemctl daemon-reload
sudo systemctl enable dsgame.service
sudo systemctl start dsgame.service
Code: Select all
sudo nano dssearch.service
Code: Select all
[Unit]
Description=Search Service
After=multi-user.target
[Service]
User=USERNAME_HERE
Group=USERNAME_GROUP_HERE
Type=simple
WorkingDirectory=/path/to/darkstar
ExecStart=/path/to/darkstar/dssearch
Restart=always
[Install]
WantedBy=multi-user.target
Code: Select all
ctrl+o
ctrl+x
sudo chmod 644 dssearch.service
sudo systemctl daemon-reload
sudo systemctl enable dssearch.service
sudo systemctl start dssearch.service
13) Last I recommend changing the "VER_LOCK" setting to "2" that way (and hopefully I'm interpreting this correctly) the currently supported client version PLUS any newer client versions can connect to the server:
Code: Select all
sudo nano version.info
VER_LOCK: 2
ctrl+o
ctrl+x
Commands
Code: Select all
sudo systemctl status SERVICE_NAME.service // CHECK SERVICE STATUS
sudo systemctl start SERVICE_NAME.service // START SERVICE
sudo systemctl stop SERVICE_NAME.service // STOP SERVICE
sudo journalctl -f -u SERVICE_NAME.service // VIEW SERVICE LOG - USE ctrl+c TO EXIT
ps -ef | grep ds // CHECK THAT ALL THREE SERVICES ARE RUNNING
Code: Select all
alias NAME_HERE='sudo systemctl status dsconnect.service'
alias NAME_HERE='sudo systemctl status dsgame.service'
alias NAME_HERE='sudo systemctl status dssearch.service'
alias NAME_HERE='ps -ef | grep ds'