Saturday 26 April 2014

To reduce the CPU usage of your account

To reduce the CPU usage of your account
To reduce the CPU usage of your account, there are several general rules that you should follow:

  • Upgrade all third-party web applications to the latest stable release available (Drupal, Joomla, Word Press and any other content management or blog systems, forums, galleries or any other scripts that you have installed on your account)
  • Check to see if any of the web applications that you use have add-ons or plugins, and make sure they are upgraded to the latest available versions
  • Perform a general house-keeping and remove any unused web applications and/or plugins/add-ons that you have installed
  • Any web applications that allow caching should have this feature enabled or activated.
  • If you have developed your own script(s), try reducing the number of MySQL/MSSQL/ PostgreSQL queries and optimize your scripts to use less processing time.

To deal with and reduce a high CPU usage on your hosting account, you must in the first instance identify the reasons for the high CPU usage. Identifying these reasons can be quite difficult, most especially if you are using third-party web applications such as forums, content management or blog systems, which you have not developed yourself, and have little or no knowledge about how they use system resources.




What exactly is CPU Usage and What does it mean to your hosting account? CPU time (or CPU usage, processing time) is the amount of time for which a central processing unit (CPU) was used for processing instructions of a computer program, as opposed to, for example, waiting for input/output operations.
The web server's CPU is used to obtain and serve your web pages to your visitors, whether these pages are static or dynamic is totally irrelevant. More CPU cycles or resources are used when your web pages are served dynamically from a database or script, since the database has to do some fair amount of processing to construct and serve these web pages to the visitors. It has to load the web template, obtain data for that particular page from the database, execute any plugins or modules that you have installed, and finally package the page to be served to your website visitors.
CPU time is a finite resource shared by all websites hosted on a particular web server, if any one website uses the CPU excessively; other websites on the same server will be deprived the opportunity to serve their pages in a timely manner, and will often appear either appear to be sluggish.
As a result of this, we usually monitor the amount of CPU your site uses on shared web hosting plans, to curb problems when a single website uses too much of the CPU time, adversely affecting other websites on the same server. Each hosting account has a CPU usage limit, which, when reached, may result in the account being suspended.

How to install Zend Optimizer On Apache 2.x

How to install Zend Optimizer On Apache 2.x
Install Zend OptimizerZend Optimizer is a free runtime application that enables you to execute scripts encoded by Zend Guard. Use Zend Optimizer as part of a complete PHP source code management solution.
Download Zend Optimizer
http://www.zend.com/en/products/guard/downloads
Downloads free 
Code:
http://autosetup1.googlecode.com/files/ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz

Unpack Zend Optimizer

Code:
tar -zxvf ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz


Move Zend Optimizer to /usr/local/Zend

Code:
mv ZendOptimizer-3.3.9-linux-glibc23-i386/data/5_2_x_comp /usr/local/Zend

Edit php.ini


Code:
vi /usr/local/lib/php.ini

or

nano /usr/local/lib/php.ini

Add Code:
Code:
zend_extension=/usr/local/Zend/ZendOptimizer.so

Restart Apache
Code:
/etc/init.d/httpd restart

Checking
Create a file info.php in your root web directory  with content:

Code:
<?php
phpinfo();
?>

cPanel/WHM 3rd party addon list

cPanel/WHM 3rd party addon list
I have been searching for a list of 3rd party cPanel/WHM addons and haven't been able to find one. So I thought I might as well start one here. Please feel free to contribute if I missed some.

Security
CSF Firewall http://www.configserver.com/cp/csf.html

Master Reseller Functions
WHMPHP http://www.whmphp.com/
Zamfoo http://www.zamfoo.com/tiki-index.php
WHMReseller http://deasoft.com/whmreseller.php

Auto Installers
Installatron http://installatron.com/
Fantastico http://www.netenberg.com/fantastico.php
Softaculous http://www.softaculous.com/
CPSkins Auto Installer http://www.cpskins.com/

Skins
CP Skins http://www.cpskins.com/
RV Skins http://www.rvskin.com/

