[Thanks to ATHK for this post!] If you do have root access run copy and paste the below into the terminal
wget http://www.byond.com/download/build/496/496.1138_byond_linux.zip
wget http://www.byond.com/download/build/gcc/libstdc++-libc6.2-2.so.3
wget http://www.byond.com/download/build/gcc/libstdc++.so.5
unzip 496.1138_byond_linux.zip
cd byond
make install
DreamDaemon -version
The two GCC libs are downloaded incase you need them although it may not be needed Then you can run the game like so
DreamDaemon game.dmb 12345 -trusted -logself
If you want to have the game hosted even when you logout and close your window, use the & operator. Will cause the command to be forked and run in the background (you can always kill it by it’s PID).
DreamDaemon game.dmb 12345 -trusted -logself &
-logself will out put errors and the like, also if it can connect to the hub using the supplied port. Also remember you may need to open the port in iptables.
iptables -A INPUT -p tcp -d 0/0 -s 0/0 --dport PORT -j ACCEPT &
PORT would be the one you chose prior.
note: terminal commands are shown in code quotes
----- Standard Use: Installing BYOND -----
1) install your favorite flavor of Linux and update your system
2) open your browser and visit http://www.byond.com/download/
3) right click the link for "Linux" and then click "copy link location"
4) open a terminal window
5) download the latest version of BYOND for Linux:
wget http://www.byond.com/download/build/479/479.1086_byond_linux.zip
6) unzip the install files
7) install BYOND. Here you have two options. You can either "source" BYOND for local use (can only be used by a single user and has some other limitations) or you can install BYOND as root for use by all users. You need to have administrator privileges to install BYOND for all users.
--- 7a) to install as root:
Ctrl-O to save; Ctrl-X to exit
Congratulations, you can now host games in Linux! Simply navigate to the location of your host files and use the command:
Options can include things like -invisible to host in invisible mode, -trusted to allow access outside of the game folder, etc.
If you use the command
As an example, your game hosting command might look something like this:
now, for another basic Linux concept:
----- Standard Use: Running in Background -----
If you host a game in the terminal and then close the terminal, logout, shutdown, or press Ctrl-C, it will kill your game. To prevent this from happening, you can run your game in the background by adding a '&' to the end of your DreamDaemon command. e.g.:
Now for the cool stuff...
----- Intermediate: Automatic Game Hosting -----
This is a great feature if you want a game to run automatically after a server reboot, if you want your game to go back up after crashes even if you aren't around, or if you want to setup a simple auto-updater for your game (more on that later). Although it is possible to setup auto-hosting using other techniques, this is the method that I use.
First, make a folder for scripts (in a place that's easy to find/manage). Let's use the home directory. In the terminal:
Now, "copy" the following code and paste it into the nano text editor by middle clicking.
So what does this script do? This script checks every 5 seconds (for a total of 55 seconds) to see whether DD is running. If it isn't, it executes DD to re-launch your game.
some notes:
1) I recommend using the full path for DD for reasons I'll show later. If you installed BYOND for local use, you will need to edit the path as applicable.
2) /path/to/game.dmb is the location of your game's .dmb, e.g. /home/user/mygame/mygame.dmb
3) port is a number, e.g. 1234
4) for info on -options, use the DreamDaemon command in terminal
5) use '&' to run in background
Once you've configured the file as needed, use Ctrl-O to save it (call it launch_mygame.sh), and Ctrl-X to exit nano.
Now we need to configure crontab to run the script.
note: You have the option of using your local user-specific crontab; however, if you do so, the script will only be executed while you are logged in (whether you are sitting in front of the machine or using SSH). If possible, I recommend using the "root" crontab; doing so will execute your script any time the computer is running, even if no one is logged in.)
to use the "root" crontab, type:
Ctrl-O to save, and Ctrl-X to exit
if logged in as root:
So what does this do? * * * * * means that, every minute, the job scheduler will run the command specified, i.e. running your launch_mygame.sh script using bash. Any output is sent to /dev/null and ignored
Congratulations, you now have an auto-launching BYOND-game in Linux.
----- Advanced: Multi-Auto-Hosting -----
As you may have noticed in the previous section, launch_mygame.sh only checks to see if DreamDaemon is running
So here we'll set up a script to auto-run TWO different games.
now edit the file so it looks like this:
Our modified script now checks, for each game, whether its custom implementation of DD is running. Now we need to setup the custom daemons. If you've installed BYOND as root:
And... we're done! Now, using CustomDaemon1 or CustomDaemon2 in the terminal launches DD but reports (in top or ps -x) as if it were a program called CustomDaemon{1,2}. Thus our launch_mygame.sh script can check whether each program is running based on whether its dedicated daemon is running.
note: If you installed as root, your symlinks will be retained even if you update your BYOND version using "sudo make install" (e.g. when a new linux version comes out). If you installed for local use, you can retain your symlinks by installing BYOND thus:
----- Advanced: Auto-Updater -----
So you already have a system in place to host your game whenever it's down. Now let's take it a step further, to have our game check whether an update is present, kill itself, and then relaunch using the updated host files.
First, create a game subfolder called update.
Now, edit your game (yes, you can do this through bash by parsing the job ID, but it's easiest this way) and add the following, either to your startup script or into your game's equivalent of crontab.
Thus, your game will check once per second to see whether an update is available (and shut itself down if there is an update available).
note: Other implementations of this system are possible, such as FFO's automatic 10-minute shutdown timer when an update is detected. (See? There is a reason to do this in-game instead of using bash...)
Now we edit launch_mygame.sh to implement the update:
Thus, if there's anything in the update folder, it will be moved to the game's root folder and overwrite it. If there's nothing in the folder, the mv error is ignored (sent to /dev/null as you may recall), and the script launches the existing host files. This allows you to update your game by either depositing a .dmb in the appropriate folder (e.g. using scp, SSH Secure Shell, or equivalent) or by uploading it directly through your game.