Monday, February 23, 2009

Migration

Whm transfer gives bad file descriptor error

During a transfer you may run into the following error:

--------------------------------------------------------------------------------
Connecting to Remote Server Failed: Unable to connect to IP.ADDRESS:22: Bad file descriptor
---------------------------------------------------------------------------------

This error is shown when the server that the copy is running on is unable to connect to the remote SSH server. The most common error is due to a firewall blocking outgoing port 22 on the server. Open up the firewall to allow this and the transfer will go through.
Apf Firewall.
#vi /etc/apf/conf.apf
On the APF firewall add port 22 to EG_TCP_CPORTS if you have EGF set to 1. Then restart apf with apf -r

You have to check port 22 in conf.apf file on both servers source and destination.

Scroll down to the "Common ingress (inbound) TCP ports section. At this point you need to find the correct configuration for your control panel.

----------------------------------------
-----cPanel -----
IG_TCP_CPORTS="20,21,22,25,26,53,80,110,143,443,465,993,995,2082,2083,2086,2087,2095,2096"
IG_UDP_CPORTS="21,53,873"

EGF="1"
EG_TCP_CPORTS="21,22,25,26,27,37,43,53,80,110,113,443,465,873,2089"
EG_UDP_CPORTS="20,21,37,53,873"
--------------------------------------------

Lxadmin

Reset Default Lxadmin Password via commandline/backend

Sometimes when you intially setup Lxadmin, you can have problems resetting it from default. To get around this can you can do the following:
1. Login via SSH to your VPS.
2. Run:

cd /usr/local/lxlabs/lxadmin/httpdocs

3. Then run:
/usr/bin/lphp.exe ../bin/common/resetpassword.php master

phpmyadmin

Maximum execution time of 300 seconds exceeded

If you get following error while uploding large SQL file.

"Fatal error: Maximum execution time of 300 seconds exceeded in /usr/local/cpanel/base/3rdparty/phpMyAdmin/libraries/import/sql.php on line 118"



Then edit config.default.php inside /usr/local/cpanel/base/3rdparty/phpMyAdmin/ and look for this line

$cfg[’ExecTimeLimit’] = 300;

and replace with any larger value

$cfg[’ExecTimeLimit’] = 3600;

htaccess file:

php_value register_globals 0
========================================
DirectoryIndex index.php index.html
=====================================
php_value upload_max_filesize 20M
========================================
php_value display_errors off
========================================

How to redirect a website using .htaccess

RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.mysite.com$
RewriteRule ^(.*)$ http://www.mysite.com/forum/$1 [R=301,L]

Using the above code www.mysite.com will be redirected to www.mysite.com/forum

You can redirect your domain to any other domains.

Restore directadmin data from backup drive

Direct Admin rsync process to restore accounts from backup drive.

#Transfer /home data

rsync -av --progress /backup/root/home /


#Transfer important files from /etc drive.

rsync -av --progress /backup/root/etc/passwd /etc
rsync -av --progress /backup/root/etc/shadow /etc
rsync -av --progress /backup/root/etc/group /etc
rsync -av --progress /backup/root/etc/exim.conf /etc
rsync -av --progress /backup/root/etc/exim.pl /etc
rsync -av --progress /backup/root/etc/system_filter.exim /etc
rsync -av --progress /backup/root/etc/exim.crt /etc
rsync -av --progress /backup/root/etc/exim.key /etc
rsync -av --progress /backup/root/etc/proftpd.conf /etc
rsync -av --progress /backup/root/etc/proftpd.vhosts.conf /etc
rsync -av --progress /backup/root/etc/proftpd.passwd /etc
rsync -av --progress /backup/root/etc/hosts /etc
rsync -av --progress /backup/root/etc/resolve.conf /etc
rsync -av --progress /backup/root/etc/named.conf /etc


rsync -av --progress /backup/root/etc/virtual/domainowners /etc/virtual
rsync -av --progress /backup/root/etc/virtual/domains /etc/virtual
rsync -av --progress /backup/root/etc/virtual/pophosts /etc/virtual


