Step by step guide for PtokaX compile and setup on Debian/Ubuntu GNU/Linux
 

Step by step guide for PtokaX compile and setup on Debian/Ubuntu GNU/Linux

Started by PPK, 13 September, 2009, 19:35:46

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 Debian GNU/Linux 5.0 and Ubuntu GNU/Linux 9.04. 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. First thing needed for PtokaX compile is source, you will download it with this command:
wget http://www.PtokaX.org/files/0.4.1.1-posix-src.tgz

Result should looks similar to this:

To decompress source use this command:
tar -xf 0.4.1.1-posix-src.tgz


2. Next thing needed for PtokaX compile is tinyxml, for that you need to go to PtokaX source tinyxml directory.
Use these to commands to change working directory:
cd PtokaX
cd tinyxml

Result looks like this:

Download tinyxml source with this command:
wget http://downloads.sourceforge.net/project/tinyxml/tinyxml/2.5.3/tinyxml_2_5_3.tar.gz

Result should looks similar to this:

To decompress tinyxml source use this command:
tar -xf tinyxml_2_5_3.tar.gz


Because my makefile want tinyxml source in src subdir (now is empty) and tinyxml was unpacked to tinyxml remove that src directory with this command:
rmdir src

And rename tinyxml directory to src with this command:
mv tinyxml src


3. Before we can start tinyxml compile we need make and g++ packages.
We can install them using apt-get. In case when you are not root you need to get root permissions to install new packages with apt-get.
I'm used for that this command:
su

Another way is to use sudo command, but that was not installed in my case.

To install make package use this command:
apt-get install make

Result can looks similar to this:


To install g++ package use this command:
apt-get install g++

Result can looks similar to this:


4. Now we can compile tinyxml, use this command:
make

Result should looks similar to this:


5. Now when tinyxml is compiled we can prepare things for PtokaX compile.
First change directory from tinyxml sub dir to PtokaX root, use this command:
cd ..


Again we use apt-get to get packages needed for compile.
Install zlib with this command:
apt-get install zlib1g-dev

Result can looks similar to this:


Install Lua 5.1 with this command:
apt-get install liblua5.1-dev

Result can looks similar to this:


6. Now we can start PtokaX compile.
Use this command:
make

Result should looks similar to this and this (images not posted here because they are f*cking big ;D)

7. If everything was ok you now have PtokaX executable. Before you run it you should do atleast basic 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


To be able to run PtokaX we need to set atleast hubname and hub address.

Open Setting.xml in text editor with this command:
vim Settings.xml


Use cursor keys on keyboard to move in that file. To start editing press Insert key on keyboard.

Search for this line:
<String Name="HubName">&lt;Enter hub name here&gt;</String><!-- Hub name. Min length 1, max 256. -->

And change this:
&lt;Enter hub name here&gt;

To your hubname. For example like that:
<String Name="HubName">PtokaX test</String><!-- Hub name. Min length 1, max 256. -->


Search for this line:
<String Name="HubAddress">&lt;Enter hub address here&gt;</String><!-- Hub address. Min length 1, max 256. -->

And change this:
&lt;Enter hub address here&gt;

To your hub address. For example like that:
<String Name="HubAddress">192.168.0.19</String><!-- Hub address. Min length 1, max 256. -->


To end editing press Esc key on keyboard.

To save file use this:
:w


And to quit editor use this:
:q


8. This part is not needed, but is good to create registered user for yourself.

Open RegisteredUsers.xml in text editor with this command:
vim RegisteredUsers.xml


And edit it similar as Settings.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, save file and quit editor like before with Settings.

9. Now you can run PtokaX.
Change from cfg directory to PtokaX root with this command:
cd ..


And run PtokaX with this command:
./PtokaX

Result should looks like this:

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


abodh84

i wana try it on linux slackware.
wat do u think it will work or not?

PPK

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

Hamachi


P_pan


Psycho_Chihuahua

#6
Quote from: Hamachi on 14 September, 2009, 17:04:57
work the linux whit 64 bit ?

it should, iirc i have/had it running on a 64bit version of debian. anyway gonna give it a shot and i'll let you know afterwards ;)



Edit: yep runs fine on 64bit debian
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

PPK

Quote from: Hamachi on 14 September, 2009, 17:04:57
work the linux whit 64 bit ?
Of course it is working on 64bit. I'm used amd64 version of Debian and Ubuntu for this guide 8)
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall


mixted

