Author Topic: HOW-TO: Compile and setup PtokaX on CentOS GNU/Linux  (Read 11301 times)

0 Members and 1 Guest are viewing this topic.

Offline PPK

  • Administrator
  • Emperor
  • *****
  • Posts: 1 475
  • Karma: +209/-22
  • PtokaX developer
HOW-TO: Compile and setup PtokaX on CentOS GNU/Linux
« on: 20 September, 2009, 03:20:53 »
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
  • b. g++.
    Install it with this command:
    Quote
    yum install gcc-c++
    Result of this command looks similar to this:
  • c. zlib.
    Install it with this command:
    Quote
    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:
    Quote
    yum install lua-devel
    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
    Result of this command looks similar to this:

    Unpack downloaded archive with this command:
    Quote
    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:
    Quote
    cd PtokaX/tinyxml
    Download TinyXml with this command:
    Quote
    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:
    Quote
    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:
    Quote
    rmdir src
    And rename tinyxml directory to src with this command:
    Quote
    mv tinyxml src
    Now you can compile TinyXml with this command:
    Quote
    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:
    Quote
    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:
      Quote
      :w
    • And to quit editor use:
      Quote
      :q

    Now when we now how to use VIM we open makefile with this command:
    Quote
    vim 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:
    Quote
    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:
Quote
mv cfg.example cfg
Go to cfg dir with this command:
Quote
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:
    Quote
    vim 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:
    Quote
    vim RegisteredUsers.xml

    Search for this line:
    Quote
    <Nick>Example_Nick</Nick>
    And change this:
    Quote
    Example_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:
    Quote
    Example_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:
    Quote
    3
    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:
Quote
cd ..

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

PtokaX forum

HOW-TO: Compile and setup PtokaX on CentOS GNU/Linux
« on: 20 September, 2009, 03:20:53 »

Offline PPK

  • Administrator
  • Emperor
  • *****
  • Posts: 1 475
  • Karma: +209/-22
  • PtokaX developer
Re: HOW-TO: Compile and setup PtokaX on CentOS GNU/Linux
« Reply #1 on: 10 September, 2011, 18:06:44 »
Updated version of this guide is in PtokaX Wiki  8)
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

Offline kleelof

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
Re: HOW-TO: Compile and setup PtokaX on CentOS GNU/Linux
« Reply #2 on: 03 November, 2011, 03:15:52 »
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

Offline PPK

  • Administrator
  • Emperor
  • *****
  • Posts: 1 475
  • Karma: +209/-22
  • PtokaX developer
Re: HOW-TO: Compile and setup PtokaX on CentOS GNU/Linux
« Reply #3 on: 04 November, 2011, 16:31:48 »
   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:
Code: [Select]
<?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
« Last Edit: 04 November, 2011, 16:33:24 by PPK »
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

Offline kleelof

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
Re: HOW-TO: Compile and setup PtokaX on CentOS GNU/Linux
« Reply #4 on: 04 November, 2011, 23:21:52 »
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

Offline PPK

  • Administrator
  • Emperor
  • *****
  • Posts: 1 475
  • Karma: +209/-22
  • PtokaX developer
Re: HOW-TO: Compile and setup PtokaX on CentOS GNU/Linux
« Reply #5 on: 04 November, 2011, 23:26:35 »
Quote from: ReadMe.txt
Command 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

Offline modswat

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Re: HOW-TO: Compile and setup PtokaX on CentOS GNU/Linux
« Reply #6 on: 06 March, 2017, 17:23:37 »
How to start as daemon?

From PtokaX map or in other map for example?

Offline PPK

  • Administrator
  • Emperor
  • *****
  • Posts: 1 475
  • Karma: +209/-22
  • PtokaX developer
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

Offline modswat

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Re: HOW-TO: Compile and setup PtokaX on CentOS GNU/Linux
« Reply #8 on: 06 March, 2017, 18:58:03 »
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:

PtokaX forum

Re: HOW-TO: Compile and setup PtokaX on CentOS GNU/Linux
« Reply #8 on: 06 March, 2017, 18:58:03 »