Welcome to the PtokaX Wiki!


This wiki is devoted to let users share information on the great hubsoft PtokaX. However, it is not limited to PtokaX, it is destined to share and discuss information on different parts of the LUA programming language, but the site is NOT intended to be a replacement for the primary LUA Board aka the PtokaX Portal, nor the secondary LUA Board or the PtokaX resources.

If you’re not familiar with wikis then in short: they are user-contributed sites: pages can be edited by (almost) anyone. As such, there is always kind of up-to-date and (hopefully) proper content. They are better than forums, since relevant pieces of information are on the same page. Do not hesitate to share your knowledge, and we all hope you can learn and teach a lot here! — bastya_elvtars



Compile and setup PtokaX on CentOS

This guide was tested on clean installation of CentOS GNU/Linux 5.3.
Everything is done from command line, that means everything can be done over ssh on remote server.

In my case was only base system installed, that means 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 controlling 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 command: yum install gcc-c++
  • c. zlib
    Install it with command: yum install zlib-devel
  • d. Lua 5.1
    This one is little complicated because Lua is not available in CentOS packages.
    I'm used RPMforge as easy way how get it. How to add RPMforge to your repositories is here here.
    When you have RPMForge added then you can install Lua with this command: yum install lua-devel

2. Downloading source and compile.

  • a. PtokaX source
    Download it with command: wget http://www.czdc.org/PtokaX/0.4.2.0-nix-src.tgz
    Unpack downloaded archive with command: tar -xf 0.4.2.0-nix-src.tgz
    Now we have in actual directory new dir PtokaX. Go to that directory with command: cd PtokaX
  • a. TinyXml source
    TinyXml is library used by PtokaX for reading and writing xml files.
    Download TinyXml with command: wget http://downloads.sourceforge.net/project/tinyxml/tinyxml/2.6.2/tinyxml_2_6_2.tar.gz
    Unpack downloaded archive with command: tar -xf tinyxml_2_6_2.tar.gz
  • c. TinyXml compile
    Go to TinyXml directory with command: cd tinyxml
    Compile TinyXml with command: make
    Return back to PtokaX directory with command: cd ..
  • d. PtokaX compile
    PtokaX makefile need two changes.
    Open makefile with command: vim makefile
    Search for this line $(CXX) -lpthread -lz -llua5.1 -lrt -o PtokaX \ and change it to $(CXX) -lpthread -lz -lrt -ldl -o PtokaX \
    Search for this line $(CURDIR)/tinyxml/tinyxml.a and change it to $(CURDIR)/tinyxml/tinyxml.a /usr/lib/liblua.a or when you use x86_64 CentOS to $(CURDIR)/tinyxml/tinyxml.a /usr/lib64/liblua.a
    Now you can finally compile PtokaX with command: make

3. Basic setup.

Now you should have PtokaX executable, but before we run it we need to do 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 hub name and hub address.
    Open Setting.xml in text editor with this command: vim Settings.xml
    • To change hub name:
      Search for this line <String Name=“HubName”>&lt;Enter hub name here&gt;</String><!– Hub name. Min length 1, max 256. –> and change &lt;Enter hub name here&gt; to name of new hub.
      Result can look like this: <String Name=“HubName”>My first PtokaX hub</String><!– Hub name. Min length 1, max 256. –>
    • To change hub address:
      Search for this line <String Name=“HubAddress”>&lt;Enter hub address here&gt;</String><!– Hub address. Min length 1, max 256. –> and change &lt;Enter hub address here&gt; to address of new hub.
      Result can look like this: <String Name=“HubAddress”>some-address.some-domain.eu</String><!– Hub address. Min length 1, max 256. –>
  • b. Creating registered user. (Optional)
    When we are here, it is good idea to create registered user with master account for yourself.
    Open Setting.xml in text editor with this command: vim RegisteredUsers.xml
    • To set nick:
      Search for this line <Nick>Example_Nick</Nick> and change Example_Nick to your nick.
      Result can look like this: <Nick>MyNick</Nick>
    • To set password:
      Search for this line <Password>Example_Password</Password> and change Example_Password to your password.
      Result can look like this: <Password>MyPassword</Password>
    • To set profile:
      Search for this line <Profile>3</Profile><!– 0 for master, 1 for operator, 2 for vip, 3 for reg –> and change 3 to your profile.
      Result can look like this: <Profile>0</Profile><!– 0 for master, 1 for operator, 2 for vip, 3 for reg –>

4. Run PtokaX.

  • a. Run PtokaX as console app with actual/cfg directory
    Start PtokaX with command: ./PtokaX
  • b. Run PtokaX as daemon
    • 1. Run as daemon with default directory (/home/%curuser%/.PtokaX)
      Start PtokaX with command: ./PtokaX -d
    • 2. Run as daemon with config directory specified (you can run multiple hubs with one PtokaX executable and different config directories)
      Start PtokaX with command similar to this: ./PtokaX -d -c /home/myPtokaXhub


Personal Tools