Showing posts with label cpanel. Show all posts
Showing posts with label cpanel. Show all posts

Sunday, March 9, 2014

create cpanel backup without public_html and without database

# /scripts/pkgacct  --skiphomedir --skipacctdb  CPANEL_USER

Sunday, April 4, 2010

Zero database size

When we login to any clients cpanel , it is not showing actual database size , instead it is showing zero. With phpmyadmin we can see correct size but as you login to capnel >> click on database >> and see the size , it will show O mb db size.

sol-

Edit line
disk_usage_include_sqldbs=1 ( you need to set it to '1' if '0' )

in /var/cpanel/cpanel.config

OR

If you are using 11.25 stable, check the following option in Tweak Settings:

"When displaying disk usage in cPanel/WHM include Postgresql and MySQL® disk usage. [Requires MySQL® 5+] (SQL disk usage is only updated every four hours)"

The mysql usage will be updated shortly.

then run:

#/scripts/update_db_cache


Thursday, March 11, 2010

DomainKeys and SPF

If you want to add DomainKeys and SPF for every new account created on Cpanel, then do the following.

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

Add DomainKeys for single user

/usr/local/cpanel/bin/domain_keys_installer username

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

Add DomainKeys for all CPanel users.

If you wish to add DomainKeys for all Cpanel users on your server, execute following command.

cat /var/cpanel/users | while read a; do
/usr/local/cpanel/bin/domain_keys_installer $a
done

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

Add SPF for single Cpanel accounts.

/usr/local/cpanel/bin/spf_installer username
------------------------------------------------------------

Add SPF for all Cpanel accounts.

If you want to add SPF records for all cpanel accounts exist on your server then use the following command.

cat /var/cpanel/users | while read a; do
/usr/local/cpanel/bin/spf_installer $a
done

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

ADD SPF record while creating new accounts from WHM >>create account option.

vi /scripts/postwwwacct

postwwwacct is a file which execute after wwwacct (used to create account), paste following lines in the file.

*******

#!/usr/bin/perl

my %OPTS = @ARGV;
$ENV{USER} = “$OPTS{’user’}”;

#For domain key
system q(/usr/local/cpanel/bin/domain_keys_installer $USER);

#for spf record
system q(/usr/local/cpanel/bin/spf_installer $USER);

********

save it and restart cpanel service.


And create account from WHM and check DNS once the account is created. You will the SPF record is added automatically.









Monday, March 8, 2010

Mailbox quota shown wrong on cPanel

On your cPanel dedicated server, for an email the mailbox quota is displayed wrong ,
Go through the following steps:

Login to your server as root
cd /home/username/mail/domain.com/emailaccount
rm -rf maildirsize

Now, login to cPanel
Go to email account and change the quota for particular email account.
(Once you change quota, it will recreate file maildirsize automatically)

You can also delete maildirsize file from cpanel > file manager

Tuesday, March 2, 2010

Alternative PHP Cache [APC]

How to install Alternative PHP Cache [APC] on a Linux VPS/Dedicated server !

APC
is a free, open, and robust framework for caching and optimizing PHP intermediate code. Here are the most simple steps :

# Login to the server as root

# Download APC
wget http://pecl.php.net/package/APC
eg : wget http://pecl.php.net/get/APC-3.0.15.tgz

# Extract it and move into the directory
tar -xzf APC-3.0.15.tgz
cd APC*

# Locate where php is
which php
This should return something like: /usr/local/bin/php Remember the location of php.

# Create configuration files
phpize

# Compile APC

./configure --enable-apc --enable-apc-mmap --with-apxs --with-php-config=/usr/local/bin/php-config
make
make install

# Install APC into php.ini

You will have to first locate php.ini using the following command

php -i | grep php.ini

This will usually return /usr/local/Zend/etc/php.ini on a server that has Zend optimizer installed. Now edit php.ini and add the APC extension.

vi /usr/local/Zend/etc/php.ini

Scroll down to the bottom and add the fallowing before the lines about the zend optimizer (They start with [Zend])

extension=”/apc_location/apc.so”


# Restart Apache

# Restart Apache




























Install XCache

XCache is a fast, stable PHP opcode cacher that has been tested and is now running on production servers under high load. It is tested (on linux) and supported on all of the latest PHP. It optimizes performance by removing the compilation time of PHP scripts by caching the compiled state of PHP scripts into the shm (RAM) and uses the compiled version straight from the RAM. This will increase the rate of page generation time by up to 5 times as it also optimizes many other aspects of php scripts and reduce server load.

To install follow the steps

1. Download and extract the source for XCache .

# cd /usr/local/src/
# wget http://xcache.lighttpd.net/pub/Releases/1.2.2/xcache-1.2.2.tar.gz
# tar -xzvf xcache-1.2.2.tar.gz