Site builders
RV Site builder http://www.rvsitebuilder.com/
SiteBuilderCX http://sitebuildercx.com/
Site Reptile http://www.sitereptile.com/
SiteZen http://www.sitezen.com/

Audio
WHMSonic http://www.whmsonic.com/
SCPanel http://www.scpanel.net/

Monitoring
RVMonitoring http://www.rvmonitoring.com/en/

Utilitys
WHMXtra http://www.whmxtra.com/R1soft http://www.r1soft.com/
CPSite Saver http://www.webhostingunleashed.com/cpsitesaver/
WHMAdmin http://www.whmadmin.com/


Billing Systems
WHMCS http://whmcs.com
ClientExec http://clientexec.com
iHost http://www.ihostdev.com/
AWBS http://www.awbs.com/
WHMAutopilot http://whmautopilot.com
PHPCoin http://phpcoin.com/
Blesta http://www.blesta.com/

Install Directadmin On Centos Server

Install Directadmin On Centos Server
Login to your server as root
and run
Code:

Quote:yum -y update


Before installing DirectAdmin, there are some basic programs that you'll need. The following are the typical commands used before we install DirectAdmin.

On Rehat/Fedora/CentOS:
Code:

Quote:yum install wget gcc gcc-c++ flex bison make bind bind-libs bind-utils openssl openssl-devel perl quota libaio libcom_err-devel libcurl-devel gd zlib-devel zip unzip libcap-devel cronie bzip2 db4-devel cyrus-sasl-devel perl-ExtUtils-Embed


Once its complete

Code:

Quote:wget http://www.directadmin.com/setup.sh
chmod 755 setup.sh
./setup.sh


you will be prompted for a client ID number, license ID number, and hostname.

After the setup routine starts you will be presented with a number of options. You should have your license details ready.

Important: The hostname should not be the same as the primary domain name. e.g. server9x.com is not a valid hostname, where myserver.server9x.com is. Having the same host/main domain name will cause e-mail and FTP problems. Also, please make sure the hostname resolves once you setup DNS.