well i must say the tutorial doesn't work....
i am using ubuntu 8.10 server and lua 5.1.4 installed from source
while trying to install ptokax 0.4.1.1 i receive this folowing error
mixted@mixted:/home/PtokaX$ sudo make
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/ClientTagManager.cpp -o /home/PtokaX/obj/ClientTagManager.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/colUsers.cpp -o /home/PtokaX/obj/colUsers.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/DcCommands.cpp -o /home/PtokaX/obj/DcCommands.o
/home/PtokaX/src/DcCommands.cpp: In member function ?void cDcCommands::Supports(User*, char*, const uint32_t&)?:
/home/PtokaX/src/DcCommands.cpp:3177: warning: suggest parentheses around comparison in operand of ==
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/DeFlood.cpp -o /home/PtokaX/obj/DeFlood.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/eventqueue.cpp -o /home/PtokaX/obj/eventqueue.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/globalQueue.cpp -o /home/PtokaX/obj/globalQueue.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/hashBanManager.cpp -o /home/PtokaX/obj/hashBanManager.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/hashUsrManager.cpp -o /home/PtokaX/obj/hashUsrManager.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/hashRegManager.cpp -o /home/PtokaX/obj/hashRegManager.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/HubCommands.cpp -o /home/PtokaX/obj/HubCommands.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/IP2Country.cpp -o /home/PtokaX/obj/IP2Country.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/LanguageManager.cpp -o /home/PtokaX/obj/LanguageManager.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/LuaBanManLib.cpp -o /home/PtokaX/obj/LuaBanManLib.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/LuaCoreLib.cpp -o /home/PtokaX/obj/LuaCoreLib.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/LuaIP2CountryLib.cpp -o /home/PtokaX/obj/LuaIP2CountryLib.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/LuaProfManLib.cpp -o /home/PtokaX/obj/LuaProfManLib.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/LuaRegManLib.cpp -o /home/PtokaX/obj/LuaRegManLib.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/LuaScript.cpp -o /home/PtokaX/obj/LuaScript.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/LuaScriptManager.cpp -o /home/PtokaX/obj/LuaScriptManager.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/LuaScriptManLib.cpp -o /home/PtokaX/obj/LuaScriptManLib.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/LuaSetManLib.cpp -o /home/PtokaX/obj/LuaSetManLib.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/LuaTmrManLib.cpp -o /home/PtokaX/obj/LuaTmrManLib.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/LuaUDPDbgLib.cpp -o /home/PtokaX/obj/LuaUDPDbgLib.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/ProfileManager.cpp -o /home/PtokaX/obj/ProfileManager.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/PtokaX.cpp -o /home/PtokaX/obj/PtokaX.o
/home/PtokaX/src/PtokaX.cpp: In function ?int main(int, char**)?:
/home/PtokaX/src/PtokaX.cpp:529: warning: format not a string literal and no format arguments
/home/PtokaX/src/PtokaX.cpp:558: warning: format not a string literal and no format arguments
/home/PtokaX/src/PtokaX.cpp:651: warning: format not a string literal and no format arguments
/home/PtokaX/src/PtokaX.cpp:665: warning: format not a string literal and no format arguments
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/pxstring.cpp -o /home/PtokaX/obj/pxstring.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/RegThread.cpp -o /home/PtokaX/obj/RegThread.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/ResNickManager.cpp -o /home/PtokaX/obj/ResNickManager.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/ServerManager.cpp -o /home/PtokaX/obj/ServerManager.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/ServerThread.cpp -o /home/PtokaX/obj/ServerThread.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/serviceLoop.cpp -o /home/PtokaX/obj/serviceLoop.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/SettingManager.cpp -o /home/PtokaX/obj/SettingManager.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/TextFileManager.cpp -o /home/PtokaX/obj/TextFileManager.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/UdpDebug.cpp -o /home/PtokaX/obj/UdpDebug.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/UDPThread.cpp -o /home/PtokaX/obj/UDPThread.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/User.cpp -o /home/PtokaX/obj/User.o
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/utility.cpp -o /home/PtokaX/obj/utility.o
/home/PtokaX/src/utility.cpp: In function ?void AppendLog(const string&, const bool&)?:
/home/PtokaX/src/utility.cpp:1111: warning: format not a string literal and no format arguments
/home/PtokaX/src/utility.cpp: In function ?void AppendSpecialLog(const string&)?:
/home/PtokaX/src/utility.cpp:1139: warning: format not a string literal and no format arguments
g++ -g -Wall -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1 -c /home/PtokaX/src/ZlibUtility.cpp -o /home/PtokaX/obj/ZlibUtility.o
g++ -lpthread -lz -llua5.1 -lrt -o PtokaX \
        /home/PtokaX/obj/ClientTagManager.o /home/PtokaX/obj/colUsers.o /home/PtokaX/obj/DcCommands.o /home/PtokaX/obj/DeFlood.o /home/PtokaX/obj/eventqueue.o /home/PtokaX/obj/globalQueue.o /home/PtokaX/obj/hashBanManager.o /home/PtokaX/obj/hashUsrManager.o \
        /home/PtokaX/obj/hashRegManager.o /home/PtokaX/obj/HubCommands.o /home/PtokaX/obj/IP2Country.o /home/PtokaX/obj/LanguageManager.o /home/PtokaX/obj/LuaBanManLib.o /home/PtokaX/obj/LuaCoreLib.o /home/PtokaX/obj/LuaIP2CountryLib.o \
        /home/PtokaX/obj/LuaProfManLib.o /home/PtokaX/obj/LuaRegManLib.o /home/PtokaX/obj/LuaScript.o /home/PtokaX/obj/LuaScriptManager.o /home/PtokaX/obj/LuaScriptManLib.o /home/PtokaX/obj/LuaSetManLib.o /home/PtokaX/obj/LuaTmrManLib.o \
        /home/PtokaX/obj/LuaUDPDbgLib.o /home/PtokaX/obj/ProfileManager.o /home/PtokaX/obj/PtokaX.o /home/PtokaX/obj/pxstring.o /home/PtokaX/obj/RegThread.o /home/PtokaX/obj/ResNickManager.o /home/PtokaX/obj/ServerManager.o /home/PtokaX/obj/ServerThread.o \
        /home/PtokaX/obj/serviceLoop.o /home/PtokaX/obj/SettingManager.o /home/PtokaX/obj/TextFileManager.o /home/PtokaX/obj/UdpDebug.o /home/PtokaX/obj/UDPThread.o /home/PtokaX/obj/User.o /home/PtokaX/obj/utility.o /home/PtokaX/obj/ZlibUtility.o \
        /home/PtokaX/tinyxml/tinyxml.a