2. Build, configure and install the XCache module.
# cd xcache-1.2.2
# phpize
# ./configure --enable-xcache
# make && make install

You can see a message like this . Note the extension directory.

=============
Build complete.
Don’t forget to run ‘make test’.

Installing shared extensions: /usr/local/lib/php/extensions/no-debug-non-zts-20060613/
==============

3. Now configure the php.ini file ( To find .ini file, use the command `php -i | grep php.ini` )

# cat xcache.ini >> /usr/local/lib/php.ini

Replace the following line in php.ini with correct path ,which describes the Installed shared extensions that we noted above.

zend_extension = /usr/local/lib/php/extensions/non-debug-non-zts-xxx/xcache.so

It will become like this,

zend_extension = /usr/local/lib/php/extensions/no-debug-non-zts-20060613/xcache.so

4. Restart apache and confirm the Xcache installation.
# /etc/init.d/httpd restart

# php -v

it will show you as
-----------
php -v
PHP 5.2.8 (cli) (built: Feb 16 2009 05:42:38)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
with XCache v1.2.2, Copyright (c) 2005-2007, by mOo
--------

Monday, March 1, 2010

Installing cPanel/WHM

cpanel can offer 15-day test licenses for no cost.


Installing cPanel/WHM

To begin your installation, use the following commands:

1. cd /home — Opens the directory /home.
2. wget -N http://layer1.cpanel.net/latest — Fetches the latest installation file from the cPanel servers.
3. sh latest — Opens and runs the installation files.



4.(If you have purchased license for cpanel)
/usr/local/cpanel/cpkeyclt — Activates your license after installation.

5. Login to WHM and proceed with the intial WHM Setup.


Obtaining a cPanel/WHM License:

If you do not have a license for cPanel/WHM, you will need to obtain one for your IP address. You can obtain a license at http://www.cpanel.net/store.

Tuesday, February 2, 2010

Installing FFMpeg on cpanel server.

Installing FFMpeg

1)yum install ffmpeg ffmpeg-devel

If you get package not found, then you will need to add few lines in the yum repository for dag packages installation. Create a file named dag.repo in /etc/yum.repos.d with the following contents on it

[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux

baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=0
enabled=1

then

yum install ffmpeg ffmpeg-devel

If everything is fine, then the installation should proceed smoothly

2)To check the FFmpeg working:

Finally, check the ffmpeg whether it is working or not.

> ffmpeg
> ffmpeg -formats
> ffmpeg --help
// This lists path of mpeg, its modules and other path information


ffmpeg -i Input.file Output.file

****Install FFMPEG-PHP Extension*****
FFmpeg-php is a very good extension and wrapper for PHP which can pull useful information about video through API interface. Inorder to install it you will need to download the source file and then compile and install extension in your server. You can download the source tarball : http://ffmpeg-php.sourceforge.net/

wget /path/to/this/file/ffmpeg-php-0.5.2.1.tbz2

tar -xjf ffmpeg-0.5.2.1.tbz2

phpize

./configure
make
make install

****Editing PHP.INI

Once you have done that without any problems then you will see the php extension file /usr/local/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so and you will need mention that extension in php.ini file

nano /usr/local/lib/php.ini

Put the below two lines at the end of the php.ini file

[ffmpeg]
extension=ffmpeg.so

Then restart the server service httpd restart

****To check whether ffmpeg enabled with php, point your browser to test.php file. It should show the confirmation of installed ffmpeg php extension

// #test.php

Monday, April 13, 2009

Whm fail

WHM Fails

Failure Reason: Unable to connect to port 2086
/etc/init.d/chkservd restart

How to install GD/Curl in cPanel server

In cPanel servers, the safest way to install PHP modules is to use the cPanel script for Apache-PHP compilation. You can do this as follows.

WHM login >> Main >> Software >> Apache Update
Or from the console execute /scripts/easyapache


Go through each step as follows.

1. Click “start customizing based on profile”
2. Select Apache Version - Click Next to proceed with the current version.
3. Select PHP Major Version - Click Next to proceed with the current version.
4. Select PHP Minor version - Click Next to proceed with the current version.
5. Short option list - Click Exhaustive Options List to view full options.
6 Exhaustive Options List - From here you can select the PHP modules you needed

In this case you need to select ‘GD’ and/or ‘CURL’
7. Click Save & Build to start apache-php compilation.

Once the compilation over you can verify the installed modules using the following command.

[root@servername ~]# php -m

How to Disable/Enable open_basedir protection in cPanel servers

You can easily Disable/Enable open_basedir protection in cPanel servers as follows.