rsync -av --progress /backup/root/etc/virtual/majordomo/* /etc/virtual/majordomo


# Transfer HTTPD and configuration files

rsync -av --progress /backup/root/etc/httpd/conf/httpd.conf /etc/httpd/conf
rsync -av --progress /backup/root/etc/httpd/conf/ips.conf /etc/httpd/conf
rsync -av --progress /backup/root/etc/httpd/conf/ssl.crt /etc/httpd/conf

rsync -av --progress /backup/root/etc/httpd/conf/ssl.key/server.key /etc/httpd/conf/ssl.key


# Transfer logs and databases

rsync -av --progress /backup/root/var/named/* /var/named/
rsync -av --progress /backup/root/var/spool/virtual/* /var/spool/virtual
rsync -av --progress /backup/root/var/spool/mail/* /var/spool/mail
rsync -av --progress /backup/root/var/spool/cron/* /var/spool/cron
rsync -av --progress /backup/root/var/www/* /var/www
rsync -av --progress /backup/root/var/log/* /var/log
rsync -av --progress /backup/root/var/lib/mysql/* /var/lib/mysql

# Transfer frontpage config files

rsync -av --progress /backup/root/usr/local/frontpage/*.cnf /usr/local/frontpage

# Transfer directadmin configuration and user files

rsync -av --progress /backup/root/usr/local/directadmin/* /usr/local/directadmin

Restore cpanel data from backup drive

# /etc User / IP's + passwd files

rsync -av --progress /oldroot/etc/passwd /etc/

rsync -av --progress /oldroot/etc/shadow /etc/

rsync -av --progress /oldroot/etc/group /etc/

rsync -av --progress /oldroot/etc/wwwacct.conf /etc/

rsync -av --progress /oldroot/etc/quota.conf /etc/

rsync -av --progress /oldroot/etc/domainalias /etc/

rsync -av --progress /oldroot/etc/remotedomains /etc/

rsync -av --progress /oldroot/etc/reservedipreasons /etc/

rsync -av --progress /oldroot/etc/reservedips /etc/

rsync -av --progress /oldroot/etc/secondarymx /etc/

rsync -av --progress /oldroot/etc/localdomains /etc/

rsync -av --progress /oldroot/etc/userdomains /etc/

rsync -av --progress /oldroot/etc/valiases /etc/

rsync -av --progress /oldroot/etc/vfilters /etc/

rsync -av --progress /oldroot/etc/vmail /etc/

rsync -av --progress /oldroot/etc/trueuserdomains /etc/

rsync -av --progress /oldroot/etc/ips /etc/

rsync -av --progress /oldroot/etc/domainips /etc/

rsync -av --progress /oldroot/etc/services /etc/



ftpd files

rsync -av --progress /old/etc/sysconfig/pure-ftpd /etc/sysconfig/

rsync -av --progress /old/etc/pure-ftpd.conf /etc/

rsync -av --progress /old/etc/pure-ftpd /etc/

rsync -av --progress /old/etc/proftpd /etc/

rsync -av --progress /old/etc/proftpd.* /etc/

# /var

rsync -av --progress /oldvar/cpanel /var/

rsync -av --progress /oldvar/spool/cron /var/spool/

rsync -av --progress /oldvar/netenberg /var/



# /usr config - 3rdparty

rsync -av --progress /oldusr/share/ssl /usr/share/

rsync -av --progress /oldusr/local/cpanel/3rdparty/mailman /usr/local/cpanel/3rdparty/

rsync -av --progress /oldusr/local/cpanel/base/frontend /usr/local/cpanel/base/



# Apache

rsync -av --progress /oldusr/local/apache/conf /usr/local/apache/

rsync -av --progress /oldusr/local/frontpage /usr/local/



# Mysql config

rsync -av --progress /oldroot/root/.my.cnf /root/

rsync -av --progress /oldroot/etc/my.cnf /etc/



# Named

rsync -av --progress /old/var/named /var/

rsync -av --progress /old/etc/named.conf /etc/

rsync -av --progress /old/etc/rndc.conf /etc/



# Mysql

rsync -av --progress /old/var/lib/mysql /var/lib/




========================
#for RSYNC of home create a sh file add the following lines, execute the file as sh file.sh

for SITE in `ls /old/var/cpanel/users`

do

rsync -av --progress /old/home/$SITE /home/

done
===============
I recomend updating cpanel afterwards:
-----------------------
/scripts/upcp --force
/scripts/updatenow
/scripts/sysup
/scripts/fixeverything
/scripts/exim4
/up2date
--------------------------

Linux Directory structure and basic commands.

Linux Directory Structure
Linux directory hierarchy:
This includes the root directory and all of its subdirectories.
=========================
Table of Contents
============================
Introduction
The Linux directory hierarchy at a glance
Top level directory
Subdirectories
The Linux Filesystem Hierarchy
/
/bin
/boot
/dev
/etc
/home
/lib
/mnt
/lost+found
/opt
/proc
/root
/sbin
/tmp
/usr
/var
========================
Introduction
==================================
In the Linux operating system, all filesystems are contained within one directory hierarchy. The root directory is the top level directory, and all its subdirectories make up the directory hierarchy. This differs to other operating systems such as MS-Windows which applies a separate hierarchy for each device and partition.
=============================================
The Linux directory hierarchy at a glance
The following directories are contained within the structure:
==========================
Top level directory
/
==========================
Subdirectories
==========================
bin sbin lib usr var boot dev etc home mnt proc root tmp lost+found opt

The Linux Filesystem Hierarchy
Listed below are the directories contained within the root filesystem.

/
The Linux filesystem has the root directory at the top of the directory tree. The following list of directories are subdirectories of the root directory. This directory is denoted by the / (pronounced "slash") symbol. To view the list of directories from the root directory, enter the following in the command line:

$ls /
You will see a list of subdirectories outputed to the screen. All these directories are explained below.

/bin
Contains executable programs such as ls and cp. These programs are designed to make the system usable. Programs within /bin are required for system repairing. Some of the files located in the /bin directory include:

Shell programs

* bash
* sh

File manipulation programs

* tar
* echo
* vi
* grep

Process handling programs

* kill
* ps

/boot
Stored in this directory are files that are required for the Linux boot process. Such files include vmlinuz, the Linux kernel file.

/dev
Contains device files required for interfacing with hardware. Devices in UNIX are either block or character devices. Examples of character devices are your keyboard, mouse and serial port. Block devices can include the floppy drive, CD-ROM drive and hard disk. Common files in /dev include:

* psaux (interface to PS/2 mouse)
* modem (interface to modem hardware)
* ttyS0 (first serial port)
* tty0 (first virtual console).

/etc

Contains configuration files which are local to the machine. Programs store configuration files in this directory and these files are referenced when programs are run. Common files or directories found in /etc include:

* /etc/X11/ (the X Window configuration directory)
* profile (system-wide environment configuration file).

/home
Contains user account directories. Each user created by the system administrator will have a subdirectory under /home with the name of the account. This is the default behaviour of Linux systems. E.g. User account for Anna is created, her home directory will be located in /home/anna. All her personal files will reside in this directory. All participants in this class are using the home directories of their respective user accounts. At Computerbank, /home is served via the network, enabling users to access their home directory from any networked machine.

/lib
Contains shared object library files that are necessary to boot the system as well as containing files required by various programs such as rm and ls. This directory also contains modules (located in /lib/modules) which can be loaded into the kernel. Files of interest in /lib include:

* libm.so (shared object file used for math functions)
* libc.so (C programming library used for all system and library calls).
Module files are located in /lib/modules/`uname -r`/kernel/

/mnt
Used for mounting temporary filesystems. When mounting a CD-ROM for instance, the standard mount point location is /mnt/cdrom. On the Debian GNU/Linux systems at Computerbank, the mount point has been changed to /cdrom.

/lost+found
When the filesystem cannot properly identify files, the respective files are placed in this directory. If data appears to have been lost mysteriously, it is a good idea to check in this direetory (or ask your system administrator to check for you).

/opt
Used for storing random data that has no other logical destination.

/proc
Provides information about running processes and the kernel. A directory is provided for each running process. Useful system information such as the amount of Random Access Memory (RAM) available on the system as well as Central Processing Unit (CPU) speed in Megahertz (MHz) can be found within the /proc directory. The following commands will give you this information:

$ cat /proc/cpuinfo - Display CPU information of system

$ cat /proc/meminfo - Display RAM information as well as swap space capacity and usage.

/root
This is the home directory for the super user (root). This directory is not viewable from user accounts. The /root directory usually contains system administration files.

/sbin
Similar to /bin, this directory contains executable programs needed to boot the system, however the programs within /sbin are executed by the root user. Contains system maintenance programs, examples of which are:

* ifconfig (interface configuration, use this command to add or remove a network interface)
* mkfs (make a filesystem on a partition)
* lilo (boot loader software, tells your Master Boot Record (MBR) where to find your operating system(s). Linux Loader (LILO) stores its working files in /boot.

/tmp
This directory is used for temporary storage space. Files within this directory are often cleaned out either at boot time or by a regular job process. The Debian GNU/Linux operating system cleans up the /tmp directory at boot time. An example for using the /tmp directory in Computerbank would be when downloading the OpenOffice deb packages. By downloading these packages into the /tmp directory, the user can be assured the packages will be wiped off the system next time the machine reboots.

/usr
Used to store applications. When installing an application on a Debian GNU/Linux machine, the typical path to install would be /usr/local. You will notice the directory structure within /usr appears similar to the root directory structure. Some directories located within /usr include:

* /usr/doc - Documentation relating to the installed software programs.
* /usr/bin - Executable programs that are not required for booting or repairing the system.
* /usr/local/src - Source code for locally installed applications.

/var
This directory contains files of variable file storage. Files in /var are dynamic and are constantly being written to or changed. Some directories located within /var include:

* /var/spool - files in the print queue
* /var/log - files containing logging information
* /var/run - files containing the process ID's for each current process.
===============================================

Sunday, February 22, 2009

DDOS Attack

First aid for DDOS attack on port 80

We can use the following steps to recover our server from a DDOS attack on the port 80. To do this you must have logged into the server as a root user.

Step 1 : Install/Configure APF firewall
=============================

a) If there are no firewalls installed on the server please install the same,
you will get the steps and directions from the following site.

http://www.webhostgear.com/61.html


b) Turn on the antidos option (USE_AD) in the APF conf file

# vi /etc/apf/conf.apf

USE_AD = 1


Step 2 : Install/Configure mod_evasive (for Apache 1.3x)
=============================


mod_evasive and mod_dosevasive are the same

a) Install mod_evasive

# wget http://www.zdziarski.com/projects/mo..._1.10.1.tar.gz
# tar -xzvf mod_evasive_1.10.1.tar.gz
# cd mod_evasive

# /usr/local/apache/bin/apxs -i -a -c mod_evasive.c
# /etc/init.d/httpd restart


b) Also include the following lines in the apache conf file

# vi /usr/local/apache/conf/httpd.conf

-------------------------------------------------

DOSHashTableSize 3097
DOSPageCount 2
DOSSiteCount 50
DOSPageInterval 1
DOSSiteInterval 1
DOSBlockingPeriod 10

-------------------------------------------------


c) Restart the webserver

# /etc/init.d/httpd restart


Step 3 : Install mod_security
=============================



Normally we can find/install this module from WHM
WHM >> cPanel >> Addon Modules >> Select "modsecurity " >>save



Step 4 : Blocking IPs

a) Find the IPs those have established a connection with the server

(The following command is the better one to get the IPs, as this will sort the IPs
according to the number of connections).

===========================================================================
netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
===========================================================================


b) Block them using IPTABLES

iptables -I INPUT -s 81.134.13.35 -j DROP
service iptables save
service iptables restart

apf -d ip np

c) Block them on APF too

vi /etc/apf/deny_hosts.rules


service apf restart


Step 5 : Optimizing the httpd.conf file
=============================


# vi /usr/local/apache/conf/httpd.conf

Change the bellow options as follows, original values are shown in the
bracket.

MaxKeepAliveRequests 50 (100)
KeepAliveTimeout 60 (30)


Also edit the following options too, according to the situation.

Timeout
KeepAliv
MinSpareServers
MaxSpareServers
MaxClients
=============
Step 6 : Install/Configure 3rd party DDOS prevention tools
=============================

We can also use the most trusting 3rd party script 'DDoS-Deflate' for preventing DDOS attack effectively.
Steps to install this script are as follows.

# wget http://www.inetbase.com/scripts/ddos/install.sh
# sh install.sh

Add the script '/usr/local/ddos/ddos.sh' to cron as follows

# crontab -e

*/5 * * * * /usr/local/ddos/ddos.sh >/dev/null 2>&1