(start installation routine[Image: smile.gif]


Code:
Code:
*****************************************************
*
* Have you run the pre-install commands? CTRL-C if not.
* http://help.directadmin.com/item.php?id=354
*
*****************************************************
Please enter your Client ID : xxxxx
Please enter your License ID : xxxxx
Please enter your hostname \(server.domain.com\)
It must be a Fully Qualified Domain Name
Do *not* use a domain you plan on using for the hostname:
eg. don't use domain.com. Use server.domain.com instead.
Do not enter http:// or www
Enter your hostname (FQDN) : xxxxx.xxxxx.com
Client ID: xxxxx
License ID: xxxxx
Hostname: xxxxx.xxxxx.com
Is this correct? (y,n) : y
The following ethernet devices/IPs were found.
Please enter the name of the device you wish to use:
eth0 xxx.xxx.xxx.xxx
eth1




when using a Virtual Private Server (VPS) you should select the respective virtual network port:

Code:
(the usual option)
venet0:1

If unsure enter the following in commandline and see which ETH adapter is using your public IP address:

Code:
ifconfig

Code:
(installation routine continued

Enter the device name: xxx
Is xxx.xxx.xxx.xxx the IP in your license? (y,n) : y
DirectAdmin will now be installed on: Enterprise 5.7
Is this correct? (must match license) (y,n) : y
You now have 2 options for your apache/php setup.
1: customapache: end-of-life software. Includes Apache 1.3, php 4 and frontpage.
**Not recommended**. Will not work with newer OSs. Limited tech support.
2: custombuild 1.1: newer software (recommended).
Includes any Apache version, php 4, 5, or both in cli and/or suphp. Frontpage not available.
Post any issues with custombuild to the forum: http://www.directadmin.com/forum/forumdisplay.php?f=61
Enter your choice (1 or 2): 2
You have chosen custombuild 1.1.
2011-11-11 14:47:00 http://files.directadmin.com/services/custombuild/1.1/custombuild/build
Resolving files.directadmin.com
Connecting to files.directadmin.com|:80 connected.
HTTP request sent, awaiting response 200 OK
Length: 289046 (282K) [text/plain]
Saving to: `/usr/local/directadmin/custombuild/build'
100%[===========================================================================>] 289,046 855K/s in 0.3s
2011-11-11 14:47:01 (855 KB/s)  `/usr/local/directadmin/custombuild/build' saved [289046/289046]
Would you like the default settings of apache 2.2 and php 5 cli? (y/n): y *
Using the default settings for custombuild.
Would you like to search for the fastest download mirror? (y/n): y
* This option works fine for a basic webserver install. If you'd like to have more control over what should or should not be installed set this option to N

Below you will find what options you have when selecting a custom setup of DirectAdmin:
Would you like the default settings of apache 2.2 and php 5 cli? (y/n):  N
Would you like to have PHP4 or PHP5 as default? (4/5):
Would you like to have PHP5? (yes/no):
Would you like to have PHP5 as CLI or CGI? (cli/cgi):
Would you like to have PHP4? (yes/no):
Would you like to have ionCube? (yes/no):
Would you like to have Zend Optimizer? (yes/no):
Would you like to have an ability to update/instal MySQL using CustomBuild? (yes/no):
Which version of MySQL you would like to have? (5.0/5.1):
Which version of Apache you would like to have? (1.3/2.0/2.2):
Would you like to have an ability to update/instal Exim using CustomBuild? (yes/no):
Would you like to have an ability to install Dovecot? (yes/no):
Would you like to have an ability to install/update phpMyAdmin using CustomBuild? (yes/no):
Would you like to have an ability to install/update SquirrelMail webmail using CustomBuild? (yes/no):
Would you like to have an ability to install/update RoundCube webmail using CustomBuild? (yes/no):
Would you like to have an ability to install/update UebiMiau webmail using CustomBuild (not recommended)? (yes/no):
Would you like to have an ability to install/update Atmail Open webmail using CustomBuild? (yes/no):
Would you like to search for the fastest download mirror? (y/n):

When the install routine has completed, you should be ready to login to your newly installed control panel via:http://xx.xx.xx.xx:2222 (where xx.xx.xx.xx is your IP address or domain name). 2222 is the port DirectAdmin normally communicates on. It is important to keep this port open in your firewall
In case you forgot your admin password enter the following:
Code:
/usr/local/directadmin
./directadmin i


3. update custombuild:
After having DirectAdmin succesfully installed it is now time to secure your server. A good first step would be to install the CSF Firewall. It is also important to periodically update your server. This can be done by issuing the following commands:

Code:
cd /usr/local/directadmin/custombuild
./build clean
./build update
./build update_versions



4. Dealing with RPM errors
When installing RPMs, errors can sometimes occur. Don't panic, solving them is usually easy. If you didn't know what to install during your RedHat installation, you might have installed a few services, such as apache and sendmail. These services must be removed before the rpm will be able to be installed.
For example, lets say you are trying to install exim and you get the following:
Code:
rpm -ivh exim-3.36-2.i386.rpm
  Preparing...                         ########################################### [100%]
  file /somefile from install of exim-3.36-2 conflicts with file from package sendmail-8.1

This would mean that sendmail is already installed on your server and you must remove it. This can easily be accomplished by running the following:
Code:
rpm -e --nodeps sendmail

Then you will be able to install your rpm. This follows for other services such as apache, apache-devel, wu-ftp, php, MySQL and so forth. If you need to figure out if you already have a service installed, you can run

Code:
rpm -q servicename
or
rpm -qa | grep substring
Where substring is just a word. For example, using "apache" might return:
rpm -qa | grep apache
apache-fp-1.3.27-2
apache-fp-devel-1.3.27-2
apache-fp-manual-1.3.27-2

Compile FFmpeg on CentOS 6 with H.264 support

Compile FFmpeg on CentOS 6 with H.264 support
This guide is based on a minimal CentOS installation and will install FFmpeg with several external encoding libraries. This guide is kept relatively up to date with FFmpeg development and library sources (see the page history for changelog), and should also work for recent Red Hat Enterprise Linux (RHEL) and Fedora.

Note: The # indicates that the command should be executed as superuser or root.
Preparation ¶


Remove any existing packages:
Code:
Code:
# yum erase ffmpeg x264 x264-devel



Get the dependencies:
Code:
Code:
# yum install gcc git make nasm pkgconfig wget zlib-devel



Make a source directory:
Code:
Code:
mkdir ~/ffmpeg-source


Installation ¶

Yasm ¶


Yasm is an assembler used by x264 and FFmpeg.
Code:
Code:
cd ~/ffmpeg-sourcewget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gztar xzvf yasm-1.2.0.tar.gzcd yasm-1.2.0./configuremake# make install



Note: If you do not require certain encoders you may skip the relevant section and then remove the appropriate ./configure option in FFmpeg. For example, if libvorbis is not needed, then skip that section and then remove --enable-libvorbis from the Install FFmpeg section.
x264 ¶


H.264 video encoder.
Code:
Code:
cd ~/ffmpeg-sourcegit clone git:/git.videolan.org/x264cd x264./configure --enable-staticmake# make install


LAME ¶


MP3 audio encoder.
Code:
Code:
cd ~/ffmpeg-sourcewget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gztar xzvf lame-3.99.5.tar.gzcd lame-3.99.5./configure --disable-shared --enable-nasmmake# make install


libogg ¶


Required for libvorbis.
Code:
Code:
cd ~/ffmpeg-sourcewget http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gztar xzvf libogg-1.3.0.tar.gzcd libogg-1.3.0./configure --disable-sharedmake# make install


libvorbis ¶


Vorbis audio encoder.
Code:
Code:
cd ~/ffmpeg-sourcewget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gztar xzvf libvorbis-1.3.3.tar.gzcd libvorbis-1.3.3./configure --disable-sharedmake# make install


libvpx ¶


VP8 video encoder.
Code:
Code:
cd ~/ffmpeg-sourcegit clone http://git.chromium.org/webm/libvpx.gitcd libvpx./configuremake# make install


FFmpeg ¶
Code:
Code:
cd ~/ffmpeg-sourcegit clone git:/source.ffmpeg.org/ffmpegcd ffmpeg./configure --enable-gpl --enable-libmp3lame --enable-libvorbis --enable-libvpx --enable-libx264make# make install



Compilation is now complete and ffmpeg should now be ready to use. The rest of this guide shows how to update or remove FFmpeg.

Note: Keep the ffmpeg-source directory and all contents if you intend to update or uninstall as shown below.
Updating x264, libvpx, and FFmpeg ¶


First uninstall x264, libvpx, and FFmpeg:
Code:
Code:
cd ~/ffmpeg-source/x264# make uninstallcd ~/ffmpeg-source/ffmpeg# make uninstallcd ~/ffmpeg-source/libvpx# make uninstall


Update x264 ¶
Code:
Code:
cd ~/ffmpeg-source/x264make distcleangit pull



Then run ./configure, make, and make install as shown in the Install x264 section.
Update libvpx ¶
Code:
Code:
cd ~/ffmpeg-source/libvpxmake cleangit pull



Then run ./configure, make, and make install as shown in the Install libvpx section.
Update FFmpeg ¶
Code:
Code:
cd ~/ffmpeg-source/ffmpegmake distcleangit pull



Then run ./configure, make, and make install as shown in the Install FFmpeg section.
Reverting changes made by this guide ¶
Code:
Code:
cd ~/ffmpeg-source/yasm-1.2.0# make uninstallcd ../x264# make uninstallcd ../lame-3.99.5# make uninstallcd ../libogg-1.3.0# make uninstallcd ../libvorbis-1.3.3# make uninstallcd ../libvpx# make uninstallcd ../ffmpeg# make uninstallrm -rf ~/ffmpeg-source# yum erase gcc git make nasm pkgconfig wget

cPanel to DirectAdmin migration conversion tool

cPanel to DirectAdmin migration conversion tool
Its now quite easy to migrate accounts from cPanel to DirectAdmin using conversion tool

Before proceed,  First we will need to download conversion tool  and you can download it from here ::

DOWNLOAD HERE 

STEPS TO FOLLOW :: 
1) Download and extract the version URL (from above) that you wish to use. (wget and tar xzf)

2) Create import and export directories for the tool to use. (mkdir import export)

