Friday, 19 June 2009

How To Transfer CPanel Accounts

To transfer account you should have root access on both servers. Because to transfer account you need every thing to backup for transfer including Cpanel User / Pass (Same), Website, Database, Emails, Users, Stats etc. . The thing i like about CPanel is it will transfer accounts 100%, you will not miss any single think related to your accounts. This method implies on VPS’s and Dedicated Server where you can access WHM (Web Host Manager) or root shell.

Lets consider we have two servers A and B. Server A is the old server with two accounts and Server B is new server to which we will transfer accounts.

Server A = 192.168.0.1
Server B = 172.20.0.1

1 Transfer using WHM
Login to Server B WHM using following url

http://172.20.0.1:2086

where 2086 is the port on which WHM is running.

In the middle page select Transfer and then on Transfer page select Copy multiple accounts/packages from another server.

It will open new page to put info of the Server through which you are going to transfer i.e Server A.

Remote server type is (WHM version will be auto detected on multi account copies): leave as it is
Remote server address (ip address or FQDN): put server hostname or IP
Remote SSH port: 22 is the default, if you have changed ssh port on old server use that one here.
Do not compress transfers (cPanel 10.8.3+ required on both ends): leave at it is
Turn off SSL (cPanel 11.23.6+ required on both ends): leave at it is
Allow override*: leave at it is
Login as : Choose USER if you have sudo or direct root login are not allowed. Else select ROOT (recommended)
Select authentication method: Choose Password here, if you are using Public Key then you have to upload Key using Security -> Manage SSH Keys to use here.
Root Password: put root password here

After putting all information above click on Fetch Account List. In few second you will see list of accounts from Server A to transfer. Select the account using check boxes to copy, if need to copy all select Select All to check all accounts. When done with select click on Copy. (Beware once you click on Copy dont close browser or click on Back button).

You will see account transfer log on your browser and when finished it will show nice summary about transfer.

2 Transfer using Shell (Command Line)
SSH your Server A using putty from windows and command line from linux.

ssh 192.168.0.1

Now first of all we will create full backup to transfer and all the backups created are placed under /home directory.

2.1 Create One Account Backup
If you wish to backup single account, then execute following command

/scripts/pkgacct cpaneluser

you will find corresponding backup in /home directory named cpmove-cpaneluser*.tar.gz

2.2 Create all Accounts Backup
To create all accounts backup on your server, execute following command

cat /var/cpanel/users | while read a; do
/scripts/pkgacct $a
done

again you will find all accounts backup under /home named cpmove-cpaneluser*.tar.gz

2.3 SCP Backups to New Server
After creating backup you have to transfer all accounts backup to your new server i.e Server B using SCP.

scp cpmove-* root@172.120.0.1:/home

Besure all backups should move to /home directory of new server.

If you have done all accounts backup then you should have to move /var/cpanel/users file for restore on new server i.e Server B in /home directory with name user.txt

scp /var/cpanel/users root@172.120.0.1:/home/user.txt

2.4 Restore Backup
To restore single account backup execute following command.

/scripts/restorepkg cpaneluser

where cpaneluser is of old server and can be found on backup filename after cpmove. i.e

cpmove-cpaneluser*.tar.gz

To restore all accounts

cat /home/user.txt | while read a; do
/scripts/restorepkg $a
done

Now you can List Account in WHM to see all accounts are transferred successfully to your new server and you can login to cpanel accounts of user using same Cpanel user / pass as old server.

Sunday, 14 June 2009

How To Install FFmpeg, Mplayer, Mencoder, FFmpeg-PHP on CentOS 5.x

In this how to we'll describe how to install ffmpeg, mplayer, mencoder, flvtool2, ffmpeg-php with all supported codecs to convert / manipulate videos easily on CentOS 5.x. If you want to run sites like youtube e.g www.indianpad.in, www.danceindiadance.in this howto will help you to install the base for your software. There are many other way to perform this but this works for me, so i want to share. --SR

1 Setting Up RPMForge Respository.


