First important note. It is looks long, it is looks hard, but it is easy and everything can be done in less than 5 minutes 
This guide was tested on clean installation of CentOs GNU/Linux 5.3 (x86_64). Everything is done from command line, that means that everything can be done over ssh on remote server.
In my case was only base system installed, that means that after startup and login i was already in command line and working directory was my home directory. If you are not in command line then you need to go here some way (ie if gnome is installed then open terminal).
1. Prerequisites.For PtokaX compile you need make (tool controling executable generation from sources), g++ (c++ compiler), zlib (compression library used to save hub badwith) and Lua (programming language used for scripting).
They can be installed using package manager.
Note: to install packages using package manager you need root permissions.- a. Make.
In my case was installed but to be sure you can run:
yum install make
- b. g++.
Install it with this command:
yum install gcc-c++
Result of this command looks similar to this:

- c. zlib.
Install it with this command:
yum install zlib-devel
Result of this command looks similar to this:

- d. Lua.
This one is little complicated because is not available in CentOS packages.
As easy way for me looks like RPMforge is good source to get it from. How to add RPMforge to your repositories is here.
When you have RPMForge successfully added then you can install lua with this command:
yum install lua-devel
Result of this command looks similar to this:

2. Sources and compile.- a. PtokaX source.
Download it with this command:
wget http://www.PtokaX.org/files/0.4.1.1-posix-src.tgz
Result of this command looks similar to this:

Unpack downloaded archive with this command:
tar -xf 0.4.1.1-posix-src.tgz
- b. TinyXml source.
TinyXml is library used by PtokaX for reading and writing xml files.
Go to tinyxml source directory with this command:
cd PtokaX/tinyxml
Download TinyXml with this command:
wget http://downloads.sourceforge.net/project/tinyxml/tinyxml/2.5.3/tinyxml_2_5_3.tar.gz
Result of this command looks similar to this:

Unpack downloaded archive with this command:
tar -xf tinyxml_2_5_3.tar.gz
- c. TinyXml compile.
Because my makefile want tinyxml source in src subdir (now is empty) and TinyXml was unpacked to tinyxml directory remove that src directory with this command:
rmdir src
And rename tinyxml directory to src with this command:
mv tinyxml src
Now you can compile TinyXml with this command:
make
Result of this command looks similar to this:

- d. PtokaX compile.
You need to get back from tinyxml directory to PtokaX root, do it with this command:
cd ..
PtokaX makefile need two changes. We do them in text editor VIM.
- How to use VIM:
- Is easy to use, after file is open then move in it with cursor keys.
- To start editing press Insert key, to end editing press Esc key.
- To save file use:
:w
- And to quit editor use:
:q
Now when we now how to use VIM we open makefile with this command:
vim makefile
Search for this line:
$(CXX) -lpthread -lz -llua5.1 -lrt -o PtokaX \
And change it to this:
$(CXX) -lpthread -lz -lrt -ldl -o PtokaX \
Search for this line:
$(CURDIR)/tinyxml/tinyxml.a
And change it to this:
$(CURDIR)/tinyxml/tinyxml.a /usr/lib/liblua.a
Or if you have x86_64 CentOS to this:
$(CURDIR)/tinyxml/tinyxml.a /usr/lib64/liblua.a
Now you can finally compile PtokaX with this command:
make
Result of this command looks similar to this:

3. Basic setup.Now you should have PtokaX executable, but before we run it we need to make at least minimal setup.
In source we have config examples, we use them to setup your PtokaX hub.
First we rename cfg.example directory to cfg with this command:
mv cfg.example cfg
Go to cfg dir with this command:
cd cfg
- a. Minimal settings.
To be able to run PtokaX we need to set at least hubname and hub address.
Open Setting.xml in text editor with this command:
vim Settings.xml
Search for this line:
<String Name="HubName"><Enter hub name here></String><!-- Hub name. Min length 1, max 256. -->
And change this:
<Enter hub name here>
To your hubname. For example like that:
<String Name="HubName">CentOS TEST</String><!-- Hub name. Min length 1, max 256. -->
Search for this line:
<String Name="HubAddress"><Enter hub address here></String><!-- Hub address. Min length 1, max 256. -->
And change this:
<Enter hub address here>
To your hub address. For example like that:
<String Name="HubAddress">192.168.0.18</String><!-- Hub address. Min length 1, max 256. -->
End editing (Esc), save file (:w) and quit editor (:q).
- b. Creating registered user for master.
This part is not needed, but it is good to have.
Open RegisteredUsers.xml in text editor with this command:
vim RegisteredUsers.xml
Search for this line:
<Nick>Example_Nick</Nick>
And change this:
Example_Nick
To your nick name. For example like that:
<Nick>PPK</Nick>
Search for this line:
<Password>Example_Password</Password>
And change this:
Example_Password
To your password. For example like that:
<Password>test</Password>
Search for this line:
<Profile>3</Profile><!-- 0 for master, 1 for operator, 2 for vip, 3 for reg -->
And change this:
3
To your profile. For example like that:
<Password><Profile>0</Profile><!-- 0 for master, 1 for operator, 2 for vip, 3 for reg --></Password>
End editing (Esc), save file (:w) and quit editor (:q).
Leave cfg directory and go back to PtokaX root with this command:
cd ..
4. Run PtokaX, run!- a. Now we can run PtokaX as console app.
Start PtokaX with this command:
./PtokaX
Result should looks like this:

And from client similar to this:

- b. Or we can run PtokaX as daemon.
For that is good to specify config directory, else will be used /home/%curuser%/.PtokaX directory.
So we will run PtokaX with command similar to this:
./PtokaX -d -c configdir
Result should looks like this:
