step by step to install mytop???

wazburn

Verified User
Joined
Nov 26, 2011
Messages
70
hi,
I know it would be just easy, but could anyone post the step by step to install my top on centos/directadmin,

I tried following steps I searched here and google but cant make it work.
yum install perl-ExtUtils-MakeMaker
http://help.directadmin.com/item.php?id=211

yum install perl-DBD-MySQL

I also tried these
Code:
Install TermReadKey:

cd /usr/local/src
wget http://search.cpan.org/CPAN/authors/id/J/JS/JSTOWE/TermReadKey-2.30.tar.gz
tar -zxf TermReadKey-2.30.tar.gz
cd TermRead*
perl Makefile.PL
make test
make
make install
cd ..


Now install DBI:

wget http://search.cpan.org/CPAN/authors/id/T/TI/TIMB/DBI-1.48.tar.gz
tar -zxf DBI-1.48.tar.gz
cd DBI*
perl Makefile.PL
make test
make
make install
cd ..

Finally install mytop:

wget http://jeremy.zawodny.com/mysql/mytop/mytop-1.4.tar.gz
tar -zxf mytop-1.4.tar.gz
cd mytop*
perl Makefile.PL
make test
make
make install

Code:
# mytop
install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at (eval 11) line 3.
Perhaps the DBD::mysql perl module hasn't been fully installed,
or perhaps the capitalisation of 'mysql' isn't right.
Available drivers: DBM, ExampleP, File, Gofer, Proxy, Sponge.
at /usr/bin/mytop line 225

I tried the suggestion to install via cpan

no matter what I got errors:
Code:
/usr/bin/perl /usr/share/perl5/ExtUtils/xsubpp  -typemap /usr/share/perl5/ExtUtils/typemap -typemap typemap  DBI.xs > DBI.xsc && mv DBI.xsc DBI.c
make: *** No rule to make target `/usr/lib64/perl5/CORE/thrdvar.h', needed by `DBI.o'.  Stop.



thanks
 
In our Knowledge Base:

yum install perl-DBD-MySQL

cpan


cpan> install Term::ReadKey

under admin account:
nano /home/admin/.mytop

insert into /home/admin/.mytop:
user=da_admin
pass=<da_admin_password> / or other user
host=localhost
db=mysql
delay=1
port=3306
socket=
batchmode=0
header=1
color=1
idle=1


Get da_admin password under:
/usr/local/directadmin/conf/mysql.conf

Should work. Let me know :)
 
Last edited:
insert into /home/admin/.mytop:
user=da_admin
pass=<da_admin_password> / or other user
host=localhost
db=mysql
delay=1
port=3306
socket=
batchmode=0
header=1
color=1
idle=1


Get da_admin password under:
/usr/local/directadmin/conf/mysql.conf

Should work. Let me know :)


thanks, were almost there ACC!

just a little more prob,

I followed your nano #/home/admin/.mytop

this is my .mytop
user=da_admin
pass=<I put here the actual password from mysql.conf>
host=localhost
db=mysql
delay=1
port=3306
socket=
batchmode=0
header=1
color=1
idle=1

the actual error message:
[root@server /]# mytop
Cannot connect to MySQL server. Please check the:

* database you specified "" (default is "test")
* username you specified "root" (default is "root")
* password you specified "" (default is "")
* hostname you specified "localhost" (default is "localhost")
* port you specified "3306" (default is 3306)
* socket you specified "" (default is "")

The options my be specified on the command-line or in a ~/.mytop
config file. See the manual (perldoc mytop) for details.

Here's the exact error from DBI. It might help you debug:

Access denied for user 'root'@'localhost' (using password: NO)
 
GOT IT!

Instead of inserting into /home/admin/.mytop

I edit the file /usr/bin/mytop

