Linux dedicated server
Moderator: OpenTTD Developers
Linux dedicated server
Hello,
I would like to pubish a dedicated server running under linux.
I can run VMs with Ubuntu or Debian without screen (so no desktop environment) with an ARM64 CPU.
I found I can download and install openttd using aptitude.
But :
1/ I read somewhere the packages from official Linux repositories are out of date (version 1.6 or so ?)
2/ When I install it... I can't find how to run a server without launching the game itself with GUI (through SSH it's quite hard...)
So I'm looking for two things :
1/ A script or tutorial explaining how to pull the source directly from a GIT repository and compile it for ARM64
2/ The command line that actually run a dedicated server without GUI... and some explanations on how to configure it
Any idea where I could find those ?
I would like to pubish a dedicated server running under linux.
I can run VMs with Ubuntu or Debian without screen (so no desktop environment) with an ARM64 CPU.
I found I can download and install openttd using aptitude.
But :
1/ I read somewhere the packages from official Linux repositories are out of date (version 1.6 or so ?)
2/ When I install it... I can't find how to run a server without launching the game itself with GUI (through SSH it's quite hard...)
So I'm looking for two things :
1/ A script or tutorial explaining how to pull the source directly from a GIT repository and compile it for ARM64
2/ The command line that actually run a dedicated server without GUI... and some explanations on how to configure it
Any idea where I could find those ?
Re: Linux dedicated server
Owner and admin of servers with names "Experimental games" .
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS
- andythenorth
- Tycoon
- Posts: 5658
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: Linux dedicated server
FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: Linux dedicated server
Generally it's advisable to simply build OpenTTD from source for a server. Especially on linux that's an easy thing to do - you don't need all the GUI stuff. The wiki page andy linked is more verbose, however the short version:
assuming a debian-based linux (which also applies to ubuntu):
Then get source
Checkout desired version and build (repeat this and following steps each time you update your OpenTTD version):
and if you're clever, run from a different directory, so you can update in the background:
start the server:
assuming a debian-based linux (which also applies to ubuntu):
Code: Select all
apt-get install build-essential
apt-get build-dep openttd
Code: Select all
git clone https://github.com/OpenTTD/OpenTTD/ server-source
Code: Select all
cd server-source
git checkout 1.10.0-beta1
./configure --enable-dedicated
make bundle
Code: Select all
cd
mkdir server
cp -r server-source/bundle/* server
Code: Select all
server/openttd -D -f
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: Linux dedicated server
Thank you very much for your answers.
I'll try to get it working
I'll try to get it working
Re: Linux dedicated server
I'm almost done, but I can't run the server.
I'm running with thins Linux version :
I get this error :
I took a look at the --help screen, but I don't see any mention to log file, so I don't know which folder or file I should create.
I also tried to run with sudo with no more success.
I also saw some error/warning messages during the previous steps ?
freebox@openttdsrv:~$ sudo apt-get build-dep openttd
freebox@openttdsrv:~/server-source$ make bundle
I'm running with thins Linux version :
Code: Select all
Linux openttdsrv 4.19.0-6-arm64 #1 SMP Debian 4.19.67-2+deb10u2 (2019-11-11) aarch64
Code: Select all
freebox@openttdsrv:~$ server/openttd -D -f
dbg: [net] Starting dedicated version 1.10.0-beta1
Loading dedicated server...
- Forked to background with pid 30691
Unable to open logfile: No such file or directory
I also tried to run with sudo with no more success.
I also saw some error/warning messages during the previous steps ?
freebox@openttdsrv:~$ sudo apt-get build-dep openttd
Code: Select all
Setting up x11-common (1:7.7+19) ...
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
Code: Select all
[SRC] Compiling cpu.cpp
/home/freebox/server-source/src/cpu.cpp:74:2: warning: #warning "(non-fatal) No support for rdtsc(), you won't be able to profile with TIC/TOC" [-Wcpp]
#warning "(non-fatal) No support for rdtsc(), you won't be able to profile with TIC/TOC"
^~~~~~~
Re: Linux dedicated server
Eureka !
Without -f flag I got this error :
Then I downloaded opengfx 0.5.5
Now, I can run the serveur.
But each time I set the "-f" flag I still get the error regarding log file
Without -f flag I got this error :
Code: Select all
freebox@openttdsrv:~$ server/openttd -D
dbg: [net] Starting dedicated version 1.10.0-beta1
dbg: [net] [core] starting network...
dbg: [net] [udp] initializing listeners
dbg: [net] [core] network online, multiplayer available
dbg: [net] Detected broadcast addresses:
dbg: [net] 0) 192.168.0.255
Error: Failed to find a graphics set. Please acquire a graphics set for OpenTTD. See section 4.1 of README.md.
Code: Select all
freebox@openttdsrv:~$ mkdir .openttd
freebox@openttdsrv:~$ mkdir .openttd/baseset
freebox@openttdsrv:~$ cd .openttd/baseset/
freebox@openttdsrv:~/server$ wget http://master.binaries.openttd.org/binaries/extra/opengfx/0.5.5/opengfx-0.5.5-all.zip
--2019-11-30 11:03:20-- http://master.binaries.openttd.org/binaries/extra/opengfx/0.5.5/opengfx-0.5.5-all.zip
Resolving master.binaries.openttd.org (master.binaries.openttd.org)... 2001:41d0:8:6fa6:1::2, 94.23.161.41
Connecting to master.binaries.openttd.org (master.binaries.openttd.org)|2001:41d0:8:6fa6:1::2|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3548368 (3.4M) [application/zip]
Saving to: ‘opengfx-0.5.5-all.zip’
opengfx-0.5.5-all.zip 100%[=================================================>] 3.38M 511KB/s in 6.8s
2019-11-30 11:03:27 (511 KB/s) - ‘opengfx-0.5.5-all.zip’ saved [3548368/3548368]
freebox@openttdsrv:~/.openttd/baseset$ sudo unzip opengfx-0.5.5-all.zip
Archive: opengfx-0.5.5-all.zip
inflating: opengfx-0.5.5.tar
freebox@openttdsrv:~/.openttd/baseset$ tar -xvf opengfx-0.5.5.tar
opengfx-0.5.5/
opengfx-0.5.5/ogfxt_toyland.grf
opengfx-0.5.5/ogfxe_extra.grf
opengfx-0.5.5/ogfxc_arctic.grf
opengfx-0.5.5/ogfx1_base.grf
opengfx-0.5.5/license.txt
opengfx-0.5.5/opengfx.obg
opengfx-0.5.5/readme.txt
opengfx-0.5.5/ogfxi_logos.grf
opengfx-0.5.5/changelog.txt
opengfx-0.5.5/ogfxh_tropical.grf
freebox@openttdsrv:~/.openttd/baseset$ rm *.zip
freebox@openttdsrv:~/.openttd/baseset$ rm *.tar
rm: remove write-protected regular file 'opengfx-0.5.5.tar'? y
freebox@openttdsrv:~/.openttd/baseset$ cd ..
freebox@openttdsrv:~/.openttd$ cd ..
freebox@openttdsrv:~$ server/openttd -D
dbg: [net] Starting dedicated version 1.10.0-beta1
dbg: [net] [core] starting network...
dbg: [net] [udp] initializing listeners
dbg: [net] [core] network online, multiplayer available
dbg: [net] Detected broadcast addresses:
dbg: [net] 0) 192.168.0.255
[2019-11-30 11:05:40] dbg: [net] [udp] closed listeners
[2019-11-30 11:05:40] dbg: [net] [udp] initializing listeners
[2019-11-30 11:05:40] dbg: [net] [udp] closed listeners
[2019-11-30 11:05:40] dbg: [net] [udp] initializing listeners
[2019-11-30 11:05:40] dbg: [net] starting listeners for clients
[2019-11-30 11:05:40] dbg: [net] [tcp] listening on IPv4 port 0.0.0.0:3979 (IPv4)
[2019-11-30 11:05:40] dbg: [net] [tcp] listening on IPv6 port [::]:3979 (IPv6)
[2019-11-30 11:05:40] dbg: [net] starting listeners for incoming server queries
[2019-11-30 11:05:40] dbg: [net] [udp] listening on IPv4 port 0.0.0.0:3979 (IPv4)
[2019-11-30 11:05:40] dbg: [net] [udp] listening on IPv6 port [::]:3979 (IPv6)
[2019-11-30 11:05:40] dbg: [net] Generating map, please wait...
[2019-11-30 11:05:40] dbg: [net] Map generation percentage complete: 5
[2019-11-30 11:05:40] dbg: [net] Map generation percentage complete: 10
[2019-11-30 11:05:40] dbg: [net] Map generation percentage complete: 15
[2019-11-30 11:05:40] dbg: [net] Map generation percentage complete: 20
[2019-11-30 11:05:40] dbg: [net] Map generation percentage complete: 25
[2019-11-30 11:05:40] dbg: [net] Map generation percentage complete: 30
[2019-11-30 11:05:40] dbg: [net] Map generation percentage complete: 35
[2019-11-30 11:05:40] dbg: [net] Map generation percentage complete: 40
[2019-11-30 11:05:40] dbg: [net] Map generation percentage complete: 45
[2019-11-30 11:05:40] dbg: [net] Map generation percentage complete: 50
[2019-11-30 11:05:40] dbg: [net] Map generation percentage complete: 55
[2019-11-30 11:05:40] dbg: [net] Map generation percentage complete: 60
[2019-11-30 11:05:40] dbg: [net] Map generation percentage complete: 65
[2019-11-30 11:05:40] dbg: [net] Map generation percentage complete: 70
[2019-11-30 11:05:40] dbg: [net] Map generation percentage complete: 75
[2019-11-30 11:05:40] dbg: [net] Map generation percentage complete: 80
[2019-11-30 11:05:40] dbg: [net] Map generation percentage complete: 85
[2019-11-30 11:05:40] dbg: [net] Map generation percentage complete: 90
[2019-11-30 11:05:40] dbg: [net] Map generation percentage complete: 99
[2019-11-30 11:05:40] dbg: [net] Map generated, starting game
But each time I set the "-f" flag I still get the error regarding log file
Re: Linux dedicated server
A bit of digging:
So it tries to open the path in _log_file apparently, which gets set by
So do you have a writable personal directory? (see also the readme file that explains all the various directories that openttd has and where to find them)
It looks like it tries to write "openttd.log" there.
Readme may also explain about logfiles, not sure though.
Code: Select all
src/dedicated.cpp
15:FILE *_log_fd = nullptr; ///< File to reroute output of a forked OpenTTD to
43: _log_fd = fopen(_log_file, "a");
44: if (_log_fd == nullptr) {
45: perror("Unable to open logfile");
Code: Select all
src/fileio.cpp
1236: extern char *_log_file;
1237: _log_file = str_fmt("%sopenttd.log", _personal_dir);
It looks like it tries to write "openttd.log" there.
Readme may also explain about logfiles, not sure though.
Being a retired OpenTTD developer does not mean I know what I am doing.
Re: Linux dedicated server
Hello Alberth,
Do you know how is determined "_personal_dir" ?
When running DEBUG, I see that :
Directory "/root/.local/share/openttd/" is owned by root I guest, and it doesn't to be wise granting openttd to write in it.
It looks like this folder is chosen at compile time... May I did compile it with sudo ?
Is there any way to change it ?
-- Edit :
When running "./configure --enable-dedicated" I get this :
So it looks like to be the .configure script that set up the personal dir.
As you can see I run it without sudo.
And when compiling :
So nothing to be done, I guess I already compiled without sudo as I though...
PS : Here I'm compiling jgrpp but I also have the same problem with the openttd trunk.
Do you know how is determined "_personal_dir" ?
When running DEBUG, I see that :
Code: Select all
freebox@openttdsrv:~$ sudo server/openttd -D -f -d 9
dbg: [misc] /home/freebox/ added as search path
dbg: [misc] /root/.local/share/openttd/ added as search path
dbg: [misc] /root/.openttd/ added as search path
dbg: [misc] /home/freebox/server/ added as search path
dbg: [misc] /usr/local/share/games/openttd/ added as search path
dbg: [misc] /root/.config/openttd/ found as config directory
dbg: [misc] /root/.local/share/openttd/ found as personal directory
dbg: [misc] Scanning for tars
dbg: [misc] Scan complete, found 0 files
dbg: [net] Starting dedicated version jgrpp-0.32.3
Loading dedicated server...
- Forked to background with pid 691
Unable to open logfile: No such file or directory
freebox@openttdsrv:~$
It looks like this folder is chosen at compile time... May I did compile it with sudo ?
Is there any way to change it ?
-- Edit :
When running "./configure --enable-dedicated" I get this :
Code: Select all
using CFLAGS... -O2 -fomit-frame-pointer -Wall -Wno-multichar -Wsign-compare -Wundef -Wwrite-strings -Wpointer-arith -W -Wno-unused-parameter -Wredundant-decls -Wformat=2 -Wformat-security -Winit-self -fno-strict-aliasing -Wcast-qual -fno-strict-overflow -Wnon-virtual-dtor -Wno-free-nonheap-object -rdynamic -DUNIX -D_FORTIFY_SOURCE=2 -DWITH_DL -DWITH_DBG_GDB -DWITH_PRCTL_PT -g1 -DWITH_SIGACTION -DWITH_SIGALTSTACK -DWITH_BITMATH_BUILTINS -DWITH_DEMANGLE -DWITH_ZLIB -DWITH_LIBLZMA -DWITH_LZO -DWITH_XDG_BASEDIR -D_SQ64 -I/home/freebox/jgrpp-sources/src/3rdparty/squirrel/include -DWITH_PNG -I/usr/include/libpng16 -DDEDICATED -DWITH_PERSONAL_DIR -DPERSONAL_DIR=\".openttd\" -DGLOBAL_DATA_DIR=\"/usr/local/share/games/openttd\"
As you can see I run it without sudo.
And when compiling :
Code: Select all
freebox@openttdsrv:~/jgrpp-sources$ make bundle
make[1]: Entering directory '/home/freebox/jgrpp-sources/objs/lang'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/freebox/jgrpp-sources/objs/lang'
make[1]: Entering directory '/home/freebox/jgrpp-sources/objs/setting'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/freebox/jgrpp-sources/objs/setting'
make[1]: Entering directory '/home/freebox/jgrpp-sources/objs/extra_grf'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/freebox/jgrpp-sources/objs/extra_grf'
make[1]: Entering directory '/home/freebox/jgrpp-sources/objs/release'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/freebox/jgrpp-sources/objs/release'
[BUNDLE] Constructing bundle
freebox@openttdsrv:~/jgrpp-sources$
PS : Here I'm compiling jgrpp but I also have the same problem with the openttd trunk.
Re: Linux dedicated server
_personal_dir is determined from the home directory of the logged in used, via the xdgDataHome() function if XDG is available, and otherwise via the HOME environment variable. It's not set at compile time, but determined when you actually start the game.
Try setting HOME and XDG_DATA_HOME to some appropriate path while running, like this:
Try setting HOME and XDG_DATA_HOME to some appropriate path while running, like this:
Code: Select all
HOME=/home/freebox/ottd-run XDG_DATA_HOME=/home/freebox/ottd-run server/openttd -D -f
Re: Linux dedicated server
Thank you very much !
I'm surprised it works by default in such complex directories rather than :
- directly in the folder containing the "openttd" binary
- in some path found in the config file
I had to create this directory in my home path :
~/.local/share/openttd
Then copy in ~/.local/share/openttd/baseset all the grf I had in the ~/server/baseset folder
I would have prefered to indicate the base folder was ~/server, but when I set HOME this folder, it tries to access ~/server/.local/share/openttd
And another strange thing : there is no problem accessing and creating the ~/.config/openttd directly to store config files.
I'm surprised it works by default in such complex directories rather than :
- directly in the folder containing the "openttd" binary
- in some path found in the config file
I had to create this directory in my home path :
~/.local/share/openttd
Then copy in ~/.local/share/openttd/baseset all the grf I had in the ~/server/baseset folder
I would have prefered to indicate the base folder was ~/server, but when I set HOME this folder, it tries to access ~/server/.local/share/openttd
And another strange thing : there is no problem accessing and creating the ~/.config/openttd directly to store config files.
Re: Linux dedicated server
If you read the readme.txt file, everything about all the various kinds of directories is explained in full details.
There is nothing strange about it, it works as advertised.
There is nothing strange about it, it works as advertised.
Being a retired OpenTTD developer does not mean I know what I am doing.
Who is online
Users browsing this forum: Ahrefs [Bot] and 16 guests