Solaris Zones Dedicated Server Setup
From GMod Wiki
This document is a work in progress - it may be possible to share resources between zones such as gmod content but I have not yet explored this.
This process is not working correctly for me right now - by all means have a go but this isn't guaranteed to work yet
Solaris Multi-Server Setup
Why run a gmod server on Solaris x64?
Now that binaries are available for Linux, we can use the Solaris Zones and BrandZ technologies to run multiple 32-bit Linux-compatible "Zones" within one server. Multi-core servers are getting cheaper and Garry's Mod only makes use of one core. If you are a server provider and wish to save money on datacenter power, you can use this guide to consolidate four or more GMod servers onto one box without the overhead of other virtualization schemes such as VMWare, which use a lot of resources running multiple operating systems. With less power consumption, you can cut your datacenter costs and offer a lower price-per-slot without any loss of gaming performance.
Who is this for?
- Hosting providers that want to get price per slot down
- Anyone interested in using Solaris to host one or more GMod servers simultaneously with very tiny overhead
- Small communities with one multi-core server wanting to run multiple source games
Scenario
x64 Server, 10GB RAM, Quad core or i7 class hardware
Goal
To install OpenSolaris as the base OS, then to create one or more Linux-branded virtual "Zones" and run a GMod server in each of them as though they were separate servers.
For now, we will assume you have already installed Solaris or OpenSolaris
"Pingboosting" Solaris
If you want to run the server's kernel timer more quickly, edit /etc/system and add the following lines:
set hires_tick=1 set hires_hz=1000
Then reboot. You can set hires_hz to many different values, play with it to find the best one for your server. 300, 500 and 1000 are good values for low latency servicing of incoming game events from clients - the default is 100 which is good for processing but slower for responding.
Disabling the GNOME Graphical Interface (it wastes RAM and a little CPU when you just want a game server)
Disable command:
pfexec svcadm disable gdm
Enable command:
pfexec svcadm enable gdm
Setting up a Linux-binary-compatible 'Zone'
Repeat these instructions (the rest of the page) for as many zones (as many Source Dedicated Server instances) as you require - I recommend one per CPU maximum.
Log in as root, then run the following command to create a new zone.
cd /etc/zones wget http://hub.opensolaris.org/bin/download/Community+Group+brandz/linux_2_6/SUNWlx26.xml
You now have 4 options. Pick only one of them!
- Download the stripped-down CentOS 5.5 Image created by me using vmware from http://www.yourfilelink.com/get.php?fid=549137
- http://download.openvz.org/template/precreated/centos-5-x86.tar.gz
- Download one of the other pre-created images from the same site: http://download.openvz.org/template/precreated/
- Create your own CentOS 5 image to use as the gmod zone. Follow the instructions here: http://hub.opensolaris.org/bin/view/Community+Group+brandz/linux_2_6 (Under: Installing and Booting CentOS [45].x)
You will need to copy it to your Solaris server using
scp centos-image-you-just-downloaded.tar.bz2 username@hostname:~
...where username is a normal non-root user on your server.
Configuring a new Zone
zonecfg -z gmodserver1 create -t SUNWlx26 set zonepath=/export/gmodserver1 add net set address=192.168.1.10/24 (pick an IP address and netmask to use for your new zone. a netmask of /24 is equal to 255.255.255.0) set physical=e1000g0 (use your own ethernet interface here, to find out what it is called, run "ifconfig -a in another terminal" end commit exit
Install the Linux image into the new zone.
zoneadm -z gmodserver1 install -d /export/home/<your user>/centos-image-you-downloaded.tar.bz2
Check to see whether the new image is in the list
zoneadm list -iv
Boot the Zone
zoneadm -z gmodserver1 boot
Check to see whether the new image is running
zoneadm list -iv
Log in to the new zone
zlogin gmodserver1
Edit the Zone's Network settings
vi /etc/sysconfig/network
be sure to include the following text: NETWORKING=yes HOSTNAME=gmodserver1
Place your DNS servers into /etc/resolv.conf
vi /etc/resolv.conf
It should look something like:
nameserver x.x.x.x nameserver y.y.y.y
...where x.x.x.x and y.y.y.y are your nameservers Now, follow the Linux Install Guide to set up the server.
(More to follow, I'm still writing this - stuff about Binding to one CPU per Zone and RAM allocation coming next - philxyz)