Step 7 : Suspend websites
=============================

Check the bandwidth usage of all the domains and suspend the high bandwidth consuming domains for a while





PERMANENT WAY TO FIX THE DDOS ATTACK
=============================

As we all know the softwares have its own limitations for preventing against DDOS attack, we can follow these steps to cure it permanently.

1. Ask the NOC for attaching Cisco Guard on the server for 24 hours
(Normally this service is free from most NOCs)

2. Attach a hardware firewall for the server



Hope this will help you in such a situation, for more information kindly refer the following URL:
http://forums.cpanel.net/showthread.php?t=66952



kill -9 $(pgrep -u crothers)

Basic Commands for Hardware Node(vz-commands)

These are the commands that you can use while working on a Hardware Node.

* To check all the VPS’s hosted on a Node you need the following command: vzlist -a
* To start a VPS: vzctl start VPS_ID
* To Shutdown or Stop a VPS: vzctl stop VPS_ID
* To check the Status of a VPS: vzctl status VPS_ID
* To stop the VPS Forcefully or Quickly: vzctl stop VPS_ID fast
* To enter a Particular VPS: vzctl enter VPS_ID

Fantastico Installation And Troubleshotting

Fantastico Installation And troubleshotting:
================================
Installation of Fantasico.
====================================
To install fantastico run the following commands and then finish install from WHM.
cd /usr/local/cpanel/whostmgr/docroot/cgi
wget -N http://files.betaservant.com/files/free/fantastico_whm_admin.tgz
tar -xzpf fantastico_whm_admin.tgz
rm -rf fantastico_whm_admin.tgz

