Tuesday, 25 August 2009

How to change the smtp port to 26 in plesk

a) Add the following to /etc/services smtp-26 26/tcp mail


b) Copy /etc/xinetd.d/smtp_psa to /etc/xinetd.d/smtp_psa-26


c) Change the first line from service smtp to service smtp-26


d) service  xinetd restart

Installing Apache, MySQL and PHP on a Linux Server in Under 10 Minutes

Apache, MySql and PHP; these three products are open source programs available for use on most well known operating systems. In this article I will explain how you can install Apache, MySql and PHP on a Linux box using yum in under 10 minutes.


1 – Checking and Removing Any Existing Installations of the 3 of Them


Run the following command to make sure that any existing installations of Apache, MySql or PHP are removed:




yum -y remove httpd mysqld mysql-server php



2 – Installing Apache


Run the following to install the Apache web server:




yum -y install httpd



3 – Installing MySql Server


Run the following command to install MySql Server:




yum -y install mysqld mysql-server



4 – Install PHP


Run the following command to install PHP:




yum -y install php php-mysql



5 – Installing PHP Libraries


PHP has many different libraries and add-ons which you want or need to utilize; in your case we want to install the PHP GD image library and the PHP IMAP library, to do this we’ll be using the following command:




yum -y install php-gd php-imap



Thats it – you have now AMP’d a server! All you need to do now is start the individual services, to do this run the following commands (individually):




service httpd start


service mysqld start



PHP will be seen by Apache as a library and so does not need to be started.

Enabling Spell Checker in Horde Webmail

One of the many unique features about Horde webmail is it’s spell checker facility. However, the use of this requires that certain components be installed. To install these follow these instructions:


1) Login to your Linux box via SSH as root.


2) Install aspell by running the following command:




yum -y install aspell aspell-en-gb



Leave it to install; you shouldn’t need to make any changes to Horde as it should automatically detect the ASPELL installation.

Tweaking cPanel For Lower Memory Consumption

Do you find that your VPS or dedicated machine is regularly running out of memory because of cPanel? The following tutorial will help you overcome this, and help you to make your machine run faster.


Stopping SpamAssassin


This program isn’t overly important to the stopping of spam. To turn it off do the following:


Go to WHM > Server Configuration > Tweak Settings > Disable Spamd


And:


Go to WHM > Service Manager > Disable Spamd


Stopping Mailman


If you or none of your customers aren’t running any mail listings through cPanel, it would be a good idea to disable Mailman.


Go to WHM > Server Configuration > Tweak Settings > Disable Mailman


Never Use Tomcat on a VPS


Never run TomCat on a VPS because of it’s high RAM needs.


Disable CatchAll


If you’re undergoing a mail attack, catch all can use up many resources + storage. To disable do the following:


Go to WHM > Server Configuration > Tweak Settings > Change to :fail:


Tweak Apache


Apache can be quite a memory consuming monster on it’s own. To tweak, do the following:


vi /etc/httpd/conf/httpd.conf


(Press ’shift’ and ‘i’ to enable inserting/editing.)


Change the following settings:



MinSpareServers 2
MaxSpareServers 5

StartServers 3


Save the file by pressing ‘esc’, then type ‘:wq:’, then hit return.


After that, restart Apache: /etc/init.d/httpd restart


All that should reduce your memory useage by a large amount.

Linux: Command line BitTorrent client

BitTorrent is the name of a peer-to-peer (P2P) file distribution protocol, and of a free software implementation of that protocol.

The BitTorrent client is a computer program developed by BitTorrent, Inc. used to download and upload files via the BitTorrent protocol. You can download python based command line BitTorrent client download for Linux/BSD/Mac OS X/UNIX link oses. This is quite useful, if you would like to download file remotely over SSH session. bittorrent.com offers bittorrent client in .deb (Debian Linux) or rpm (RedHat/Fedora Core/CentOS Linux) file formats.

To use the bittorrent in command line one you need to use command bittorrent-console or bittorrent-curses (see below for examples).

Step # 1: Find Python version



Make sure you download file according to your python version. Type following command to find out python version:

$ python -V

Output: Python 2.4.2

Step # 2: Download bittorrent client



Use wget to download bittorrent client
Download bittorrent client for Debian Linux:

# wget http://download.bittorrent.com/dl/bittorrent_5.0.3_python2.4.deb
Download bittorrent clientFor Red Hat / Fedora Core / Cent OS Linux


# wget http://download.bittorrent.com/dl/BitTorrent-5.0.3-1-

Python2.4.noarch.rpm

Step # 3: Linux Install BitTorrent client



First login as a root user (use su or sudo command). If you are using Debian Linux, use dpkg command install bittorrent client

# dpkg -i bittorrent_5.0.3_python2.4.deb

If you are using Red Hat / Fedora Core /Cent OS Linux, use rpm command install bittorrent client:

# rpm -ivh BitTorrent-5.0.3-1-Python2.4.noarch.rpm

Step # 4: Start using or downloading files



Use bittorrent client as follows:

# /usr/bin/bittorrent-curses 'http://www.some.org/DesktopBSD.iso.torrent'
OR
# bittorrent-curses 'http://www.some.org/DesktopBSD.iso.torrent'
OR
# /usr/bin/bittorrent-curses '/path/to/file.torrent'


