Editing MG/Dedicated Server
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
− | Starting MegaGlest 3.6.0 it is possible to host a dedicated headless game server. This means you can now install MegaGlest on a dedicated or virtual private server hosted in a data center, or a virtual server on your computer. This can be quite useful since data centers usually provide way better network connectivity at affordable pricing than ISPs can provide (and users can afford) in residential areas, meaning less people will drop out of games, and there will be less latency ('better ping'). Moreover, dedicated servers can run 24/7 so servers can be available for hosting games at any time | + | Starting MegaGlest 3.6.0 it is possible to host a dedicated headless game server. This means you can now install MegaGlest on a dedicated or virtual private server hosted in a data center, or a virtual server on your computer. This can be quite useful since data centers usually provide way better network connectivity at affordable pricing than ISPs can provide (and users can afford) in residential areas, meaning less people will drop out of games, and there will be less latency ('better ping'). Moreover, dedicated servers can run 24/7 so servers can be available for hosting games at any time |
== Requirements == | == Requirements == | ||
− | To host your own headless server, you will need a dedicated or virtual private server which | + | To host your own headless server, you will need a dedicated or virtual private server which meets the minimum requirements the [http://sourceforge.net/apps/trac/megaglest/export/HEAD/trunk/docs/README.txt MegaGlest README] lists. You should actually be okay with 512 MB RAM, though. Of course, you do not actually need to have a video/graphics or audio card. |
− | + | The cheapest way to host is probably to go with a Virtual Private Server (VPS). There are unbelievably many VPS providers out there and we have little to no experience with them so we can't really make a recommendation at this point. The only thing we know is that Amazon currently has an offer for [http://aws.amazon.com/free/ free-for-one-year VPS] on their cloud platform (conditions apply). Plus there is [http://freevps.us/page-requirements.html FreeVPS.us] which provides what its name says if you strip naked and dance the hula-hula. | |
− | + | ==Operating system== | |
− | + | Since we have to decide for one operating system, we go the easy (and good) way and use Debian GNU/Linux 6.0 (Squeeze). These steps ''may'' also work on later Debian versions as well as on Ubuntu servers. | |
− | |||
− | |||
Install a minimal Debian GNU/Linux server. This can be done with a Debian ''Netinstall'' CD image as well as by many other ways. The details are considered out of the scope of this manual - see the Debian website and installation manual. | Install a minimal Debian GNU/Linux server. This can be done with a Debian ''Netinstall'' CD image as well as by many other ways. The details are considered out of the scope of this manual - see the Debian website and installation manual. | ||
Line 23: | Line 21: | ||
==MegaGlest installation== | ==MegaGlest installation== | ||
− | The next steps are specific to the installation and configuration of MegaGlest on your dedicated server. If you already have a working multi-use(r) Debian server, this is the point to start following this tutorial. | + | The next steps are specific to the installation and configuration of MegaGlest on your dedicated server. If you already have a working multi-use(r) Debian 6.0 server, this is the point to start following this tutorial. |
Still working as ''root'', create a new restricted user ''megaglest'': | Still working as ''root'', create a new restricted user ''megaglest'': | ||
− | adduser megaglest | + | adduser megaglest |
− | Also as ''root'', install dependencies for MegaGlest | + | Also as ''root'', install dependencies for MegaGlest: |
− | apt-get install | + | apt-get install bzip2 p7zip-full libsdl1.2debian-alsa libglu1 libsm6 libopenal1 libvorbisfile3 libglew1.5 libfontconfig1 |
− | |||
− | |||
Now switch to the ''megaglest'' user, this is the last time you need to work as ''root'': | Now switch to the ''megaglest'' user, this is the last time you need to work as ''root'': | ||
Line 39: | Line 35: | ||
su -l megaglest | su -l megaglest | ||
− | Download | + | Download MegaGlest 3.5.3-beta1: |
− | wget | + | wget -O megaglest3.5.3-beta1_i386_64_linux_bin.tar.bz2 http://sourceforge.net/projects/megaglest/files/in_development/megaglest3.5.3-beta1_i386_64_linux_bin.tar.bz2/download |
− | + | wget -O megaglest-data-3.5.3-beta1.7z http://sourceforge.net/projects/megaglest/files/in_development/megaglest-data-3.5.3-beta1.7z/download | |
− | + | Unpack and clean up: | |
− | mkdir megaglest | + | mkdir megaglest |
− | + | cd megaglest | |
− | cd megaglest | + | 7z x ../megaglest-data-3.5.3-beta1.7z |
− | + | tar --exclude='*/.svn/*' -xjf ../megaglest3.5.3-beta1_i386_64_linux_bin.tar.bz2 | |
− | + | rm start_megaglest_configurator start_megaglest_g3dviewer start_megaglest_mapeditor megaglest_configurator megaglest_editor megaglest_g3dviewer | |
− | tar - | + | mkdir -p ~/.megaglest |
− | rm | + | |
+ | # This should be no longer neccessary due to the --exclude above, but I leave it here for reference: | ||
+ | #find /home/megaglest/megaglest/ -name .svn -type d -print0 | xargs -0 /bin/rm -fr | ||
− | + | Do a test run: | |
− | megaglest@gameserver:~/megaglest- | + | megaglest@gameserver:~/megaglest$ ./start_megaglest --version |
− | + | gamedir [/home/megaglest/megaglest] | |
− | + | Looking for LDCONFIG []... | |
− | + | LDCONFIG environment variable is not set... | |
− | + | Found LDCONFIG in /sbin [/sbin/ldconfig]... | |
− | + | default library [/home/megaglest/megaglest/lib/libopenal.so.0] is missing, attempting to find and link to a newer version if available... | |
− | + | new library link [/usr/lib/libopenal.so.1] pointed to from [/home/megaglest/megaglest/lib/libopenal.so.0] | |
− | - | + | default library [/home/megaglest/megaglest/lib/libdirectfb-1.2.so.0] is missing, attempting to find and link to a newer version if available... |
− | - | + | new library link [/usr/lib/libdirectfb-1.2.so.9] pointed to from [/home/megaglest/megaglest/lib/libdirectfb-1.2.so.0] |
− | + | default library [/home/megaglest/megaglest/lib/libfusion-1.2.so.0] is missing, attempting to find and link to a newer version if available... | |
− | + | new library link [/usr/lib/libfusion-1.2.so.9] pointed to from [/home/megaglest/megaglest/lib/libfusion-1.2.so.0] | |
− | + | default library [/home/megaglest/megaglest/lib/libdirect-1.2.so.0] is missing, attempting to find and link to a newer version if available... | |
− | + | new library link [/usr/lib/libdirect-1.2.so.9] pointed to from [/home/megaglest/megaglest/lib/libdirect-1.2.so.0] | |
− | - | + | default library [/home/megaglest/megaglest/lib/libjpeg.so.62] is missing, attempting to find and link to a newer version if available... |
− | + | default library [/home/megaglest/megaglest/lib/libpng12.so.0] was found in [/lib/libpng12.so.0] | |
− | + | default library [/home/megaglest/megaglest/lib/libcurl-gnutls.so.4] was found in [/usr/lib/libcurl-gnutls.so.4] | |
− | + | default library [/home/megaglest/megaglest/lib/libxerces-c.so.28] is missing, attempting to find and link to a newer version if available... | |
− | + | default library [/home/megaglest/megaglest/lib/libicudata.so.40] is missing, attempting to find and link to a newer version if available... | |
− | + | default library [/home/megaglest/megaglest/lib/libicuuc.so.40] is missing, attempting to find and link to a newer version if available... | |
− | + | v3.5.3-beta1-GNUC: 40401 [64bit]-Nov 3 2011 23:48:39, SVN: [Rev: 2782], [STREFLOP] | |
− | + | megaglest@gameserver:~/megaglest$ | |
− | |||
− | |||
− | + | These library messages are completely normal and can be ignored. All of them go to standard error. The only line returned to standard output is the very last one - the version info. Congratulations, MegaGlest works! | |
− | + | ==Firewall configuration== | |
− | |||
− | |||
− | |||
− | + | Now you need to ensure that people can actually connect to it from the Internet so that it will get listed [http://master.megaglest.org on the master server]. For this to work, Internet originated traffic must be able to reach the server on '''''TCP port 61357'''''. For FTP functionality (not currently supported on headless servers by the time of writing) you also need to make Internet originated traffic on '''''TCP ports 61358 to 61366''''' reach the server. | |
+ | Once publishing to the master server succeeded you (and others) may connect to it from within your Desktops' MegaGlest installation. The first user connecting to a headless server controls it. If this user disconnects, the next user who already joined / will join is in control. | ||
==MegaGlest configuration== | ==MegaGlest configuration== | ||
− | You may now want to set a server name, this is currently done via | + | You may now want to set a server name, this is currently done via the ''NetPlayerName'' option in glestuser.ini: |
mkdir -p ~/.megaglest | mkdir -p ~/.megaglest | ||
echo 'NetPlayerName=MyTestServer' > ~/.megaglest/glestuser.ini | echo 'NetPlayerName=MyTestServer' > ~/.megaglest/glestuser.ini | ||
− | Obviously you should | + | Obviously you should replace <code>MyTestServer</code> by something which nicely represents server. Watch out, there is a low character limit in place. |
− | You are now ready to go. However, for advanced configuration, many more options which may matter for a game server are available. Here is an optional example for a more | + | You are now ready to go. However, for advanced configuration, many more options which may matter for a game server are available. Here is an optional example for a more complex <code>~/.megaglest/glestuser.ini</code> file: |
### For more information on these options, please consult | ### For more information on these options, please consult | ||
− | ### | + | ### http://wiki.megaglest.org/INI |
### Network settings | ### Network settings | ||
NetPlayerName=Edit_glestuser.ini | NetPlayerName=Edit_glestuser.ini | ||
− | # | + | #ServerPort=61357 |
− | + | #MasterServerExternalPort=61357 | |
+ | #MasterServerExternalPortList=61357,61367,61377,61387,61397,80,1080,8000,8080,443,21,22,25,110,143,587,993,995 | ||
#FTPServerPort=61358 | #FTPServerPort=61358 | ||
#EnableFTPServer=1 | #EnableFTPServer=1 | ||
Line 111: | Line 106: | ||
#EnableFTPServerInternetTilesetXfer=1 | #EnableFTPServerInternetTilesetXfer=1 | ||
#EnableFTPXfer=1 | #EnableFTPXfer=1 | ||
− | #Masterserver= | + | #Masterserver=http://master.megaglest.org/ |
### Logging | ### Logging | ||
Line 126: | Line 121: | ||
### Disable all sound processing | ### Disable all sound processing | ||
FactorySound=None | FactorySound=None | ||
+ | |||
+ | ### QA | ||
+ | #AutoTest=true | ||
### File archives | ### File archives | ||
Line 131: | Line 129: | ||
#FileArchiveExtractCommandParameters=x -o{outputpath} {archivename} | #FileArchiveExtractCommandParameters=x -o{outputpath} {archivename} | ||
#FileArchiveExtractCommandSuccessResult=0 | #FileArchiveExtractCommandSuccessResult=0 | ||
− | #FileArchiveExtension=. | + | #FileArchiveExtension=.7z |
− | + | These and all other glestuser.ini options are [[MG/INI|documented on this wiki]]. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==Game server automation== | ==Game server automation== | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | If you want to run the game server regularly, you can introduce some level of automation. You may want to make it start up automatically on boot. And you most likely want to have it quit and restart the game process after every played game to rule out side effects which may drain on system resources - remember, the headless server is still a pretty young feature, and restarting the game is very quick and does not hurt. Here's a crontab and a management script to do both of the above: | |
− | + | wget http://dl.megaglest.org/megaglest-gameserver.tar.gz | |
− | + | tar xzf megaglest-gameserver.tar.gz | |
− | + | chmod +x start_megaglest_gameserver.sh | |
− | + | # Careful: only do this when there is not already a crontab for your user ('crontab -l' to check). | |
− | + | # In case there already is one then just add the contents of the 'cron' file to your crontab, | |
− | + | # by running crontab -e. | |
− | + | crontab cron | |
− | + | rm megaglest-gameserver.tar.gz cron | |
− | |||
− | crontab -e | ||
− | |||
− | |||
− | |||
− | |||
− | |||
After the next reboot, the gameserver should start up automatically. | After the next reboot, the gameserver should start up automatically. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | Use utilities like ''top'' and ''ps'' to inspect how things are going. Server logs are created at <code>~/.megaglest/server.log</code>. | |
+ | If you run into any bugs, please report them at http://bugs.megaglest.org. If you have any questions, please discuss them at http://forum.megaglest.org/. Please report your experiences there, too. | ||
==See also== | ==See also== | ||
Line 239: | Line 154: | ||
*[[Multiplayer]] | *[[Multiplayer]] | ||
[[Category:MG]] | [[Category:MG]] | ||
− | |||
− |