Login to the WHM panel >> Main >> Security >> Security Center >> open_basedir protection

Here you can Disable/Enable the protection for particular domain or server wide.

Wednesday, April 1, 2009

forbidden for newly created account

Getting below error for newly created account through WHM

If the accounts are created, but when it comes to the confirmation message appears this error :

*********************************ERROR**********************
"Setting up Frontpage ® ...
/ home / username / public_html does not exist or is not a
directory! "

************************************************************

If the account is created, but you can not access the cPanel,
or enter the FTP.

and when we want to see the domain is this.

"Forbidden

You do not have permission to access / on this server.

Additionally, a 403 Forbidden error was encountered while
trying to use an ErrorDocument to handle the request. "


this VPS is powered by OpenVZ and HyperVM.
-----------------
check cpanel logs

If you check the cpanel error log you'll see a lot of Disk Quota Exceeded. We
see this a lot on VPS's because there is not enough inodes allocated or there
is a file system issue. You will need to allocate more inodes to this VPS to increase quotaguidlimit.

Monday, March 23, 2009

CPanel: adding a range of IPs using WHM

You can add a range of IPs in Cpanel/WHM .This can be easily done using the WHM interface:

Go to IP Functions/Add a New IP Address. Here you can choose the “Ip(s) to add” and the Subnet Mask.

To add the IP range 192.168.0.100-192.168.0.105 you will just have to enter:
Ip(s) to add: 192.168.0.100-105
Subnet Mask: 255.255.255.0
and click on “Do it“.

This will add all the IPs in the range to the system.

In the background CPanel will add for each IP a line in the file /etc/ips:

#vi /etc/ips

192.168.0.100:255.255.255.0:192.168.0.255
192.168.0.101:255.255.255.0:192.168.0.255
...etc

The IPs are then configured using the CPanel startup script called ipaliases (/etc/init.d/ipaliases).

#service ipalias restart

Make clone site

=============================================================
HOW TO COPY WEBSITE FROM http://abc.com to abc1.com with database
==============================================================
Open two shells ( one with abc.com and other abc1.com )

then copy public_html of abc.com to abc1.com

go to public_html folder of abc.com and hit the command

[root@server public_html of abc.com]# cp -R * /home/abc1/public_html

Change the ownership of the files copied under public_html of abc1.com

Then take backup of mysql datatbase of abc.com

mysqldump abc_databasename > abc_databasename.sql ( of abc.com)

Create a new database and username under abc1.com ( add user to database, make a note of db name, user & password)

then go to shell and enter the following command:-

mysql -u abc1_user -ppassword abc1_databasename < abc_databasename.sql

Then go to the configuration file and do the changes accordingly.

YOUR SITE HAS BEEN COPIED WITH DATABASE TO NEW SITE.

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

Friday, March 20, 2009

How to Empty Logfiles

=====================================
Run Following Commands to empty exim and apache logs

====================================
echo > /var/log/exim_mainlog
echo > /var/log/exim_rejectlog
echo > /var/log/maillog
echo > /var/log/messages
echo > /var/log/messages.1
echo > /var/log/messages.2
echo > /var/log/messages.3
echo > /var/log/messages.4
echo > /var/log/lastlog
echo > /var/log/maillog
echo > /var/log/maillog.1
echo > /var/log/maillog.2
echo > /var/log/maillog.3
echo> /var/log/secure
echo> /var/log/secure.1
echo> /var/log/secure.2
echo> /var/log/secure.3
echo> /var/log/secure.4
echo > /usr/local/apache/logs/access_log
echo > /usr/local/apache/logs/suexec_log
echo > /usr/local/apache/logs/error_log
echo > /usr/local/cpanel/logs/access_log
echo > /usr/local/cpanel/logs/error_log
echo > /var/log/exim_mainlog.1
echo > /usr/local/cpanel/3rdparty/mailman/logs/locks
echo > /var/log/cron.2
echo > /var/log/chkservd.log
echo > /var/log/cron.4
echo > /var/log/exim_paniclog.1
echo > /var/log/exim_rejectlog.1
echo > /var/log/exim_paniclog

=================================================
How to delete unwanted things from /usr partion.
=================================================

1) Login to client machine via ssh.
2) type : df -h
3) then go to : cd /usr/local/apache/logs
4) type: ls -ihS
5) type: echo > error_log
6) type: echo > suexec_log
7) go to : cd ../domlogs/
8) type: ls -lhS | head -n 20
9) type: echo > anyone from the list.

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

Thursday, March 19, 2009

Scan viruses and Trojans

---------------------------------------------
Scan viruses and Trojans on cpanel server

---------------------------------------------
Search For Trojans in /dev

/scripts/finddev


