Friday, 2 May 2014

Linux change the speed and duplex settings of an Ethernet card

Q. How do I change the speed, duplex on for my Ethernet card?
A. Under Linux use mii-tool or ethtool package which allows a Linux sys admin to modify/change and view the negotiated speed of network interface card (NIC) i.e. it is useful for forcing specific Ethernet speed and duplex settings.
Depending on which type of Ethernet card is installed on the system you need to use eithermii-tool or ethtool. I recommend installing both and use one of the tool, which will work with your card.

Task: Install mii-tool and ethtool tools

If you are using Debian Linux you can install both of these package with following command:# apt-get install ethtool net-toolsIf you are using Red Hat Enterprise Linux you can install both of these package with following command:# up2date ethtool net-toolsIf you are using Fedora Core Linux you can install both of these package with following command:# yum install ethtool net-tools

Task: Get speed and other information for eth0

Type following command as root user:
# ethtool eth0Output:
Settings for eth0:
     Supported ports: [ TP MII ]
     Supported link modes:   10baseT/Half 10baseT/Full
                             100baseT/Half 100baseT/Full
     Supports auto-negotiation: Yes
     Advertised link modes:  10baseT/Half 10baseT/Full
                             100baseT/Half 100baseT/Full
     Advertised auto-negotiation: Yes
     Speed: 100Mb/s
     Duplex: Full
     Port: MII
     PHYAD: 32
     Transceiver: internal
     Auto-negotiation: on
     Supports Wake-on: pumbg
     Wake-on: d
     Current message level: 0x00000007 (7)
     Link detected: yes
Or use mii-tool command as follows:# mii-tool eth0Output:
eth0: negotiated 100baseTx-FD flow-control, link ok

Task: Change the speed and duplex settings

Setup eth0 negotiated speed with mii-tool
Disable autonegotiation, and force the MII to either 100baseTx-FD, 100baseTx-HD, 10baseT-FD, or 10baseT-HD:# mii-tool -F 100baseTx-HD
# mii-tool -F 10baseT-HD
Setup eth0 negotiated speed with ethtool# ethtool -s eth0 speed 100 duplex full
# ethtool -s eth0 speed 10 duplex half
To make these settings permanent you need to create a shell script and call from /etc/rc.local(Red Hat) or if you are using Debian create a script into the directory /etc/init.d/ directory and run update-rc.d command to update the script.
---------------------------------------------------------------------------------------------------------------------
 
 
How to get wired LAN running at FULL-DUPLEX
At the Linux Terminal, type:
sudo ethtool eth0
This will tell you the properties of the wired config. If Duplex is showing half, then type:
sudo ethtool -s eth0 autoneg off
sudo ethtool -s eth0 duplex full
Finally, type to view final configuration:
sudo ethtool eth0

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]