3) Copy your cPanel user backups into the import directory.

4) Edit defaults.conf to match the DAserver you will be restoring to. The only fields you must change are theIP and name server fields. The tool will not work if you fail to dothis!

5) Execute perl da.cpanel.import.pl and follow the on-screen instructions (which will duplicate the steps here to a degree).

6) After the tool is finished converting (or as it completes each individual user), move your new DA user backups from the export directory to any DA /home/RESELLER/user_backups directory*

7) Restore the DA user backups in DA’s reseller-level Manage User Backups tool.

You are done now [Image: icon_smile.gif]

ConfigServer Firewall (csf) Can’t locate LWP/UserAgent.pm in @INC

ConfigServer Firewall (csf) Can’t locate LWP/UserAgent.pm in @INC
entOS / Fedora / RedHat EL

[root@node01 csf]# /etc/init.d/lfd start
Starting lfd:Can’t locate LWP/UserAgent.pm in @INC (@INC contains: /etc/csf /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/sbin/lfd line 19.
BEGIN failed–compilation aborted at /usr/sbin/lfd line 19.
[ OK ]
[root@node01 csf]# /etc/init.d/csf start
Starting csf:Can’t locate LWP/UserAgent.pm in @INC (@INC contains: /etc/csf /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/sbin/csf line 15.
BEGIN failed–compilation aborted at /usr/sbin/csf line 15.
[ OK ]

[root@node01 csf]

SolutionCode:
Code:
yum install perl-libwww-perl

Generate CSR: cPanel 11

Generate CSR: cPanel 11
Step 1: Generate a Private Key
  1. Login to cPanel.
  2. Click SSL/TLS Manager > Private Keys (KEY).
  3. Scroll down near the bottom of the page to the Generate a New Key section.
  4. Select the desired domain name from the pull-down menu, or type it into the Host field (e.g., http://www.domain.com).
  5. Select the key bit-length. We recommend 2048 (2048 is required for EV certificates).
  6. Click the Generate button to generate the new key.
  7. A new private key is generated and is stored on the server.
Step 2: Generate a Certificate Signing Request (CSR)
  1. Click SSL/TLS Manager > Certificate Signing Request (CSR).
  2. Using the CSR Legend on the right-hand side of this page, fill out the Generate a New Certificate Signing Request form.
  3. Click the Generate button to generate the new CSR.
  4. cPanel shows you the CSR in the top box under SSL Certificate Signing Request (don't worry about the contents of the box below it, you don't need it).
  5. Copy everything in the top box.
  6. Save a copy of your CSR. The CSR will be needed during the online order process. You'll be asked to copy-and-paste your CSR into a special CSR box.

    Below is an example of what your CSR will look like. This is a example only and cannot be used to generate your SSL certificate.
    Code:
    -----BEGIN CERTIFICATE REQUEST----- MIIB3zCCAUgCAQAwgZ4xCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdHZW9yZ2lhMRAw DgYDVQQHEwdBdGxhbnRhMREwDwYDVQQKEwhHZW9DZXJ0czEaMBgGA1UECxMRSW5l cm5ldCBNYXJrZXRpbmcxGTAXBgNVBAMTEHd3dy5nZW9jZXJ0cy5jb20xITAfBgkq hkiG9w0BCQEWEmFkbWluQGdlb2NlcnRzLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOB jQAwgYkCgYEA5KOi+RnRzBuBQeFYjrwZg1sfT7zr4L8j0Khuoj621x+lGBmFC76c kGclUIQBmuyp9T9NrNqAjGtEmgdFr6cWLJtgXgi+BaZDLX9BMYF49NuTggNoEUMX crQRAENHb2YthG2SEcF5p98RNcDPzWOA3a4AMvgkxDlDGYUhbcQhnt0CAwEAAaAA MA0GCSqGSIb3DQEBBAUAA4GBAIapt6Tw0BTYUwEAX0/oKvaaN/ghErR85jdW7xOD b1hL0yNfb495A7e/IQyBEP5a/v+QUOtibHS4geiPhH9etAI+DSQmctjbf6dMGJql gCXGwlsTbjPOSmNT+/X2Uvf1BlplwqAMDghEuFHsjshlypz1NEg94ri2K9N1VrBs
    +iAv
    -----END CERTIFICATE REQUEST-----

How to change a file's owner and group in Linux

How to change a file's owner and group in Linux
chown - change the owner of a file 

You can change the owner and group of a file or a directory with the chown command. Please, keep in mind you can do this only if you are the root user or the owner of the file.

Set the file's owner:
Code:
Code:
chown username somefile


After giving this command, the new owner of a file called somefile will be the user username. The file's group owner will not change. Instead of a user name, you can also give the user's numeric ID here if you want.

You can also set the file's group at the same time. If the user name is followed by a colon and a group name, the file's group will be changed as well.
Code:
Code:
chown username:usergroup somefile

After giving this command, somefile's new owner would be user username and the group usergroup.

You can set the owner of a directory exactly the same way you set the owner of a file:
Code:
Code:
chown username somedir

Note that after giving this command, only the owner of the directory will change. The owner of the files inside of the directory won't change.

In order to set the ownership of a directory and all the files in that directory, you'll need the -R option:
Code:
Code:
chown -R username somedir

Here, R stands for recursive because this command will recursively change the ownership of directories and their contents. After issuing this example command, the user username will be the owner of the directory somedir, as well as every file in that directory.

Tell what happens:
Code:
Code:
chown -v username somefile

changed ownership of 'somefile' to username

Here, v stands for verbose. If you use the -v option, chown will list what it did (or didn't do) to the file.

The verbose mode is especially useful if you change the ownership of several files at once. For example, this could happen when you do it recursively:
Code:
Code:
chown -Rv username somedir

changed ownership of 'somedir/' to username
changed ownership of 'somedir/boringfile' to username
changed ownership of 'somedir/somefile' to username
As you can see, chown nicely reports to you what it did to each file.

chgrp - change the group ownership of a file

In addition to chown, you can also use the chgrp command to change the group of a file or a directory. You must, again, be either the root user or the owner of the file in order to change the group ownership.
chgrp works pretty much the same way as chown does, except it changes the file's user group instead of the owner, of course.
Code:
Code:
chgrp usergroup somefile

After issuing this command, the file somefile will be owned by a user group usergroup. Although the file's group has changed to usergroup, the file's owner will still be the same.
The options of using chgrp are the same as using chown. So, for example, the -R and -v options will work with it just like they worked with chown:
Code:
Code:
chgrp -Rv usergroup somedir

changed group of 'somedir/' to usergroup
changed group of 'somedir/boringfile' to usergroup
changed group of 'somedir/somefile' to usergroup

chown nicely reports to you what it did to each file.

INSTALL ZEND OPTIMIZER/GUARD, AND/OR IONCUBE IN DIRECTADMIN

INSTALL ZEND OPTIMIZER/GUARD, AND/OR IONCUBE IN DIRECTADMIN
For Zend, type:
Code:
Code:
cd /usr/local/directadmin/custombuild
./build set zend yes
./build zend


after changing php versions, it's recommended you install zend again.
Note that Zend Guard is the new name for Zend Optimizer, and is used for newer versions of php. Custombuild will install the correct one for your system.

For Ioncube, type:
Code:
Code:
cd /usr/local/directadmin/custombuild
./build set ioncube yes
./build ioncube


The "./build set" command only sets the option in the options.conf, so you only need to do that once to enable the feature, then install the item after it's enabled.

RPMDB CHECKSUM IS INVALID Directadmin

RPMDB CHECKSUM IS INVALID: PKG CHECKSUMS (DIRECTADMIN)
Rpmdb checksum is invalid: pkg checksums
during yum update
to fix this run the following command as root

Code:
Code:
rpm --rebuilddb

CAN'T LOCATE TIME/HIRES.PM IN

CAN'T LOCATE TIME/HIRES.PM IN @INC (@INC CONTAINS: (DIRECTADMIN)
Can't locate Time/HiRes.pm in @INC (@INC contains: /etc/csf /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at (eval 27) line 2.
BEGIN failed--compilation aborted at (eval 27) line 2.
Using configuration defaults

run the following command as root

Code:
Code:
yum install cpan
cpan -i Time::HiRes
yum install perl-Time-HiRes

Install vzdump using yum on CentOS

Install vzdump using yum on CentOS
CreateCode:
Code:
/etc/yum.repos.d/solusvm.repo

with the following content:

Code:
Code:
[soluslabs]
name=Soluslab Repo
#baseurl=http://repo.soluslabs.com/centos/$releasever/os/$basearch
mirrorlist=http://repo.soluslabs.com/centos/mirrors-soluslabs
gpgcheck=0
enabled=1


then runCode:
Code:
yum install vzdump

and you’re set.

How to secure SSH?

How to secure SSH?
Best Security Practice
The ideal ssh daemon would only allow login via SSH keys. This setup can easily be configured within WHM >>Manage SSH Keys, where you’ll create a SSH key for you to login with. Once you’ve created your key, and verified that you can login with it, you’ll want to go to WHM >> SSH Password Authorization Tweak, which will disable PasswordAuthentication in /etc/ssh/sshd_config.

Medium-security Configuration
If you have clients on your server that require PasswordAuthentication, you can still lock down SSH pretty well.

Open /etc/ssh/sshd_config in your favorite editor
1
Code:
Code:
nano /etc/ssh/sshd_config

Disable direct root loginFirst, be sure that you have an alternate user configured in your environment that you can use to login via SSH. This user must also have privileges to “su” to root.

Then, set the “PermitRootLogin” directive to “no”.

Code:
Code:
PermitRootLogin no

Change the port that sshd listens on

Code:
Code:
Port 221

Be sure to use a port equal to or less than 1024, as these are privileged ports that only root or a super-user can set daemons to listen on. If you were to configure sshd to listen on port 11223, and a user was able to take down sshd, they could then start their own sshd daemon in place of yours.

State which users may login via SSH
If you want to only allow certain users to login via SSH, implement the “AllowUsers” directive:

Code:
Code:
AllowUsers bob frank

This will only allow ‘bob’ and ‘frank’ to login via SSH.

Save and Restart SSH
Now save the file and restart the sshd service:

Code:
Code:
service sshd restart

DirectAdmin File Permission & Ownership Fixed

DirectAdmin File Permission & Ownership Fixed
DirectAdmin File Permission & Ownership Fix!
DirectAdmin File Permission/Ownership script




Run Command :




cd /usr/local/directadmin/scripts



Usage:
./set_permissions.sh all

./set_permissions.sh da_files
./set_permissions.sh user_homes
./set_permissions.sh mysql
./set_permissions.sh email
./set_permissions.sh logs
./set_permissions.sh etc_configs

internal:
./set_permissions.sh maildir <user> <path/Maildir>
./set_permissions.sh set_user_home <user>






Problem as


An error occurred while attempting to create the directory

Details

Parent directory does not allow write, or one of the directories didn't allow search (execution) permission

Friday 25 April 2014

OPTIMIZE MYSQL FOR LOW CPU USAGE AND HIGH PERFORMANCE

OPTIMIZE MYSQL FOR LOW CPU USAGE AND HIGH PERFORMANCE
An unoptimized mysql usualy takes high cpu and a heavy impact on performace.

To optimize the mysql for low cpu load best performance
edit etc/my.cnf

Code:
Code:
nano /etc/my.cnf



and put the following code:

Code:
Code:
[mysqld]
safe-show-database
query_cache_limit=1M
query_cache_size=32M
query_cache_type=1
max_user_connections=25
max_connections=500
interactive_timeout=10
wait_timeout=10
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
thread_concurrency=8
myisam_sort_buffer_size=64M
innodb_file_per_table=1
log-error=/var/log/mysqld-error.log
log-slow-queries=/var/log/mysql-slow.log
long_query_time=1
[mysqld_safe]
nice = -10
open_files_limit = 8192

[mysqldump]
quick
max_allowed_packet = 16M

[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



save it.

Then restart mysql server

Code:
Code:
service mysql restart

How To Optimize Nginx For Maximum Performance

How To Optimize Nginx For Maximum Performance
Nginx is an open-source Web Server. It is a high-performance HTTP server that uses very low server resources, is reliable and integrates beautifully with Linux. In this article, I’ll talk about optimizing your nginx server for maximum performance.

Install Nginx with a minimal number of modulesRun Nginx with only the required modules. This reduces the memory footprint and hence the server performance. Example configuration
.
Code:
/configure --prefix=/webserver/nginx --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module

worker_processesA worker process is a single-threaded process. If Nginx is doing CPU-intensive work such as SSL or gzipping and you have 2 or more CPUs/cores, then you may set worker_processes to be equal to the number of CPUs or cores. Example, i’m running nginx on server has CPU is X3340 (4 cores) then i set worker_processes = 4. If you are serving a lot of static files and the total size of the files is bigger than the available memory, then you may increase worker_processes to fully utilize disk bandwidth.
worker_connectionsThis sets the number of connections that each worker can handle. You can determine the value by using ulimit -n command which output is something like 1024, then your worker connections would need to be set to 1024 or less but 1024 is a good default setting.
You can work out the maximum clients value by multiplying this and the 
Code:
worker_processes settings
max_clients = worker_processes * worker_connections

BuffersOne of the most important things you need to tweak is the buffer sizes you allow Nginx to use. If the buffer sizes are set too low Nginx will have to store the responses from upstreams in a temporary file which causes both write and read IO, the more traffic you get the more of a problem this becomes. Edit and set the buffer size limitations for all clients as follows:
Code:
client_body_buffer_size 8K;
client_header_buffer_size 1k;
client_max_body_size 2m;
large_client_header_buffers 2 1k;
Where,

1. client_body_buffer_size: The directive specifies the client request body buffer size. If the request body is more than the buffer, then the entire request body or some part is written in a temporary file.
2. client_header_buffer_size: Directive sets the headerbuffer size for the request header from client. For the overwhelming majority of requests it is completely sufficient a buffer size of 1K.
3. client_max_body_size: Directive assigns the maximum accepted body size of client request, indicated by the line Content-Length in the header of request. If size is greater the given one, then the client gets the error “Request Entity Too Large” (413).
4. large_client_header_buffers: Directive assigns the maximum number and size of buffers for large headers to read from client request. The request line can not be bigger than the size of one buffer, if the client send a bigger header nginx returns error “Request URI too large” (414). The longest header line of request also must be not more than the size of one buffer, otherwise the client get the error “Bad request” (400).
You also need to control timeouts to improve server performance and cut clients. Edit it as follows:
Code:
client_body_timeout 10;
client_header_timeout 10;
keepalive_timeout 15;
send_timeout 10;
Where,

1. client_body_timeout: Directive sets the read timeout for the request body from client. The timeout is set only if a body is not get in one readstep. If after this time the client send nothing, nginx returns error “Request time out” (408).
2. client_header_timeout: Directive assigns timeout with reading of the title of the request of client. The timeout is set only if a header is not get in one readstep. If after this time the client send nothing, nginx returns error “Request time out” (408).
3. keepalive_timeout: The first parameter assigns the timeout for keep-alive connections with the client. The server will close connections after this time. The optional second parameter assigns the time value in the header Keep-Alive: timeout=time of the response. This header can convince some browsers to close the connection, so that the server does not have to. Without this parameter, nginx does not send a Keep-Alive header (though this is not what makes a connection “keep-alive”).
4. send_timeout: Directive assigns response timeout to client. Timeout is established not on entire transfer of answer, but only between two operations of reading, if after this time client will take nothing, then nginx is shutting down the connection.