Locate Trojan Horses

/scripts/findtrojans


Suggest Usage

/scripts/findtrojans > /var/log/trojans

/scripts/fixtrojans /var/log/trojans
---------------------------------------------

Install ClamAV in Centos with Cpanel
--------------------------------------------
Installing antivirus is most important if you run a VPS or dedicated server, because of so many worms and trojans get in to your server often without notice and could compromise the server.

Cpanel WHM Installation

The easiest way to install clam antivirus in cpanel is through install plugin option in Cpanel WHM .

Go > WHM > Cpanel Install Plugin > Enable Clamav Connector
-----------------------------------------
Manual Installation

You can install clamav by compiling RPM packages.

1. Compiling source: download from clamav site.
2. Installing RPM package. Download

I tried to download and compile source package, but i got zlib error complaining the version not updated. so tried RPM and just able to install for myself.

By default clamav doesnt come with centos or perhaps with yum. You have to find rpm repository and install it.

Here is how you install clam antivirus (freely available) in centos running with cpanel.
----------------------------------
yum install clamd
[OR]

yum install clamav
----------------
If it doesnt work use this

rpm -Uhv http://apt.sw.be/packages/rpmforge-release/rpmforge-release-0.3.6-1.el4.rf.i386.rpm

follow this instructions here based on centos version (Locate B2 in that page)

after installing that you can issue

yum install clamd

[OR]

yum install clamav

either of those should work.

Once you have installed clamav in your centos…here are some of the basic commands using the software..

1. To update the antivirus database

> freshclam

2. To run antivirus

clamav -r /home

3. Running as Cron Daily Job

To run antivirus as a cron job (automatically scan daily) just run crontab -e from your command line. Then add the following line and save the file.

02 1 * * * root clamscan -R /var/www

This will run the cron job daily @ 1.02 AM by scanning the public html. You can change the folder to whatever you want for mail etc.

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

yum installed or not?

You can check yum is installed or not on server
-----------------
rpm -q yum
rpm -ql yum

echo $PATH
------------------

Wednesday, March 11, 2009

Installing PostgreSQL On Cpanel

Installing PostgreSQL


Install PostgreSQL using cPanel


To install PostgreSQL on the server that is running a cPanel server, complete the following:

1. Login as root
2. Type:

cd /scripts/
./installpostgres


3. cPanel will automatically install PostgreSQL using yum and initialize the database for you.

Install PostgreSQL using yum

Yum can be used to install PostgreSQL on a RedHat or CentOS platform. Run the following commands to get PostgreSQL installed with yum.

yum install postgresql postgresql-server postgresql-libs postgresql-devel
/etc/rc.d/init.d/postgresql start


-OR-

yum install postgresql postgresql-server postgresql-libs postgresql-devel
/etc/rc.d/init.d/postgresql initdb
/etc/rc.d/init.d/postgresql start

++++++++++++++++++++++++++++++++++++++

Sunday, March 8, 2009

Rvsite builder Installation and troubleshooting

How To Install RvSiteBuilder

Note: you need to get a license from RVSiteBuilder website.

Installing RVSiteBuilder:

# cd /usr/local/cpanel/whostmgr/docroot/cgi/
# rm -f rvsitebuilderinstaller.tar
# wget http://download.rvglobalsoft.com/rvsitebuilderinstaller.tar
# tar -xvf rvsitebuilderinstaller.tar
# chmod 755 addon_rvsitebuilder.cgi

Now open WHM, ->> Add-ons section ->> RVSiteBuilder Installer menu. Click RVSiteBuilder Installer to begin the installation process.

++++++++++++++++++-----------------------+++++++++++++++++++++++++

Troubleshooting:

1) Not Found Error on rvsitebuilder
If you get the next problem on rvsitebuilder running on a cpanel server:

Not Found

The server was not able to find the document
(./3rdparty/rvsitebuilder/index.php/sitebuilder/sitebuilderhome) you
requested.
Please check the url and try again. You might also want to report this
error to your webhost.


It should fix the problem to you:

Log in as root on your cpanel server and run these commands:

# rm -f /var/cpanel/rvglobalsoft/rvsitebuilder/var/INSTALL_COMPLETE.php
# rm -f /var/cpanel/rvglobalsoft/rvsitebuilder/rvsitebuilderversion.txt
# perl /usr/local/cpanel/whostmgr/docroot/cgi/rvsitebuilderinstaller/autoinstaller.cgi

Open your WHM on a web browser, https://serverip:2087

And go to root WHM -> Plugins -> RVSiteBuilder

It will automatically rebuild the database for you and should fix the problem.

++++++++++++++++++++++++++-------------------------------++++++++++++++++++++

Monday, February 23, 2009

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;