PtokaX > FAQ section

HOW-TO: Compile and setup PtokaX on CentOS GNU/Linux

(1/2) > >>

PPK:
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:

--- Quote ---yum install make
--- End quote ---

* b. g++.
Install it with this command:

--- Quote ---yum install gcc-c++
--- End quote ---
Result of this command looks similar to this:

* c. zlib.
Install it with this command:

--- Quote ---yum install zlib-devel
--- End quote ---
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:

--- Quote ---yum install lua-devel
--- End quote ---
Result of this command looks similar to this:

2. Sources and compile.


* a. PtokaX source.
Download it with this command:

--- Quote ---wget http://www.PtokaX.org/files/0.4.1.1-posix-src.tgz
--- End quote ---
Result of this command looks similar to this:

Unpack downloaded archive with this command:

--- Quote ---tar -xf 0.4.1.1-posix-src.tgz
--- End quote ---

* b. TinyXml source.
TinyXml is library used by PtokaX for reading and writing xml files.
Go to tinyxml source directory with this command:

--- Quote ---cd PtokaX/tinyxml
--- End quote ---
Download TinyXml with this command:

--- Quote ---wget http://downloads.sourceforge.net/project/tinyxml/tinyxml/2.5.3/tinyxml_2_5_3.tar.gz
--- End quote ---
Result of this command looks similar to this:

Unpack downloaded archive with this command:

--- Quote ---tar -xf tinyxml_2_5_3.tar.gz
--- End quote ---

* 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:

--- Quote ---rmdir src
--- End quote ---
And rename tinyxml directory to src with this command:

--- Quote ---mv tinyxml src
--- End quote ---
Now you can compile TinyXml with this command:

--- Quote ---make
--- End quote ---
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:

--- Quote ---cd ..
--- End quote ---
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:

--- Quote ---:w
--- End quote ---

* And to quit editor use:

--- Quote ---:q
--- End quote ---

Now when we now how to use VIM we open makefile with this command:

--- Quote ---vim makefile
--- End quote ---

Search for this line:

--- Quote ---$(CXX) -lpthread -lz -llua5.1 -lrt -o PtokaX \
--- End quote ---
And change it to this:

--- Quote ---$(CXX) -lpthread -lz -lrt -ldl -o PtokaX \
--- End quote ---

Search for this line:

--- Quote ---$(CURDIR)/tinyxml/tinyxml.a
--- End quote ---
And change it to this:

--- Quote ---$(CURDIR)/tinyxml/tinyxml.a /usr/lib/liblua.a
--- End quote ---
Or if you have x86_64 CentOS to this:

--- Quote ---$(CURDIR)/tinyxml/tinyxml.a /usr/lib64/liblua.a
--- End quote ---

Now you can finally compile PtokaX with this command:

--- Quote ---make
--- End quote ---
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:

--- Quote ---mv cfg.example cfg
--- End quote ---
Go to cfg dir with this command:

--- Quote ---cd cfg
--- End quote ---


* 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:

--- Quote ---vim Settings.xml
--- End quote ---

Search for this line:

--- Quote ---<String Name="HubName">&lt;Enter hub name here&gt;</String><!-- Hub name. Min length 1, max 256. -->
--- End quote ---
And change this:

--- Quote ---&lt;Enter hub name here&gt;
--- End quote ---
To your hubname. For example like that:

--- Quote ---<String Name="HubName">CentOS TEST</String><!-- Hub name. Min length 1, max 256. -->
--- End quote ---

Search for this line:

--- Quote ---<String Name="HubAddress">&lt;Enter hub address here&gt;</String><!-- Hub address. Min length 1, max 256. -->
--- End quote ---
And change this:

--- Quote ---&lt;Enter hub address here&gt;
--- End quote ---
To your hub address. For example like that:

--- Quote ---<String Name="HubAddress">192.168.0.18</String><!-- Hub address. Min length 1, max 256. -->
--- End quote ---

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:

--- Quote ---vim RegisteredUsers.xml
--- End quote ---

Search for this line:

--- Quote ---<Nick>Example_Nick</Nick>
--- End quote ---
And change this:

--- Quote ---Example_Nick
--- End quote ---
To your nick name. For example like that:

--- Quote ---<Nick>PPK</Nick>
--- End quote ---

Search for this line:

--- Quote ---<Password>Example_Password</Password>
--- End quote ---
And change this:

--- Quote ---Example_Password
--- End quote ---
To your password. For example like that:

--- Quote ---<Password>test</Password>
--- End quote ---

Search for this line:

--- Quote ---<Profile>3</Profile><!-- 0 for master, 1 for operator, 2 for vip, 3 for reg -->
--- End quote ---
And change this:

--- Quote ---3
--- End quote ---
To your profile. For example like that:

--- Quote ---<Password><Profile>0</Profile><!-- 0 for master, 1 for operator, 2 for vip, 3 for reg --></Password>
--- End quote ---

End editing (Esc), save file (:w) and quit editor (:q).

Leave cfg directory and go back to PtokaX root with this command:

--- Quote ---cd ..
--- End quote ---

4. Run PtokaX, run!


* a. Now we can run PtokaX as console app.
Start PtokaX with this command:

--- Quote ---./PtokaX
--- End quote ---
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:

--- Quote ---./PtokaX -d -c configdir
--- End quote ---
Result should looks like this:

PPK:
Updated version of this guide is in PtokaX Wiki  8)

kleelof:
Hello,

   I found these instructions great. I was able to just copy and paste all the commands and had it up and running the first try.

   I am having 2 issues that I could use some help with:

   1. Where can I find a start/stop script for CentOS?

   2. I am trying to use the Windows version of the admin app to connect to my CentOS install of PtokaX. However, it will connect, but will not stay connected. I checked the FAQ and it mentioned making sure the LUA script is started. Do I need to start this manually or is it automatically started when you start PtokaX? I've never worked with or even heard of LUA until I went to install PX.

take care,
lee

PPK:

--- Quote from: kleelof on 03 November, 2011, 03:15:52 ---   1. Where can I find a start/stop script for CentOS?

--- End quote ---
You can start/stop script when you connect to hub as OP/Master with chat commands !startscript scriptfilename / !stopscript scriptfilename  ::)
Or you can edit manually Scripts.xml config file:

--- Code: ---<?xml version="1.0" encoding="windows-1252" standalone="yes" ?>
<Scripts>
    <Script>
        <Name>example_script.lua</Name>
        <Enabled>1</Enabled><!-- 1 for enabled, 0 for disabled -->
    </Script>
</Scripts>

--- End code ---

Admin app is third-party creation and i'm not using it, so i cant help you with that one  :P

kleelof:
Hello,

   Thanks for your response.

   Actually, I meant start the Ptokax on my server. Right now I am using ./Ptokax. But of course that is no good because as soon as I log out the app stops running.

take care,
lee

Navigation

[0] Message Index

[#] Next page

Go to full version