Garry's Mod doesn't have any native Linux server support, but fortunately, it is very easy to create a garrysmod server on any one of a number of UNIX like operating systems of your choice.
This configuration document was written for FreeBSD 7.0 although the same should apply for any UNIX-like system that can run wine.
Linux 2.6 works very well, pick whichever distribution you want.
FreeBSD 7.0, 7.1 and up works very well
NetBSD 5.0 works very well and is a very small installation.
http://www.netbsd.org/OpenBSD 4.5 has not been tested but is expected to work.
http://www.openbsd.org/Nexenta has not been tested.
Mac OS X has not been tested and is probably overkill for a dedicated server if you just want to run a Gmod server. It would probably work, though.
Solaris, OpenSolaris should work fine, make sure it is x86 and use a later version of Solaris 10 or OpenSolaris for best performance.
Minix - not tried it but it should work too if you really want to get your hands dirty in the process :D
I expect to be able to get it running on ReactOS in the next few months.
http://www.reactos.org/- Server requirements:
* X (make sure you also have "Xvfb" installed if you wish to disconnect from the server and let it run without X running)
* sshd
* wine
* x86 compatible processor with SSE
- Download the installer for srcds and copy it to your server. If wget is installed on your server, you can use:
$ wget "http://www.steampowered.com/download/hldsupdatetool.exe"
- Run it using the command:
$ wine hldsupdatetool.exe
- When running the above installer, it will need an X server to output the installation dialog box to. The easiest solition is: if you are accessing the server via ssh from another UNIX or Linux machine, use the "-Y" option to ssh (e.g: ssh -Y user@10.0.0.1). You may then run the above command and the window will be tunnelled over the ssh connection and opened on the desktop of your computer instead.
- When the installer has finished, assuming you chose to install into "C:\srcds", your srcds directory will be available at "/home/user/.wine/drive_c/srcds"
- You can now change into this directory and run:
$ wine hldsupdatetool -command update -game garrysmod -dir .
- This will download the garrysmod content.
- To start the server, change into "/home/user/.wine/drive_c/srcds/orangebox" and run:
$ WINEDEBUG=-all wine srcds.exe -console -game garrysmod +map gm_flatgrass +maxplayers 10 etc
- This command will open a window on your desktop machine and the server will start up.
- If you have a command line only server, or you want to disconnect from the server and allow it to continue on its own without displaying the srcds console, you will need to run the following commands on the server before you run srcds.exe:
$ Xvfb :1&
$ export DISPLAY=:1
$ cd /home/user/.wine/drive_c/srcds/orangebox
$ WINEDEBUG=-all wine srcds.exe -console -game garrysmod +map gm_flatgrass +maxplayers 12 +ip 192.168.1.66 +sv_lan 0 +hostname "My UNIX server" +sv_defaultgamemode "LightRP" -autoupdate &
- Xvfb is an X server which accepts connections from applications (such as wine GUI apps) and draws them into RAM rather than Video Memory. The result is that you do not see the output and you do not have to waste resources displaying the srcds console. - This saves us having to run the real X server when all you really need is something to stop the command from complaining that there is no X server to connect to.
- How do you view the console? You don't, at least not until someone writes a lua addon that allows ssh-ing in on a different port to directly access console output (anyone want to take this on?)
- I have bash scripts in my home directory which when executed, run the above commands. Remember to put "#!/bin/bash" as the first line of the text file and to make it executable using chmod +x <filename>.
Here is an example of what the script may look like:
#!/bin/bash
export DISPLAY=:1
cd /home/user/.wine/drive_c/srcds/orangebox && WINEDEBUG=-all wine srcds.exe -console -game garrysmod +map gm_flatgrass +maxplayers 12 +ip 192.168.1.66 +sv_lan 0 +hostname "My UNIX server" +sv_defaultgamemode "LightRP" -autoupdate &
- Make sure that you have run
Xvfb :1&
once before running the script. It would be useful to put this into one of your server's startup scripts to avoid having to run it each time you start the server.
- Finally, make sure that you put an "&" character after your "wine srcds.exe ... ... ..." command to send it into the background. You can then press Ctrl-D to disconnect the ssh session and leave the server running.
- WINEDEBUG -all switches off wine's error output, speeding up wine significantly.
- To shut down the server, either use
rcon quit
from within the game, or on your UNIX system, type:
ps ax
Find the process id <pid> of srcds.exe, and kill it using
kill -15 <pid>
Good luck!