Archive for the ‘Direct Admin’ Category

Command to know the performance of your HardDisk.

Friday, April 27th, 2007

Here you go –

hdparm -Tt /dev/sda

Note: The command “hdparm” isn’t always compatible with hardware raid (3ware SATA or Dell SCSI PERC 320/DC adapters)

Banning / Unbanning / Listing ips.

Friday, April 27th, 2007

Banning an IP
iptables -I INPUT -s [ipaddress] -j DROP

Unbanning and IP
iptables -I INPUT -s [ipaddress] -j ACCEPT

Listing the last five ip’s with the most connections
netstat -atnp -A inet | grep “:80″ | awk -F ” ” ‘{print $5} ‘ | awk -F “:” ‘{print $1}’ | sort | uniq -c | sort -nr | head -5

Listing total connections
netstat -nap | grep ESTABLISHED | wc -l
netstat -nap | grep SYN | wc -l
netstat -nap | grep TIME_WAIT | wc -l

———-

If Apf firewall is installed on server then –

Accept IP –
apf -a [ip address]

Decline IP –

apf -d [ip address]

———–
IF shorewall is installed

Decline Ip –

shorewall drop [ip address]

How to increase SquirrelMail maximum attachment size from 2MB.

Friday, April 27th, 2007

SquirrelMail is written in PHP, the max attachment size for webmail is inherited from the “upload_max_filesize” value set forth in php.ini

Here you go..

1, Locate your php.ini.
2, Open it in a text editor
3, Search for upload_max_filesize.
4, Change 2M to something else, for example 5M.
5, If the upload_max_filesize is larger than post_max_size, you must increase post_max_size so that it’s bigger than upload_max_size
6, If the value of post_max_size is larger than memory_limit, you must increase memory_limit so that it’s larger than post_max_size.
7, Save your changes to the file.
8, Restart your web server.

Note 1:
There’s no documented max upload size.

Note 2:
If uploading the file is slow, you may have to increase the max_execution_time so that the script does not terminate before the entire file is uploaded.

Thank you :)

What is Installatron ?

Thursday, April 26th, 2007

Installatron is a state-of-the-art auto-installer plugin for the DirectAdmin and cPanel, and Plesk Reloaded server control panels.

Once installed on a DirectAdmin/cPanel/Plesk server, your users are able to install, manage, and upgrade a growing list of web scripts at the click of a button.

Installatron can also be used to install scripts from CLI/shell, allowing newly created hosting accounts to be pre-populated with software. It is also possible to create your own installers and customize the official installers.

How to install Installatron ?

On DirectAdmin Server

Increase the DirectAdmin timeout value:

Login to DirectAdmin using an admin level account.
Click Administrator Settings (available on the Admin Level page).
Change the Timeout (Seconds) value to ‘300′.

Now, to install Instrallatron:

Return to the Admin Level page in DirectAdmin.
Click the Plugin Manager tool.
Copy and paste this URL into the Url field:

http://www.installatron.com/iTron.tar.gz

Enter your DirectAdmin password in the Password: field.
Click Add Plugin.

The installation process can take a while. Do not reclick ‘Add Plugin’.

If you experience any errors, consult the troubleshooting guide.

Installatron is now installed and ready to use.

You will find the “Installatron Admin” tool added to the DirectAdmin Admin Level and Reseller Level pages, and the “Installatron” tool added to all User Level pages.

On cPanel Server

Disable IXED & Enable API
Disable cPanel’s IXED loaders and enable the plugin API:

Click ‘Server Configuration’ in WHM.
Click ‘Tweak Settings’.
In the ‘Software’ section, set ‘Loader to use for internal cPanel PHP’ to None.
In the ‘System’ section, enable ‘Allow cpanel and admin binaries to be run from other applications’.
Save.

Now, to install Instrallatron, run these commands as ROOT:

wget http://files.installatron.com/cp_installer.sh
chmod 755 cp_installer.sh
./cp_installer.sh

Installatron is now installed and ready to use.

The installatron tool will be available from the main tool list in cPanel.

On Plesk Reloaded Server

Install Instrallatron, run these commands as ROOT:

wget http://files.installatron.com/psa_installer.sh
chmod 755 psa_installer.sh
./psa_installer.sh

Installatron is now installed and ready to use.

Users will find the Installatron tool added to Plesk when they log in.

For more details please visit http://www.installatron.com/

Thank You :)

How to catch spammer using simple command..

Monday, April 23rd, 2007

Follow this —

1. Open exim.conf
pico /etc/exim.conf

2) Find this;
Ctrl + W: hostlist auth_relay_hosts = *

#########################
Runtime configuration file for Exim #
#########################

3) After hostlist auth_relay_hosts = *

add the following

log_selector = +address_rewrite +all_parents +arguments +connection_reject +delay_delivery +delivery_size +dnslist_defer +incoming_interface +incoming_port +lost_incoming_connection +queue_run +received_sender +received_recipients +retry_defer +sender_on_delivery +size_reject +skip_delivery +smtp_confirmation +smtp_connection +smtp_protocol_error +smtp_syntax_error +subject +tls_cipher +tls_peerdn

4) The final result should look like this

hostlist auth_relay_hosts = *