You can try out pure console based client bittorrent-console instead of curses based client:
$ bittorrent-console '/path/to/file.torrent'
$ /usr/bin/bittorrent-console 'http://www.some.org/DesktopBSD.iso.torrent'

Tips about using and Troubleshooting BitTorrent client

(A) If you get [Errno 2] No such file or directory, you need to use wget or lynx command to download .torrent file to local hard drive first. For example

$ bittorrent-curses 'http://www.mininova.org/get/some_file[222].torrent'

First download download .torrent file using any one of the following method:

$ lynx 'http://www.mininova.org/get/some_file[222].torrent'

When prompted save .torrent file to a hard-disk. Another option is use wget to download .torrent file:

$ wget 'http://www.mininova.org/get/some_file[222].torrent'

Now start the downloading as follows:

$ bittorrent-curses 'some_file[222].torrent'

(B) If you get error 'This seems to be an old Python version which does not support detecting the filesystem encoding. Assuming 'ascii', then upgrade your python version to 2.4.xx:

Debian user upgrade python version using apt-get command:
# apt-get update
# apt-get install python2.4


Red Hat Linux user try out:
# up2date python2.4
Fedora Linux user try out:
# yum install python2.4

Remember if you have both versions (python v2.3 and v2.4) installed, you need to run bittorent client as follows:

$ python2.4 /usr/bin/bittorrent-curses '/path/to/file.torrent'

Command line BitTorrent client should work with other UNIX like operating systems such as FreeBSD/OpenBSD/Solaris etc (as long as you have Python it should work).

Roundcube installation on cPanel linux server

Login to the server as root and run the following:



cd /usr/local/cpanel/base
wget  http://dfn.dl.sourceforge.net/sourceforge/roundcubemail/roundcubemail-0.1.1.tar.gz
tar -zxvf roundcubemail-0.1.1.tar.gz
rm -rf roundcubemail-0.1.1.tar.gz
mv -f roundcubemail-0.1.1 roundcube
chown root.root -R roundcube
cd roundcube
chmod -R 777 temp
chmod -R 777 logs
mysql -e “CREATE DATABASE roundcube;” -pDATABASEPASSWORD
mysql -e “use roundcube; source SQL/mysql.initial.sql;” -pDATABASEPASSWORD
cd config
mv db.inc.php.dist db.inc.php
mv main.inc.php.dist main.inc.php

Note:Replace DATABASEPASSWORD with your server MySQL root password


2-Open db.inc.php with Pico


pico db.inc.php


Find this line in the file using (Ctrl+w)


$rcmail_config['db_dsnw'] = ‘mysql://roundcube:pass@localhost/roundcubemail’;


Replace the line above with the following line:


$rcmail_config['db_dsnw'] = ‘mysql://root:DATABASEPASSWORD@localhost/roundcube’;


Note:Replace DATABASEPASSWORD with MySQL server root password


save and close.


3-Open main.inc.php with pico


pico main.inc.php


find the following lines in the file and edit their values as the following:


$rcmail_config['enable_caching'] = FALSE;
$rcmail_config['default_host'] = ‘localhost’;
$rcmail_config['enable_spellcheck'] = FALSE;

Save and close



4-There are some changes need to be done in index.php file, instead of telling you what to find, add or remove, I have made a ready to made index.php file for you to use and you are done.


You can get the index.php file by running the following command lines:


cd /usr/local/cpanel/base/roundcube
wget http://www.2mhostblog.com/rc.1.1.tar
rm -f index.php
tar -xf rc.1.1.tar
rm -f rc.1.1.tar


5-Finally, restart your cpanel service



#  service cpanel restart

RSYNC

rsync utility is used for synchronising files one of the major adavantage of rsync is that rsync can preserve permissions and ownership information, copy symbolic links, and generally is designed to intelligently handle your files

The basic syntax for rsync is simple enough -- just run


rsync [options] source destination

If you want to rsync the contents from /home/mabin/ to /var/www/html/ the command 

rsync -a /home/mabin /var/www/html

Whe doing rsync there is a big meaning in the ending '/' because if I rsync /home/mabin/ then only the contents inside the folder mabin will be copied.....but if didn't used the '/' ie /home/mabin then the entire directory will be taken ..that is a directory named mabin will be created at the destination

some switches with rsync
-----------------------------
-a --> archive option, which actually combines several rsync options. It combines the recursive and copy symlinks options, preserves group and owner, and generally makes rsync suitable for making archive copies. Note that it doesn't preserve hardlinks

-H --> Copies hard link

-v --> verbose mode

-z --> Compress option, will compress the data during transfer

--delete --> For deleting the already transferred data from source (a dangerous option, try to avoid it)

--exclude=".*/" --> To avoid copying hidden files. With this option you can avoid copying any particular file( If you dont want to copy .php files then pot it like this --exclude="*.php/"

sample command for local copying

rsync -avh /home/mabin/ /var/www/html

Rsync for remote copying

rsync -avhe ssh /home/user/dir/
user@remote.host.com:dir/


If you want to know how fast the transfer is going use the --progress option

rsync --progress -avhe ssh /home/user/dir/ user@remote.host.com:dir/