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

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

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

Started by PPK, 20 September, 2009, 03:20:53

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

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:
    Quoteyum install make

  • b. g++.
    Install it with this command:
    Quoteyum install gcc-c++
    Result of this command looks similar to this:

  • c. zlib.
    Install it with this command:
    Quoteyum 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:
    Quoteyum install lua-devel
    Result of this command looks similar to this:

2. Sources and compile.


  • a. PtokaX source.
    Download it with this command:
    Quotewget 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:
    Quotetar -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:
    Quotecd PtokaX/tinyxml
    Download TinyXml with this command:
    Quotewget 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:
    Quotetar -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:
    Quotermdir src
    And rename tinyxml directory to src with this command:
    Quotemv tinyxml src
    Now you can compile TinyXml with this command:
    Quotemake
    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:
    Quotecd ..
    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
    • And to quit editor use:
      Quote:q

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

    Search for this line:
    Quote$(CXX) -lpthread -lz -llua5.1 -lrt -o PtokaX \
    And change it to this:
    Quote$(CXX) -lpthread -lz -lrt -ldl -o PtokaX \

    Search for this line:
    Quote$(CURDIR)/tinyxml/tinyxml.a
    And change it to this:
    Quote$(CURDIR)/tinyxml/tinyxml.a /usr/lib/liblua.a
    Or if you have x86_64 CentOS to this:
    Quote$(CURDIR)/tinyxml/tinyxml.a /usr/lib64/liblua.a

    Now you can finally compile PtokaX with this command:
    Quotemake
    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:
Quotemv cfg.example cfg
Go to cfg dir with this command:
Quotecd 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:
    Quotevim Settings.xml

    Search for this line:
    Quote<String Name="HubName">&lt;Enter hub name here&gt;</String><!-- Hub name. Min length 1, max 256. -->
    And change this:
    Quote&lt;Enter hub name here&gt;
    To your hubname. For example like that:
    Quote<String Name="HubName">CentOS TEST</String><!-- Hub name. Min length 1, max 256. -->

    Search for this line:
    Quote<String Name="HubAddress">&lt;Enter hub address here&gt;</String><!-- Hub address. Min length 1, max 256. -->
    And change this:
    Quote&lt;Enter hub address here&gt;
    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 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:
    Quotevim RegisteredUsers.xml

    Search for this line:
    Quote<Nick>Example_Nick</Nick>
    And change this:
    QuoteExample_Nick
    To your nick name. For example like that:
    Quote<Nick>PPK</Nick>

    Search for this line:
    Quote<Password>Example_Password</Password>
    And change this:
    QuoteExample_Password
    To your password. For example like that:
    Quote<Password>test</Password>

    Search for this line:
    Quote<Profile>3</Profile><!-- 0 for master, 1 for operator, 2 for vip, 3 for reg -->
    And change this:
    Quote3
    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 editing (Esc), save file (:w) and quit editor (:q).

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

4. Run PtokaX, run!


  • a. Now we can run PtokaX as console app.
    Start PtokaX with this command:
    Quote./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:
    Quote./PtokaX -d -c configdir
    Result should looks like this:
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

PPK

"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

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


Admin app is third-party creation and i'm not using it, so i cant help you with that one  :P
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

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

PPK

Quote from: ReadMe.txtCommand line commands available:
-c <configdir>      - absolute path to PtokaX config directory (where will PtokaX have cfg, logs, scripts and texts directories).
-d         - run as daemon.
-h         - show help.
-v         - show PtokaX version with build date and time.
/generatexmllanguage   - generate english language example file.
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

modswat

How to start as daemon?

From PtokaX map or in other map for example?

PPK

"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

modswat

If i start PtokaX in the same map as it is installed with the comand " ./ptokaX -d" its running in daemon. But hub is not starting.
With comand "./PtokaX" hub is starting but if i close terminal hub is ofline??  :punch:

SMF spam blocked by CleanTalk