Archive for July, 2010

SBDavid

How to install Softaculous in WHM

How to install Softaculous in WHM

1) In order to install Softaculous ensure ionCube Loaders are enabled.

If it is not enabled you can go to WHM >> Tweak Settings >>PHP >> Select ioncube from Loader to use for internal cPanel PHP

2) Now Login to the server as root.

3)Go to the directory /usr/local/cpanel/whostmgr/docroot/cgi

cd /usr/local/cpanel/whostmgr/docroot/cgi

4) Download Softaculous

wget -N http://www.softaculous.com/ins/addon_softaculous.php

5) Change the permissions to 755

chmod 755 addon_softaculous.php

That’s for the command line.

Now login to WHM

6) Go to WHM > Plugins> Softaculous – Instant Installs

SBDavid

Reset a lost MySQL root password

MySQL - reset a lost MySQL root password

The MySQL root password allows full access to the MySQL database and allows for all actions to be undertaken including creating new users, new databases, setting access rules and so on.

The first thing to do is stop MySQL.

sudo /etc/init.d/mysql stop

Now start mysql in safe mode.

Next we need to start MySQL in safe mode - that is to say, we will start MySQL but skip the user privileges table.

sudo mysqld_safe –skip-grant-tables &

*ampersand (&) at the end of the command is required.

Login

mysql -u root

Next, instruct MySQL which database to use:

use mysql;

Reset password
Enter the new password for the root user as follows:

update user set password=PASSWORD(”mynewpassword”) where User=’root’;

and finally, flush the privileges and then stop and start mysql.

flush privileges;

Using netstat to find largest number of established connections

To find out the largest number of established connections you can simply use something like

netstat -an | grep ‘ESTABLISHED’ | awk ‘{print $4}’ | cut -d: -f1 | uniq -c | sort -rn | head -n 1
3 192.168.1.2

To see the list of the top 10

netstat -an | grep ‘ESTABLISHED’ | awk ‘{print $4}’ | cut -d: -f1 | uniq -c | sort -rn | head -n 10
2 192.168.1.2

How to view all

netstat -an | grep ‘ESTABLISHED’ | awk ‘{print $4}’ | cut -d: -f1 | uniq -c | sort -rn
3 192.168.1.2

You can also view all but have pages so you can view each in detail

netstat -an | grep ‘ESTABLISHED’ | awk ‘{print $4}’ | cut -d: -f1 | uniq -c | sort -rn | more
8 192.168.1.2

You can show the port with:

netstat -an | grep ‘ESTABLISHED’ | awk ‘{print $4}’ | uniq -c | sort -rn
1 192.168.1.2:58632
1 192.168.1.2:58631
1 192.168.1.2:58629
1 192.168.1.2:58628
1 192.168.1.2:58627
1 192.168.1.2:58613
1 192.168.1.2:55154
1 192.168.1.2:48673

Kill all processes matching certain strings.

This guide will help you to know how to kill all processes matching certain strings, for our example we will use httpd.

One very simple method is killall, such as

killall -9 httpd

If that doesn’t work you can go through the process list and kill -9 the pids by using the following,

kill -9 $(ps aux | grep -v grep | grep httpd | awk ‘{print $2}’)

Where httpd is the string.

cPanel FTP and MySQL General Information and Error Log files

FTP: Logins and General Errors.

/var/log/messages

General information and login attempts are logged here

FTP Transactions

/var/log/xferlog

This is a symbolic link in most cases to /usr/local/apache/domlogs/ftpxferlog, which contains a history ofthe transactions made by FTP users.

MySQL: General Information and Errors

/var/lib/mysql/$(hostname).err

This path could vary, but is generally located in /var/lib/mysql. Could also be located at /var/log/mysqld.log

« Prev - Next »