/usr/bin/ld: cannot find -llua5.1
collect2: ld returned 1 exit status
make: *** [PtokaX] Error 1
mixted@mixted:/home/PtokaX$


also i tried to install ptokax 0.4.1.2 based on this tutorial but i receive the same error.this tutorial should be updated on how to install the latest version

PPK

Quote from: mixted on 10 January, 2010, 15:48:02
well i must say the tutorial doesn't work....
It is working, but because you don't use that tutorial and do things differently...
Quote from: mixted on 10 January, 2010, 15:48:02
and lua 5.1.4 installed from source
it is not working for you :P
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

mixted

well i folowed the tutorial except the part with lua i already had lua installed on the system.could be aded in a future version the posibility to find the lua version an use that?

PPK

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

swee

Is there any way to make PtokaX start automatic  when the computer reboots ?
I am using Debian and havent found any where how to make it start .
When the computer reboots after an power failure. or something else.

I guess there should be an line written somewhere but i havent figured it out yet.

If any one have an suggestion it would be nice.

regards /swee


swee

Thank You the-master

so all I have to type is

update-rc.d servicename defaults

as root ?

Since I followed this guide I have mine PtokaX in root/PtokaX

so it was a nice try

update-rc.d: using dependency based boot sequencing
update-rc.d: error: unable to read /etc/init.d/PtokaX





kind off not so sure on linux commands.
thanks for reply will try

regards /swee

Sketer0070

The PtokaX is running on my Raspberry PI (debian)
But when i changed the file "Settings.xml" to get a vallid name and IP adres (and port) en run the program by typing ./PtokaX
The file "Settings.xml" is changed in the file below.
It's reduced !!!!!

<PtokaX Version="0.4.1.1">
<Booleans/>
<Integers>
<Integer Name="MaxUsersPeak">2</Integer>
</Integers>
<Strings>
<String Name="HubName">Raspberry PI TEST Hub</String>
<String Name="HubAddress">192.168.1.16</String>
<String Name="TCPPorts">1500;411</String>
</Strings>
</PtokaX>

The orignal file contains more information. What is the cause of this problem ? Can someone help me !

Question 2:
How can i'll add other scripts ?
I have a Hub running (PotoaX 0.3.6 under windows) Can i use the same lua scripts in debian ? And how do i do it ?

Hope to hear a answer soon. Thanks

PPK

PtokaX is saving to Settings.xml only settings that are different from default. That way future PtokaX updates can contains different (better) default settings and they will work automatically for all users who don't change them ::)

Scripts from 0.3.6.0 not working on newer PtokaX versions  ::)
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

Sketer0070

Thanks for your answer.

Is there a Debian version of 3.6.0  ?

PPK

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

SMF spam blocked by CleanTalk