my %config = (
delay => 5,
host => 'localhost',
db => 'mysql',
user => '<user from mysql.conf>',
pass => '<password from mysql.conf>',


Then, #mytop, there it is!


Thanks for the help Man!
 
Your better to just use prompt for password. Putting any passwords in a file is very insecure.
 
So, editing the /usr/bin/mytop file will let every user to log as da_admin user.. this is a security risk i suppose.. and a big one...

Regards
 
So, editing the /usr/bin/mytop file will let every user to log as da_admin user.. this is a security risk i suppose.. and a big one...

Regards


not da_admin user tho, but root, they cant mytop if they dont know the root pass.
 
so mytop is only executable by root?

Well.. i still cant see a good reason to put the data in the executable..

hmnnn all admin can mytop tho, if i do not edit the /usr/bin/mytop file it keeps asking for root/da_admin password therefore cannot do mytop, even I have .mytop in /root and /admin

It just seems to read the /usr/bin/mytop file all the time.
 
Ofc it "read" that file.. that is the executable one! well.. i think you are on a security hole here... if you run mytop as root the file must be in /root, for every other user must be in /home/USERNAME/

Now, every user will see the mytop status for root user, so, they would be able to see other db_name and, maybe (with a little work/hack) find out you mysql root password.

Regards
 
Ofc it "read" that file.. that is the executable one! well.. i think you are on a security hole here... if you run mytop as root the file must be in /root, for every other user must be in /home/USERNAME/

Now, every user will see the mytop status for root user, so, they would be able to see other db_name and, maybe (with a little work/hack) find out you mysql root password.

Regards


im trying to find a way to make it only run by root, but it just wont work, these are the things I tried so far.

I create a file .mytop in /root with lines. (I temporarily renamed /usr/bin/mytop to mytopOLD):

user=da_admin
pass=<I put here the actual password from mysql.conf>
host=localhost
db=mysql
delay=1
port=3306
socket=
batchmode=0
header=1
color=1
idle=1

Then I #mytop
error: no command file found -something like that

I copy the file /usr/bin/mytop to root/
Then I #mytop
error: no command file found -something like that


The command "mytop" seems to only look at /usr/bin/ directory no matter what.

Any workaround??
 
You dont have to move the binary file.

here is my mytop file:

Code:
>cat /root/.mytop
user=MYUSER
pass=MYPASS
host=localhost
db=mysql
delay=1
port=3306
socket=
batchmode=0
header=1
color=1
idle=1
 
You dont have to move the binary file.

here is my mytop file:

followed your instruction.

with /usr/bin/mytop

I create a file /root/.mytop

>cat /root/.mytop
user=da_admin <<if I use root and root password here it wont work
pass=password from mysql.conf
host=localhost
db=mysql
delay=1
port=3306
socket=
batchmode=0
header=1
color=1
idle=1


login as root then mytop=works fine
login as other user with shell then $mytop= still works ---- suppose to be it wont work coz I didnt login as root, right?

then I tried this:

I rename /usr/bin/mytop > /usr/bin/mytopOLD

did

[root@server ~]# mytop
-bash: mytop: command not found

[user@server ~]$ mytop
-bash: mytop: command not found



hmnnn??? strange
I only wanted to use mytop as root to see mysql queries, i dont want other admin with shell privilege to use mytop.
 
so, you dont need to rename the binary.. you need to change permission for it

Code:
chown root:root /usr/bin/mytop
chmod 700 /usr/bin/mytop

Regards
 
GOOOT ITTTTTT!!

to make it run as root only, DO NOT add user and pass in /usr/bin/mytop leave it blank.

then create /root/.mytop file

>cat /root/.mytop
user=da_admin
pass=password from mysql.conf
host=localhost
db=mysql
delay=1
port=3306
socket=
batchmode=0
header=1
color=1
idle=1



otherwise if u want mytop to used by all admin with shell privilege then fill user and pass in /usr/bin/mytop


Thanks sellerone for the help!!!!!
 
Last edited:
Back
Top