Now go to WHM, login as root and follow the link
WHM -> Add-Ons -> Fantastico De Luxe WHM Admin

=====================================================
Here are some common errors and fixes :
=====================================================
(1)
****
If you get following error after installation
"You have a buggy version of wget (wget-1.10.2-7.el5). Before proceeding with installation/upgrade, please see the following page for instructions on how to fix: http://www.netenberg.com/forum/index.php?topic=5430.0"
****
You can use the following commands for this purpose.

For 32-bit:

Code:

rpm -qa wget ;
wget ftp://ftp.funet.fi/pub/mirrors/ftp.redhat.com/pub/fedora/linux/core/5/i386/os/Fedora/RPMS/wget-1.10.2-3.2.1.i386.rpm
chattr -ia /usr/bin/wget
rpm -e wget ;
rpm -ivh --force wget-1.10.2-3.2.1.i386.rpm ;
rpm -qa wget ;



For 64-bit:

Code:

rpm -qa wget ;
wget http://download.fedora.redhat.com/pub/fedora/linux/releases/7/Everything/x86_64/os/Fedora/wget-1.10.2-15.fc7.x86_64.rpm ;
chattr -ia /usr/bin/wget
rpm -e wget ;
rpm -ivh --force wget-1.10.2-15.fc7.x86_64.rpm ;
rpm -qa wget ;
================

Fantastico is not installed at the default location

The error was
--
Fantastico is not installed at the default location
/usr/local/cpanel/3rdparty/fantastico. Either move the Fantastico directory
from it's current location to /usr/local/cpanel/3rdparty/fantastico OR
enable ioncube loaders in WHM -> Tweak settings.
--

Enabling ioncube did not fix it for me. Maybe it will for you. After looking I found cpanel now uses /var/cpanel/3rdparty/bin/php NOT /usr/local/cpanel/3rdparty/bin/php

After doing a php info I saw it did not have a php.ini file in the new location. The fix was:

root@server# ] cp /usr/local/cpanel/3rdparty/etc/php.ini /var/cpanel/3rdparty/etc


Other Possible Fixes

You may want to first try enabling ioncube in WHM->Tweak Settings

Second you may want to try to update fantastico with cd /usr/local/cpanel/whostmgr/docroot/cgi/fantastico/scripts/ ; /usr/local/cpanel/3rdparty/bin/php cron.php

Third you may want to rebuild cpanel's php with /scripts/makecpphp

Fourth you may want to try a cpanel update with /scripts/upcp --force

Cpanel initial setup and hardning

Cpanel initial setup and hardning

From Shell prompt

Applicable : Centos/RedhatEnterprise/FedoraCore

check the hardware

cat /proc/cpuinfo
cat /etc/redhat-release
uname -a
cat /proc/meminfo
==========================

SSH Server Hardening

nano -w /etc/ssh/sshd_config

Uncomment #Protocol 2, 1

Change to Protocol 2

Append these lines to the bottom:

LoginGraceTime 120
IgnoreRhosts yes
X11Forwarding no