RPMForge repository (http://dag.wieers.com) is the biggest rpm respository for RHEL, CentOS for all versions. To enable RPMForge respository run following command to install all necessary files for getting RPMForge repository. The following command directly install rpm from http://da.wieers.com site.
rpm -Uhvhttp://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

This rpm will add necessary files in our repository configuration and can be viewed at /etc/yum.repos.d/rpmforge.repo

2 Install ffmpeg, mplayer, mencoder with all supported modules.


Now we have rpmforge repository, so we will use yum to install ffmpeg, mplayer, mencoder as well as all dependent software.
yum -y install ffmpeg ffmpeg-devel mplayer mencoder flvtool2

This command will some time to download and install all packages depends on your internet speed.

3 Install FFMPEG-PHP


ffmpeg-php is an extension for PHP that adds an easy to use, object-oriented API for accessing and retrieving information from video and audio files. ffmpeg-devel and php-devel is needed to compile ffmpeg-php from source code. Use following steps to install ffmpeg-php
cd /usr/src
wget http://garr.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.6.0.tbz2
tar jxvf ffmpeg-php-0.6.0.tbz2
cd ffmpeg-php-0.6.0
phpize
./configure
make
make install

It will copy the ffmpeg.so module in php default module location. Now you have to edit php.ini file to enable ffmpeg-php support in it by using ffmpeg.so module.
vi /etc/php.ini

and append following line
extension=ffmpeg.so

Restart apache service to take effect of php.ini
/etc/init.d/httpd restart

Run following command to ffmpeg module listing in php.
php -m | grep ffmpeg

Have a nice streaming. :)

Saturday, 13 June 2009

Simple steps of changing your exim IP

Hey Remeber : You need to set RDNS for the IP then and then Only you can proceed further.

If you are in the danger of getting your main server IP block by SpamCop because you had a few anoying spamers abusing your server then you could simply change your exim mailserver IP to avoid the effect of your main IP beeing blacklisted…………

Below are some simple steps of changing your exim IP

Inside both incoming and outgoing exim mail server you will need to add an interface :
so just edit

pico /etc/exim_outgoing.conf

and

pico /etc/exim.conf

find
remote_smtp:
driver = smtp

and add interface = ip.you.want.to.use

example as shown below:

________________________
remote_smtp:
driver = smtp
interface = 22.22.22.22
_________________________

IP needs to be on server in order for this to work, hopefully this will help :)
BTW: Just a reminder – If there is an exim update when you upgrade your cpanel server you will need to re-enter the interface again

Important Directories In Linux

* /bin - essential UNIX commands such as ls, etc. Should contain all binaries needed to boot the system or run it in single-user mode…………… * /boot - files used during booting and possibly the kernel itself are stored here

* /dev - contains device files for various devices on system

* /etc - files used by subsystems such as networking, NFS, and mail. Includes tables of disks to mount, processes to run on startup, etc.

* /etc/profile.d - contains scripts that are run by /etc/profile upon login.

* /etc/rc.d - contains a number of shell scripts that are run on bootup at different run levels. There is also typically an rc.inet1 script to set up networking (in Slackwar), an rc.modules script to load modular device drivers, and an rc.local script that can be edited to run commands desired by the administrator, along the lines of autoexec.bat in DOS.

* /etc/rc.d/init.d - contains most of the initialization scripts themselves on an rpm-based system.

* /etc/rc.d/rc*.d - where “*” is a number corresponding to the default run level. Contains files for services to be started and stopped at that run level. On rpm-based systems, these files are symbolic links to the initialization scripts themselves, which are in /etc/rc.d/init.d.

* /etc/skel - directory containing several example or skeleton initialization shells. Often contains subdirectories and files used to populate a new user’s home directory.

* /etc/X11 - configuration files for the X Window system

* /home - home directories of individual users

* /lib - standard shared library files

* /lib/modules - modular device driver files, most with .o extensions

* /mnt - typical mount point for many user-mountable devices such as floppy drives, cd-rom readers, etc. Each device is mounted on a subdirectory of /mnt.

* /proc - virtual file system that provides a number of system statistics

* /root - home directory for root

* /sbin - location of binaries used for system administration, configuration, and monitoring

* /tmp - directory specifically designed for programs and users to store temporary files.

* /usr - directory containing a number of subdirectory with programs, libraries, documentation, etc.

* /usr/bin - contains most user commands. Should not contain binaries necessary for booting the system, which go in /bin. The /bin directory is generally located on the same disk partition as /, which is mounted in read-only mode during the boot process. Other filesystems are only mounted at a later stage during startup, so putting binaries essential for boot here is not a good idea.

* /usr/bin/X11 - most often a symbolic link to /usr/X11R6/bin, which contains executable binaries related to the X Window system

* /usr/doc - location of miscellaneous documentation, and the main location of program documentation files under Slackware

* /usr/include - standard location of include files used in C programs such as stdio.h

* /usr/info - primary location of the GNU info system files

* /usr/lib - standard library files such as libc.a. Searched by the linker when programs are compiled.

