2010/11/13

Compiling and Running PvPGN on CentOS 5.5 Linux Distribution (Howto)


Introduction
First off, I would need to get a few thing out of my way (aka tl;dr)
  • English is not my native tongue, so there will be grammatical and/or spelling errors.
  • This document is a growing one and it will change over time.
  • I will accept contributions and add them to this blog post while crediting the contributors
  • You can also contribute here as well as on other official PvPgn forums.
  • This guide is not intended for large PvPGN networks like eurobattle.net. It may only provide instructions for running a small LAN bnetd (PvPGN) server, and WILL NOT USE MYSQL.
  • This guide assumes that you know what PvPGN is.
  • This guide assumes that you have some Linux (CentOS), and general computer knowledge.
  • It is also required that you have at least 1Mbit internet download speed (or a lot of patience) and a decent upload speed (at least 192k) if you are hosting outside of lan.
  • May or may not work on other Linux based OS
  • After running this guide, you will be set to host a Warcraft III / Frozen Throne battle.net emulation because it is the easiest to set up.
  • If you want to host Diablo II battle.net emulation, you will have to wait for a next guide, or snoop around the interwebs :)

Hardware Requirements
I know that i had it set up on a Linux box that was configured as follows:
  • Cpu: Celeron @ 700mhz
  • Gpu: S3 Trio 64v+ (1mb)
  • Ram: 128mb
  • 100mbit network card
If it could run on that supporting 8 users, I'm pretty sure it would run on low-end machine by today's standards.


Software Requirements
  • Installed CentOS 

Preparation
We will start off by preparing the system.
Centos:
  • First, we need to setup our system for the tasks ahead
  • Log in to your machine as root. 
  • yum groupinstall "Development Tools" "Development Libraries"
  • This will take some time to download and install depending on your internet speed, hard disk performance and previously installed packages
Firewall (hard)
If you want your firewall up, use this "hard" guide.
If you don't want firewall, skip to "easy" guide.
You should still be logged in as root.
  • setup
  • Choose "Firewall Configuration"
  • Set "Enabled"
  • Set "Enforcing" (press tab to go to the next set of options)
  • Select "Customize"
  • Allow Incoming: Our server doesn't need these ports, but choose some if you need them for yourself.
  • This is what we need: "Other ports". Type: 6112:tcp,6112:udp,6200:tcp
  • Go to OK
  • Go to OK
  • Go to Quit
Firewal (easy)
  • setup
  • Choose "Firewall Configuration"
  • Set "disabled"
  • Go to OK
  • Go to Quit
CMake:
This is buid system required to compile PvPGN (not a compiler, but necessary). We must compile it because it is not currently downloadable through default yum configuration.
  • You should still be logged in as root
  • cd /tmp 
  • Get the latest source from http://www.cmake.org/cmake/resources/software.html
  • In my case it was:  wget http://www.cmake.org/files/v2.8/cmake-2.8.3.tar.gz 
  • tar -xvzf cmake-*.tar.gz 
  • mv -r cmake-* /usr/src/
  • cd /usr/src/cmake-*/ 
  • ./bootstrap; gmake; gmake install
    This will take some time!
User pvpgn
We are making this user because we don't want pvpgn running  as root. Username will be pvpgn
  • You should still be logged in as root. Type  useradd pvpgn 
  • passwd pvpgn
  • You will be asked for the password. If you get a warning about password not bein adequate, don't worry. Type it in one more time and it will be set. After successfuly changing the password you should get this message:
    passwd: all authentication tokens updated successfully.
  • Log in as pvpgn with the new password
Overview of things done:
  • Installed packages on CentOS needed for compiling programs
  • Set our firewall ready for bnetd (PvPGN)
  • Compiled and installed CMake needed for building of PvPGN
  • Created user "pvpgn" which will be used to run PvPGN

Compiling and installing PvPGN
Now we are ready to get busy :)
  • You should be logged in as pvpgn 
  • cd /tmp/ 
  • Easiest way to download the latest build of PvPGN is by doing this:
    svn checkout svn://svn.berlios.de/pvpgn/trunk/ 
  • cd trunk/pvpgn/ 
  • This will setup, compile and install PvPGN WITHOUT MYSQL
    cmake -D CMAKE_INSTALL_PREFIX=/home/pvpgn ../pvpgn; make; make install
  • Next steps will download support files which are necessary
  • cd /tmp/
  • wget http://download.berlios.de/pvpgn/pvpgn-support-1.2.tar.gz
  • tar -xvzf pvpgn-support-*.tar.gz
  • cd pvpgn-support-*/
  • Now we move the support files from the tmp dir to our installation
  • mv * ~/var/files/

Starting pvpgn
pvpgn is ready to start with its default configuration. You should first try starting bnetd with default options. If it works by default, then you should change the configuration options. Check the configuration notes section of this guide for more info.
Logged in as pvpgn
cd ~/sbin/
./bnetd


Checking if bnetd started
ps axu |grep bnetd
You should see something like this
pvpgn     7878  0.5  0.3  24612  1840 pts/0    S    21:10   0:00 ./bnetd


Stopping pvpgn
Logged in as pvpgn or root
killall bnetd
If bnetd is still running after stopping with killall do this
killall -9 bnetd



A few notes about configuration
I will run you through the basic options that you need to set up. You can change everything else that you need. Be carefull when you do change other stuff because 1 wrong character in the setup can make your server not even start. 
Word of advice to nano users! Nano will sometimes "wrap" text so a part of the line will go to a line below which is NOT GOOD. If that ever happens, remember to return the line the way it was!
Main configuration file can be found in /home/pvpgn/etc/bnetd.conf
  • effective_user and effective_group : we do not really need to set this, because we intend of running bnetd as pvpgn user. You might want to change this if you intend of making a startup script or a CentOS service script.
  • storage section: it is already set up to use the "file" method of storing data. If you want MySQL, set this section accordingly. You must have only one storage_path option!!!
  • paths are set OK by default
  • loglevels: leave those alone. By default it is set to log everyhitng. We need for now if something goes wrong with the setup. You can change this when you are sure your server is running smoothly.
  • allowed_clients : This one is up to you. I suggest starting with war3, w3x
  • Other options are up to you, but for starters, i would leave them alone.
You can look in the folder /home/pvpgn/etc/ for other configuration files that can be changed.


Client requirements (Warcraft III/Frozen Throne)
In order to connect  to our server, we need to set a few things on our gaming PC (PCs)
  • Gateway editor which can be found here.
  • Latest patch for our Frozen Throne which can be found here
  • We need a loader for Frozen Throne which can be found here. Scroll down when you get to the "private servers" link.
You should first apply the patch, then copy the loader files to your Warcraft III directory.
After that you should start the Gateway editor and CLICK THE THIRD TAB ON THE BOTTOM before changing the settings. You should edit one of the gateways putting in your LAN IP of the PvPgn Server.
Finally, start the game with the w3l.exe, select your "gateway" and enjoy :)


Contributors:
Supermarine9 from PvPGN forums.


Further reading
http://pvpgn.wikia.com/wiki/PvPGN
http://forums.pvpgn.org/

1 comment:

  1. nice tut bro, can you also make tut about how to add a dota maps

    Thanks ^_^

    ReplyDelete

Labels

bnetd (1) centos (1) certificate (1) howto (2) linux (2) pidgin (1) pvpgn (1) windows (1)