log_selector = +address_rewrite +all_parents +arguments +connection_reject +delay_delivery +delivery_size +dnslist_defer +incoming_interface +incoming_port +lost_incoming_connection +queue_run +received_sender +received_recipients +retry_defer +sender_on_delivery +size_reject +skip_delivery +smtp_confirmation +smtp_connection +smtp_protocol_error +smtp_syntax_error +subject +tls_cipher +tls_peerdn

#######################################
# Runtime configuration file for Exim #
#######################################

5) Save and restart exim DONE!
ctrl + X then Y
/etc/init.d/exim restart

===========================================

Use this command –

grep cwd=\/home\/ /var/log/exim_mainlog| cut -d’ ‘ -f3 | sort -n | uniq -c

This will show you exact number of emails send by particular user..

What is Pear ?

Monday, April 23rd, 2007

PEAR Is short for ‘PHP Extension and Application Repository’

PEAR is having it’s primary goal to become a repository for PHP extensions and library code. The most important goal of the PEAR project is to try to define standard coding packages that can be used be developers directoly and it is re-usable coding.
Each package is a seperate project and is having a diffreent developer team.

Packages are in the gzipped tar files with a description file inside, and installed on your server using the PEAR installer.

You can install any pear package as
———–
pear install pear-package-name
———–

You can check all the PEAR packages that are available with
————
pear list-all
————

You can check installed PEAR packages on your server as
————
pear list
————

How to Optimize MySQL on DirectAdmin Server

Sunday, April 22nd, 2007

vi /etc/my.cnf [ENTER]
Press ‘i’ to enter insert mode, then paste:

[mysqld]
skip-locking
skip-innodb
query_cache_limit=1M
query_cache_size=32M
query_cache_type=1
max_connections=500
interactive_timeout=100
wait_timeout=100
connect_timeout=10
thread_cache_size=128
key_buffer=16M
join_buffer=1M
max_allowed_packet=16M
table_cache=1024
record_buffer=1M
sort_buffer_size=2M
read_buffer_size=2M
max_connect_errors=10
# Try number of CPU’s*2 for thread_concurrency
thread_concurrency=2
myisam_sort_buffer_size=64M
log-bin
server-id=1

[safe_mysqld]
err-log=/var/log/mysqld.log
open_files_limit=8192

[mysqldump]
quick
max_allowed_packet=16M

[mysql]
no-auto-rehash
#safe-updates

[isamchk]
key_buffer=64M
sort_buffer=64M
read_buffer=16M
write_buffer=16M

[myisamchk]
key_buffer=64M
sort_buffer=64M
read_buffer=16M
write_buffer=16M

[mysqlhotcopy]
interactive-timeout
Press ctrl-c to exit insert mode. Then press shift-Z shift-Z to save and quit. Restart mysqld:
Redhat:

/sbin/service mysqld restart

FreeBSD:

/usr/local/etc/rc.d/mysqld restart

Note that this guide is only for MySQL 4. There is a default my.cnf that comes with mysql that will work fine

cp -f /usr/share/mysql/my-huge.cnf /etc/my.cnf

Updating and Compiling Apache and PHP on DirectAdmin Server

Sunday, April 22nd, 2007

To update and compile everything, run the follwing:

cd /usr/local/directadmin/customapache
./build clean
rm -f configure.*
./build update
./build all
If you’re running apache 2.0 use this instead:

cd /usr/local/directadmin/customapache
./build clean
rm -f configure.*
./build update
./build update_data_ap2
./build apache_2
./buld php_ap2 n
./build mod_perl_ap2
Once the update has completed, you’ll need to restart apache:

RedHat:

/sbin/service httpd restart

FreeBSD:

/usr/local/etc/rc.d/httpd restart

Debian:

/etc/init.d/httpd restart

semget: No space left on device

Sunday, April 22nd, 2007

This relates to semaphores on your system (you’ve run out). Run the following to clear them out:

ipcs | grep apache | awk ‘{print $2}’ > sem.txt
for i in `cat sem.txt`; do { ipcrm -s $i; }; done;

cgi files generate Internal Server Error

Sunday, April 22nd, 2007

This means that the cgi script did not execute properly. There are several causes that can generate this error so a few things would need to be checked.

1) check the /var/log/httpd/suexec_log. It contains any errors that would be as a result of not having correct permissions on the file. The file needs to be in a cgi-bin and must have the owner/group as the username who owns the site. If it’s owned by anyone else, it will not run. Also, the script must have execute permission. The most common chmod permission is 755. Go through all directories from the public_html down to the directory the script is in, and make sure they’re all set to 755 (public_html can be 750 *only* if it has a group of apache).

If the suexec_log only shows the script being run, then the cause may be with the script code itself. The easiest way to figure out script coding problems is to first run the script manually from an ssh prompt.

cd /home/username/domains/domain.com/public_html/cgi-bin
./script.cgi
One common error is to use an incorrect interpreter. The 2 most common interpreters are:

#!/usr/bin/perl
and

#!/usr/local/bin/php
This code must appear on the first line of the script. Somtimes a file is uploaded in windows format so the trailing newline (return) character is formed incorrectly and the file would need to be reuploaded in a different format.

Other errors that would be generated when running the script manually from ssh would be missing perl modules, in which case you’ll need to install them yourself. Cpan is the easiest method to install new perl modules, eg:

perl -e shell -MCPAN
install Bundle::DBD::mysql