* /usr/lib/X11 - X Window system distribution

* /usr/local/bin - yet another place to look for comon executables

* /usr/man - location of manual page files

* /usr/sbin - other commands used by superuser for system administration

* /usr/share - contains subdirectories where many installed programs have configuration, setup and auxiliary files

* /usr/share/doc - location of program documentation files under Mandrake and Red Hat

* /usr/src - location of source programs used to build system. Source code for programs of all types are often unpacked in this directory.

* /usr/src/linux - often a symbolic link to a subdirectory whose name corresponds to the exact version of the Linux kernel that is running. Contains the kernel sources.

* /var - administrative files such as log files, used by various utilities

* /var/log/packages - contains files, each of which has detailed information on an installed package in Slackware. The same file can also be found at /var/adm/packages, since the adm subdirectory is a symbolic link to log. Each package file contains a short description plus a list of all installed files.

* /var/log/scripts - package installation scripts in Slackware are stored here. You can inspect these scripts to see what special features are included in individual packages.

* /var/spool - temporary storage for files being printed, mail that has not yet been picked up, etc.

Not able to access VZPP (Virtuozzo Power Panel) for a VE.

Resolution

Make sure that “offline management” for the VE is enabled:

# grep OFFLINE_MANAGEMENT /etc/sysconfig/vz-scripts/VE_ID.conf
OFFLINE_MANAGEMENT="yes"


If “offline management”  is disabled (set to “no”), you have to enable it:

# vzctl set VE_ID --offline_management yes --save

Wednesday, 10 June 2009

Unable login into the domain stats - Plesk

Search for the following entry in the /var/www/vhosts/domainName/conf/httpd.include: (/var/www/vhosts/domainName/conf/httpd.include is actually HTTPD_VHOSTS_D/domainName/conf/httpd.include):

AuthType Basic

AuthName "Domain statistics"

AuthUserFile /var/www/vhosts/domainName/pd/d..httpdocs@plesk-stat

require valid-user

Create the encrypted password using the (htpasswd generator):

http://home.flash.net/cgi-bin/pw.pl

(ex. testUser:sad#^hu78is45tsgf)

OR You can Also generate the encrypted password using the "htpasswd" command:

htpasswd -bdc

(eg. htpasswd -bdc testfile testUser testPass

Adding password for user testabc

# cat testfile

testUser:sad#^hu78is45tsgf

)

Append the obtained entry to the AuthUserFile (Here it is /var/www/vhosts/domainName/pd/d..httpdocs@plesk-stat).

cat >> /var/www/vhosts/domainName/pd/d..httpdocs@plesk-stat

testUser:sad#^hu78is45tsgf

Search for the following entry in the /var/www/vhosts/domainName/conf/httpd.include: (/var/www/vhosts/domainName/conf/httpd.include is actually HTTPD_VHOSTS_D/domainName/conf/httpd.include):
AuthType BasicAuthName "Domain statistics"AuthUserFile /var/www/vhosts/domainName/pd/d..httpdocs@plesk-statrequire valid-user

Create the encrypted password using the (htpasswd generator):http://home.flash.net/cgi-bin/pw.pl(ex. testUser:sad#^hu78is45tsgf)
OR You can Also generate the encrypted password using the "htpasswd" command:htpasswd -bdc(eg. htpasswd -bdc testfile testUser testPassAdding password for user testabc# cat testfiletestUser:sad#^hu78is45tsgf)
Append the obtained entry to the AuthUserFile (Here it is /var/www/vhosts/domainName/pd/d..httpdocs@plesk-stat).cat >> /var/www/vhosts/domainName/pd/d..httpdocs@plesk-stattestUser:sad#^hu78is45tsgf

Changing multiple account ownerships via SSH

How to change the ownership of multiple accounts under /home via SSH? The option in WHM is a bit tedious.

Solution :

To change the ownership of all accounts to the respective user.user :

cd /home
ls -al | grep root

for i in `ls /var/cpanel/users/`; do chown $i:$i /home/$i ; done
for i in `ls /var/cpanel/users/`; do chown -R $i:$i /home/$i/* ; done

Then change the ownership of the individual public_htmls to their respective user.nobody:

for i in `ls /var/cpanel/users/`; do chown $i:nobody /home/$i/public_html ; done

Change the permissions for public_htmls to 750:

for i in `ls /var/cpanel/users/`; do chmod 750 /home/$i/public_html ; done

Fix the permissions for mail to work fine:

/scripts/mailperm

Fix the ownership of /home:

chown root.root /home