/etc/rc.d/init.d/sshd restart

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

cd /etc

mv /etc/host.conf /etc/host.conf.bak

wget http://www.indiageeks.net/myscripts//host.conf

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

mv /etc/sysctl.conf /etc/sysctl.conf.bak

cd /etc

wget http://www.indiageeks.net/myscripts/sysctl.conf

/sbin/sysctl -p

sysctl -w net.ipv4.route.flush=1

/sbin/ifconfig eth0 txqueuelen 1000

echo /dev/null > /proc/sys/kernel/core_pattern

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

cp /etc/fstab /etc/fstab.bak

First check to see that no /tmp partition is present.

df

If no /tmp partition is present, use this guide:

cd /usr

dd if=/dev/zero of=/usr/tmpMnt bs=1024 count=1000000

mke2fs -j /usr/tmpMnt
cd /

cp -R /tmp /tmp_backup

mount -o loop,noexec,nosuid,rw /usr/tmpMnt /tmp

chmod 0777 /tmp

/bin/cp -R /tmp_backup/* /tmp/

rm -rf /tmp_backup

nano -w /etc/fstab

At the bottom add

/usr/tmpMnt /tmp ext3 loop,noexec,nosuid,rw 0 0

If “df” shows a /usr/tmpDSK partition,

Then leave it!

If a standard /tmp partition is already present,

nano -w /etc/fstab

change “defaults” to loop,noexec,nosuid,rw

mount /tmp

/tmp should always have this: loop,noexec,nosuid,rw

/tmp and /var/tmp should be symlinked on EVERY server.

rm -rf /var/tmp

ln -s /tmp /var/tmp

/dev/shm

nano -w /etc/fstab

in /dev/shm line, change 'defaults' to noexec,nosuid

umount /dev/shm

mount /dev/shm

rm -rf /etc/httpd/proxy

rm -rf /var/spool/vbox

mount -o remount,noexec,nosuid /proc

Modify /etc/fstab, add options “noexec,nosuid” to the /proc line:
none /proc proc defaults,noexec,nosuid 0 0

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

php -i | grep php.ini



disable_functions = dl,passthru,proc_open,proc_close,shell_exec,system

/etc/rc.d/init.d/httpd restart

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

Logwatch

cd /root/

wget http://www.indiageeks.net/myscripts//logwatch-7.3.1-1.noarch.rpm

rpm -Uvh logwatch-7.3.1-1.noarch.rpm

rm -rf /etc/logwatch/conf/logwatch.conf

cd /etc/logwatch/conf

wget http://www.indiageeks.net/myscripts//logwatch.conf

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

chmod 750 /usr/bin/GET
chmod 750 /usr/bin/wget
chmod 750 /usr/bin/gcc
chmod 750 /usr/bin/rcp
chmod 750 /usr/bin/lynx
chmod 750 /usr/bin/links
chmod 750 /usr/bin/scp

history -c

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

From WHM:

Tweak Settings (Check all these options)

--------------

Allow Creation of Parked/Addon Domains that are not registered

Prevent users from parking/adding on common internet domains

E-mail users when they have reached 80% of bandwidth

Each domain can send out per hour: 500

Pop 3 in hour: 180

Allow Sharing Nameserver IPs

Use Jailshell as default

Set Default catch-all to FAIL

Delete each domain's access logs after stats run

Things to Uncheck

Boxtrapper

** When adding a new domain, if the domain is already registered, ignore the configured nameservers, and set the NS line to the authoritative (registered) ones.

** FormMail-clone cgi

Change:

The load average above the number of cpus at which logs file processing should be suspended (default 0):

To 10

** Number of minutes between mail server queue runs (default is 60).:

To 180

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

Tweak Security

--------------

open_basedir: Enable php open_basedir

Compilers disable

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

System Health - Background Process Killer

Check all of them

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

Please read carefully and make sure that you are aware of all the commands & settings and their effect.

Friday, February 13, 2009

Cpanel Scripts command

Scripts on Cpanel
/scripts/setupfp5 maindomainnameonly.com Installs FrontPage Extentions
( http://faq.cpanel.net/fp )
/scripts/unsetupfp4 maindomainonly.com Unsinstsalls Extentions
( http://faq.cpanel.net/fp )
/scripts/runweblogs username updates stats for user only
/scripts/runlogsnow activates starts cpanellogd process and starts stats stat log
/scripts/updateuserdomains This will determin if there is any conflicting domain names located in the:
/var/cpanel/users folders files.
/scripts/adddns Add a Dns Entry
/scripts/addfpmail Install Frontpage Mail Exts
/scripts/addservlets Add JavaServlets to an account (jsp plugin required)
/scripts/adduser Add a User
/scripts/admin Run WHM Lite
/scripts/apachelimits Add Rlimits (cpu and mem limits) to apache.
/scripts/dnstransfer Resync with a master DNS Server
/scripts/editquota Edit A User’s Quota
/scripts/finddev Search For Trojans in /dev
/scripts/findtrojans Locate Trojan Horses
Suggest Usage
/scripts/findtrojans > /var/log/trojans
/scripts/fixtrojans /var/log/trojans
/scripts/fixcartwithsuexec Make Interchange work with suexec
/scripts/fixinterchange Fix Most Problems with Interchange
/scripts/fixtrojans Run on a trojans horse file created by findtrojans to remove them




/etc/rc.d/init.d/httpd startssl

Friday, February 6, 2009

SugarCRM Installation

Installing Sugar Suite

The process of installing Sugar Suite is as follows:

  1. Download Sugar Suite files.
  2. Copy the Sugar Suite files to your web server, check and set the dependencies and requirements.
  3. Install Sugar Suite with the Sugar Setup Wizard.
  4. Log into Sugar Suite.

Step 1: Download Sugar Suite Files

Sugar Open Source

Download the latest Sugar Open Source installation package.

  1. Click on the link to the appropriate Full Installation Package to download the installation file.
  2. For MS SQL Server support, be sure to download the installation package for Microsoft.
  3. For past releases, visit the Sugar Open Source Project page.

Sugar Professional and Sugar Enterprise

Visit the SugarCRM Support Portal to download the latest Sugar Professional or Sugar Enterprise installation package.

  1. To download the commercial editions, you must have a valid subscription to the software.
  2. Click on the Download Purchased Software Now link .
  3. If prompted, enter your download key into Download Key field and click Submit.
  4. Click on the package in the Installer section of the latest release to download the installation file.

Step 2. Copy Sugar Suite Files to the Web Server

After you download Sugar Suite, you need to unzip the files and set permissions.

  1. Locate your Web root directory on your Web server. This is the directory on your Web server where publicly accessible files are made available by your Web server. Common locations for the Web root includes:
    1. /var/www/html/ (Linux/Apache)
    2. C:\Inetpub\wwwroot\ (Windows/IIS)
    3. C:\Program Files\Apache Group\Apache\htdocs\ (Windows/Apache)
    4. /Library/Web server/Documents/ (MacOS X/Apache)
  2. Unzip the Sugar Suite zip file into your Web root. A directory is automatically created within Web root.
  3. You can rename this directory at any time.
  4. Set permissions on the Sugar Suite files. The following directories, all subdirectories, and files must be made writable by your Web server user: See the Troubleshooting section below for more details on setting the file permissions.
    1. cache
    2. custom
    3. data
    4. modules
    5. config.php

The system user that your Web server uses to access files in your Web root varies depending on your operating system configuration. Common Web server users include:

  • apache (Linux/Apache)
  • nobody (Linux/Apache)
  • IUSR_computerName (Windows/IIS)

If you are unsure of your Web server user, consult your system administrator.

Step 3. Install Sugar Suite

After you copy the Sugar Suite files into your Web root, you can use the Sugar Setup Wizard. The http:/// on your server corresponds to the Sugar URL that you will use to access the Setup Wizard.

For example: http://localhost/SugarSuite-Full_4.5.0

To install Sugar Suite:

  1. Launch the browser and enter the URL described above. You are redirected to the Sugar Setup Wizard.
  2. Click Start to begin.
    Image:OS_Welcome.png
    Note: At any time prior to accepting the Confirm Setting menu, you can modify any of your settings. To modify any settings, click the Back button.
    Note: For locales that use a character set other than UTF8 or CP1252, you will have to define an export/import character set under System Settings in Sugar Suite. For more information, see the Sugar Open Source Administration Guide.
    The License Acceptance screen displays.
    Image:OS_2_LicAgmt.png
  3. Review the Sugar Public License, check “I Accept”, and click Next.The System Check Acceptance screen displays. Sugar Suite checks for dependencies and system requirements as listed below:
    1. Your database must be configured to work with PHP.
    2. The cURL Library must be included in your PHP installation.
    3. The session_save_path setting defined in your php.ini file. The memory_limit setting value (php.ini file) does not apply to Windows.
      Image:OS_3_SysCheck.png
      If any components are not set correctly or available, its status displays the message in red. Cancel out of the installation and correct the dependency.
  4. If all these checks pass successfully, the installer displays the Next button.Click Next.
    The Database Configuration screen displays. You can also populate the Sugar Suite demo data in this step. If you are installing Sugar Suite with the Sugar Public License (SPL), and if your database server is running on the same machine as your Web server, the host name is typically set to localhost. If you do not have a database name or user name, Sugar Suite allows you to create them at this time. Ensure that the user has administrative privileges.
    The following screenshot illustrates the Database Configuration screen that displays for the SPL license. If you are installing with the SugarCRM Community License (S-CL), in the Host Name field, enter the name of the machine where you installed SQL Express.
    Image:OS_4_DB_Sceen.png
    The following screenshot illustrates the Database Configuration screen that displays for S-CL.
    Image:RC_DB_Screen.gif
  5. Click Next.
    The Site Configuration screen displays. The Site Configuration menu allows you to set options specific to the Sugar installation such as enabling Sugar updates, and setting up advanced site security. The URL setting is your Sugar URL. Normally the default value is used. To customize your session directory, log directory, and application ID, uncheck the advance site security box. A supplemental menu appears below the check box for the advance site security settings.
    Image:OS_5_SiteConfig.png
  6. Set your Sugar Suite URL, administrator password, and other miscellaneous options, and click Next.
    The Locale Settings & Language Pack screen displays.
    Image:OS_6_LocaleSettings.png
  7. Enter the system-wide default settings for the date, time, name, language, and salutation and click Next.
    Note: To change the default language from US English to another language, you must install the appropriate language pack.
    The Confirm Settings screens displays all the configurations that you specified.
  8. Check the settings carefully and click Next.
  9. If you need to change it, click the Back button to navigate to the screen you want.
    Image:OS_7_ConfirmSettings.png
    The Perform Setup screen displays and the installer begins to set up your system.
    Image:OS_8_PerformSetup.png
  10. When the setup is complete, click Next. The Registration screen displays.
    To register your application with SugarCRM, click Send Registration. If you choose not to register at this time, click Finish to proceed to the login screen.

Step 4. Log into Sugar Suite

The Sugar Suite login screen displays. You may now log into Sugar with the admin user name and password you provided in the Setup Wizard. After a successful log in, you can configure users and do other administrative tasks. See the Sugar Open Source Administration Guide for more information.

Ports and Services

Ports and Services :

20 FTP (Consider SFTP over SSH as is more secure than FTP)
21 FTP (Consider SFTP over SSH as is more secure than FTP)
22 SSH (Consider switching SSH to a different, non-standard port for security reasons)
25 SMTP (some ISPs block port 25 so that a mail client cannot reach the mail server to
send mail)
26 SMTP (alternate SMTP port option – see notes for port 25)
37 rdate (needed to retrieve date and time information)
43 whois (part of generic DNS features)
53 bind (DNS)
80 http (Apache / Web)
110 POP3 (Email)
113 ident (authentication)
143 IMAP (Email)
443 https (Web / HTTP over SSL)
465 SMTP (TLS/SSL)
873 rsync (remote sync)
993 (IMAP SSL)
995 (POP3 SSL)
2083 cPanel (SSL encrypted)
2087 WHM (SSL encrypted)
2089 Licensing (Must be open to contact license server)
2096 Webmail (Horde, Squirrelmail)
3306 MySQL (MySQL remote connections)

CRELoaded Installation

First, please download the CRELoaded files from CREloaded Projects Downloads and unzip it.

wget http://www.creloaded.com/main/products/shoppingcarts/creloaded/

You should then run the CRELoaded installation script from your domain - the URL you need to access would be

youdomain.com/pathtocatalog/install/index.php.

Please, replace youdomain.com with the domain name you actually have and the '/pathtocatalog' with the name of the folder where CRELoaded is installed. If you have installed CREloaded in your main folder, please, use simply

youdomain.com/install/index.php

During the installation process, please reply to all the questions on the installation script and once you are ready with them, the installation of CRELoaded 6.x will be finished.

In order to access the cart's administration tool, please login to Administration section with:

username: admin@localhost.com
password: Admin
Please, set your own user ID and password in order to protect your administration tools. With the help of the store administration tools -> configuration menu you can determine the store configuration settings. Then you can assign shipping modules, tax zones, payment modules and order total sort order. Well done! Now you have finished the installation process and you can now enjoy your CRE Loaded shopping cart.

That's it!!!

Vtiger Installation

How to install Vtiger CRM

Get a FREE Vtiger installation with SiteGround vTiger hosting Package!

In order to install the Vtiger on a SiteGround hosting account, please follow the instructions bellow:
Pre-installation Steps

Step 1: Database setup:

Please, check our MySQL tutorial, to see how to create MySQL database and user and how to link them together.

Step 2: Upload Files

Now your database is up and ready to be filled in with data. But first you have to upload the Vtiger CRM files to your hosting account. Please, go to http://www.vtiger.com/ and download the latest stable release.

You need to download the LAMP version - it includes only the source code of Vtiger CRM - we have already installed Apache, MySQL and PHP on our servers).

Extract it on your computer - the archive will uncompress to a folder that contains the files of the installation:

vtiger_crm/index.php
vtiger_crm/modules
vtiger_crm/includes/
vtiger_crm/schema/
vtiger_crm/themes/
etc.

Now, please, start your favorite FTP client (learn more about FTP).

You should have already chosen where Vtiger will be installed on your account. If you want it to be your main website application, you should upload the files and folders of the installation directly inside the public_html/ folder (or www/ - they are the same) of your account. In other words, if Vtiger is to be visible at http://YourDomain.com/, the files should be uploaded inside public_html/ folder.

If you want Vtiger installed in a sub-folder, create one inside public_html and upload all the files there. For example, if Vtiger is to be installed at http://www.yourdomain.com/vtigersite/, please, create the public_html/vtigersite directory and upload the files in there, which should produce similar paths:

public_html/vtigersite/index.php
public_html/vtigersite/modules/
piblic_html/vtigersite/cron/
etc.

Have a cup (or two) of nice coffe while the files are being uploaded.

vTiger Installation

Finally, you are ready to proceed with the installation. Please, point your browser to the URL where you have uploaded the files. We will assume Vtiger CRM will be your main website, so type www.yourdomain.com in your browser. The steps of the installation process are very straight forward and well-explained, so we will only discuss the most important ones in detail.

Step 1: The Vtiger installation is beginning. If you wish, you may send the Vtiger developer information about you (email and name), if not - click NEXT.

Step 2: The Vtiger installer is making the checks - if everything is fine, you should see some green text (available, writable, version numbers etc.)

Step 3: Database configuration: This is where you tell Vtiger how to access its database. Some time ago, you should have created an MySQL database and user - please enter the details in the boxes provided.

Do not forget to type in the password of the MySQL user. Remember that it is case-sensitive.

For "Host Name" enter "localhost";
Site configuration: Here you should leave the information as it is - URL: http://www.yourdomain.com/;
Path /home/yourcpaneluser/public_html/;
Path to the Cache folder : cache/;
Admin configuration: username: admin;
password: admin (by default).

Click NEXT.

Step 4: Confirm System Configuration: Please check again the system configuration and click "Change" if you need to change some data or "Also populate with Demo Data" if you wish. Click "Create".

Step 5: Here the Vtiger tells us that the configuration file is written successfully (config.inc.php).

Step 6: The vtiger CRM installer now creates the database tables and populates them with demo data. This may take some time (a minute or two). After completion please click "FINISH".

Step 7: Congratulations! Your vTiger is now up and running. Note your administrator username and password (admin/admin by default).

That's it! Vtiger should now be installed.

Thursday, February 5, 2009

Wordpress Installation

Detailed Instructions wordpress installation:

Step 1: Download and Extract

If you have shell access to your web server, and are comfortable using console-based tools, you may wish to download WordPress directly to your web server using wget (or lynx or another console-based web browser) if you want to avoid FTPing:

a) wget http://wordpress.org/latest.tar.gz

b) Then unzip the package using:
tar -xzvf latest.tar.gz

(The WordPress package will extract into a folder called wordpress in the same directory that you downloaded latest.tar.gz.)

Step 2: Create the Database and a User

Create a database for WordPress on your web server, as well as a MySQL user who has all privileges for accessing and modifying it.

step 3 : Rename the wp-config-sample.php file to wp-config.php
mv wp-config-sample.php wp-config.php

step 4 : Open wp-config.php in your favorite text editor and fill in your database details as explained in Editing wp-config.php
Open the renamed wp-config.php file in your favorite text editor and fill in the following information.

DB_NAME : The name of the database you created for WordPress in Step 2 .
DB_USER : The username you created for WordPress in Step 2.
DB_PASSWORD : The password you chose for the WordPress username in Step 2.
DB_HOST : The hostname you determined in Step 2 (usually localhost, but not always. See some possible DB_HOST values).
DB_CHARSET : The database character set, normally should not be changed. See Editing wp-config.php for details.
DB_COLLATE : The database collation should normally be left blank. See Editing wp-config.php for details.

# Save the file.

step 5. Place the WordPress files in the desired location on your web server:

* If you want to integrate WordPress into the root of your domain (e.g. http://example.com/), move or upload all contents of the unzipped WordPress directory (but excluding the directory itself) into the root directory of your web server.
* If you want to have your WordPress installation in its own subdirectory on your web site (e.g. http://example.com/blog/), rename the directory wordpress to the name you'd like the subdirectory to have and move or upload it to your web server. For example if you want the WordPress installation in a subdirectory called "blog", you should rename the directory called "wordpress" to "blog" and upload it to the root directory of your web server.

(Hint: If your FTP transfer is too slow read how to avoid FTPing at : Step 1: Download and Extract. )

step 6. Run the WordPress installation script by accessing wp-admin/install.php in your favorite web browser.
* If you installed WordPress in the root directory, you should visit: http://example.com/wp-admin/install.php
* If you installed WordPress in its own subdirectory called blog, for example, you should visit: http://example.com/blog/wp-admin/install.php

That's it! WordPress should now be installed.
================================================

How to upgrade wordpress:
===============================================
public_html> wget http://wordpress.org/latest.zip
public_html>unzip latest.zip
public_html>chown user.user wordpress -R
public_html>rm -rf wp-admin wp-includes
public_html>cd wordpress
public_html/Wordpress>mv * ../
overwrite all except wp-content

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

Joomla Installation

First wget the package from joomla.org site.

1) wget http://joomlacode.org/gf/download/frsrelease/6828/22537/Joomla_1.0.15-Stable-Full_Package.tar.gz

2) Change the ownership for Joomla package

3) extact the package
tar -xzvf Joomla_1.0.15-Stable-Full_Package.tar.gz

4) Change the ownership of content
For ex: chown tunerpar.tunerpar * -R

5) Open the site in browser

chmod 777 ./templates
chmod 777 ./components
chmod 777 ./language
chmod 777 ./language/pdf_fonts
chmod 777 ./language/en-GB
chmod 777 ./images
chmod 777 ./images/banners
chmod 777 ./images/stories
chmod 777 ./modules
chmod 777 ./cache
chmod 777 ./tmp
chmod 777 ./media
chmod 777 ./administrator/templates
chmod 777 ./administrator/components
chmod 777 ./administrator/language
chmod 777 ./administrator/language/en-GB
chmod 777 ./administrator/backups
chmod 777 ./administrator/backups/index.html
chmod 777 ./administrator/modules
chmod 777 ./administrator/cache
chmod 777 ./plugins
chmod 777 ./plugins/system
chmod 777 ./plugins/content
chmod 777 ./plugins/user
chmod 777 ./plugins/editors-xtd
chmod 777 ./plugins/xmlrpc
chmod 777 ./plugins/search
chmod 777 ./plugins/editors

6) Create configuration file
touch configuration.php

7) Change the ownership for config file
chown tunerpar.tunerpar configuration.php

8) If php global setting is on then enter the code in .htaccess file

To tunn of the setting:

php_flag register_globals off

To make writable session save path, Just put the following code in your .htaccess file:
php_value session.save_path '/tmp'

9) Make writable confi file
chmod 666 configuration.php

10) Add username "localhost"

11) create a database ,username and password and fill it in blank fields.

12) Insert email ID of user

13) Save the admin login

14) Click on view site and then rename the installation directory and refesh the browser.

That's it! Joomla should now be installed.