Friday, July 31, 2009

Upgrading Mysql on a plesk server

Uprading MySQL with plesk is not that hard as it sounds and this guide will prove it to you. Below are the steps you need to execute to upgrade your current MySQL version to the latest release. In this guide, we will going to use MySQL version 4.1 but other versions will work as well.

Backup the following files and directory before doing any of the steps below.

/var/lib/mysql - directory where mysql data is stored.

/etc/my.cnf - default mysql configuration file.

/etc/init.d/mysqld - mysql initialization script.

1. Download the pre-compiled MySQL server binaries.

wget -c http://dev.mysql.com/get/Downloads/MySQL-4.1/mysql-standard-4.1.22-pc-linux-gnu-i686-icc-glibc23.tar.gz/from/http://mirror.services.wisc.edu/mysql/

2. Move and decompress the download file.

mv mysql-standard-4.1.22-pc-linux-gnu-i686-icc-glibc23.tar.gz /usr/local/

cd /usr/local

tar -vxzf mysql-standard-4.1.22-pc-linux-gnu-i686-icc-glibc23.tar.gz

3. Create a symbolic link of the decompressed files folder to MySQL folder.

ln -s /usr/local/mysql-standard-4.1.22-pc-linux-gnu-i686-icc-glibc23 mysql

4. Edit the mysqld rc file under /etc/init.d

vi /etc/init.d/mysqld

change the mysql server path from /usr/bin to /usr/local/mysql/bin (e.g /usr/local/mysql/bin/safe_mysqld)

5. Add the following lines to the my.cnf file.

[mysqladmin]
socket=/var/lib/mysql/mysql.sock

[mysql]
socket=/var/lib/mysql/mysql.sock [mysql_fix_privilege_tables]
socket=/var/lib/mysql/mysql.sock

6. Stop and Start MySQL server process.

service stop mysqld

service start mysqld

7. Verify that you are able to connect to the mysql server.

mysql -u admin -p your_plesk_admin_password

mysql> select version();
+—————–+
version()
+—————–+
4.1.22-standard
+—————–+
1 row in set (0.00 sec)

That's all about it, if you encounter any errors just drop a message via the comment box.

Friday, July 24, 2009

SCRIPT TO MONITOR A SERVER IN EVERY 30 MINUTES

This script is used to check the health of Your servers.
# !/bin/bash
# add ip / hostname separated by while space 
HOSTS="aaa.com bbb.com 202.10.193.46 router"
# no ping request
COUNT=1
# email report when 
SUBJECT="Ping failed Server Seems to be DOWN"
EMAILID="Your emailid"
for myHost in $HOSTS
do
count=$(ping -c $COUNT $myHost | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }')
if [ $count -eq 0 ]; then
# 100% failed 
echo "Host : $myHost is down (ping failed) at $(date)" | mail -s "$SUBJECT" $EMAILID

Apache Error - No space left on device: Couldn't create accept lock or Cannot create SSLMutex

Some times you people may face this following error in your Apache Server. The error is as follows while trying to restart.after a configuration changes or something like that

[emerg] (28)No space left on device: Couldn't create accept lock
OR
[crit] (28)No space left on device: mod_rewrite: could not create rewrite_log_lock Configuration Failed
OR
[Wed Dec 07 00:00:09 2005] [error] (28)No space left on device: Cannot create SSLMutex

This is happened due to someking of memory leaking. Normally people do the following to fix this.

1.Checking the harddisk space usage
2.To explicetely different Lockfiles using the LockFile-directive
3.non-default AcceptMutex (flock) which then solved the acceptlock-issue and ended in the rewrite_log_lock-issue.
4.Reboot

The fourth option will only work,because this is due to the following reason
There were myriads of semaphore-arrays left, owned by my apache-user. Removing this semaphores immediately solved the problem
Do the following as ROOT

[root@apache.org] ipcs -s | grep apache | perl -e 'while () { @a=split(/\s+/); print `ipcrm sem $a[1]`}' -- (If You Love Perl)

[root@apache.org] ipcs -s | grep apache | awk ' { print $2 } ' | xargs ipcrm sem (If you Love Sh)

How to Find Server is Under DDOS

A denial-of-service attack (DoS attack) or distributed denial-of-service attack (DDoS attack) is an attempt to make a computer resource unavailable to its intended users. Although the means to carry out, motives for, and targets of a DoS attack may vary, it generally consists of the concerted efforts of a person or persons to prevent an Internet site or service from functioning efficiently or at all, temporarily or indefinitely. Perpetrators of DoS attacks typically target sites or services hosted on high-profile web servers such as banks, credit card payment gateways, and even root nameservers.


netstat -anp | grep "tcp\|udp" | awk {'print $5'} | cut -d: -f1 | uniq -c | sort -n


So what will be the output ?

1 0.0.0.0
1 208.80.152.2
1 208.80.152.2
1 208.80.152.3
1 209.85.135.103
1 209.85.135.113
1 74.125.43.113
2 208.80.152.2
2 208.80.152.3
2 208.80.152.3
3 0.0.0.0
3 208.80.152.2

Left column indicates the number of connection,from the IP address which shown in right column. This was taken from my local test machine. If you are under an attack,this number may vary. The number will be any number.

How to edit the maxconnection in httpd.conf ?

Depending on the cPanel version, you can modify the setting in WHM > Apache Configuration > Global Configuration > MaxClients
Login to the ssh as root and open the file httpd.conf file.

vi /usr/local/apache/conf/httpd.conf
search for the line MaxClients and edit that, save it and exit vi editor. Restart apache then.
 

Saturday, June 20, 2009

Fixing incorrect quota on cpanel

Run #/scripts/fixquotas
For fixing everuthing including mail boxes and DNS,

#/scripts/fixeverything

If it is showing any error about permission of writing on aquota.user file check its permissions and attributes.

#lsattr aquota.user

To remove attribute

#chattr -i aquota.user
---------------------------------------------------------------------------------
Please check for any spelling mistakes on my commands
-----------------------------------------------------------------------------------

Friday, June 19, 2009

Troubleshooting php installations/compilations on Linux servers

It's very easy to install PHP or Apache software using yum or rpm on plain Linux servers. It installs all the necessary dependency packages automatically, we don’t need to install such dependent or development packages manually.

RPM’s are standard packages which are pre-compiled with some basic settings/modules but some of application needed the extra module which doesn’t exit in pre-compiled rpm, in such case you will have to recompile the php-apache manually. Compiling any application from source is always the right idea. Though time consuming and sometimes painful, it allows you the privilege of setting the required modules.

Here are some command errors which occur while installing/compiling/building PHP 5 manually on Linux Servers, you can fix them by installing appropriate development modules.

1) Configure: error: xml2-config not found. Please check your libxml2 installation.

Solutions :

Quote:
#yum install libxml2-devel

2) Checking for pkg-config... /usr/bin/pkg-config
configure: error: Cannot find OpenSSL's

Solutions :

Quote:
#yum install openssl-devel

3) Configure: error: Please reinstall the BZip2 distribution

Solutions :

Quote:
# yum install bzip2-devel

4) Configure: error: Please reinstall the libcurl distribution -
easy.h should be in /include/curl/

Solutions :

Quote:
# yum install curl-devel

5) Configure: error: libjpeg.(also) not found.

Solutions :

Quote:
# yum install libjpeg-devel

6) Configure: error: libpng.(also) not found.

Solutions :

Quote:
# yum install libpng-devel

7) Configure: error: freetype.h not found.
Solutions :

Quote:
#yum install freetype-devel

8) Configure: error: Unable to locate gmp.h

Solutions :

Quote:
# yum install gmp-devel

9) Configure: error: Cannot find MySQL header files under /usr.
Note that the MySQL client library is not bundled anymore!

Solutions :

Quote:
# yum install mysql-devel

10) Configure: error: Please reinstall the ncurses distribution

Solutions :

Quote:
# yum install ncurses-devel

11) Checking for unixODBC support... configure: error: ODBC header file '/usr/include/sqlext.h' not found!

Solutions :

Quote:
# yum install unixODBC-devel

12) Configure: error: Cannot find pspell

Solutions :

Quote:
# yum install pspell-devel

13) Configure: error: snmp.h not found. Check your SNMP installation.

Solutions :

Quote:
# yum install net-snmp-devel

What is Mod-Rewrite Module and How to enable ?

What is Mod-Rewrite Module?

Mod_rewrite is merely the Apache module that contains the rewrite engine - other servers will process URL rewriting differently.Mod-Rewrite module uses a rule-based rewriting engine (based on a regular-expression parser) to rewrite requested URLs on the fly. It supports an unlimited number of rules and an unlimited number of attached rule conditions for each rule to provide a really flexible and powerful URL manipulation mechanism.

The RewriteEngine directive enables or disables the runtime rewriting engine. We need to tell Apache where and what to rewrite. You have two options here - more commonly, you can place the code in a .htaccess file. This is nothing more than a text file which when present in a directory will be interpreted by Apache.The other alternative is only available if you have root access and that is to place the code inside your httpd.conf

How can I enable Mod-Rewrite Module?

Before we can rewrite, there is one option we must first set: FollowSymLinks. This is a security feature of the rewrite engine and you will not be able to rewrite without this option. In most cases, this will already be set in the server httpd.conf but you can safely state it again.Additionally, if you use indexes, we must enable the Indexes option.

In order to enable Mod_Rewrite for your site you should create a text file called .htacccess in the directory where you wish the rewrite rules to apply.
================================================== ==========
#The first three lines of this text file should be:
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
#After that you can place your rewrite rules
================================================== ===========

RewriteRule example :=

1] When you want Register a Domain, Find Hosting and Create a Website at Domain.com to be redirected to Register a Domain, Find Hosting and Create a Website at Domain.com, add the following in your .htaccess.


Quote:
RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]

2] If http://example.com/foo/bar does not exist, redirect to http://other.example.com/foo/bar. (Put this in an .htaccess file in your top-level web directory.)


Quote:
# .htaccess in root of example.com
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://other.example.com/$1 [R]

3] Handle all requests for top-level .html files and files with no extensions (http://example.com/foo, http://example.com/foo.html) with a single PHP program /foo/show.php. Also, ignore trailing characters in set { : ; , . } so URLs like "http://example.com/foo." can be copied-n-pasted from plain text sentences by inattentive users.


Quote:
# .htaccess in root of example.com
RewriteRule ^/?([^/]*\.html?|[^\./]*)[:;,\.]*$ /foo/show.php [L,NS]
4]Here are some examples for Joomla's SEF option:


Quote:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$ [NC]
RewriteRule ^(content/|component/) index.php

5]Redirect GET requests for http://example.com/foo/bar to http://example.com/bar (and /foo/bar.html to /bar.html). Handle POST requests with PHP program rather than attempting to redirect a POST (which is unlikely to work well).


Quote:
# .htaccess in foo folder in example.com's document root
RewriteEngine On
RewriteCond %{REQUEST_METHOD} GET
RewriteRule ^/?([^/]*\.html?|[^\./]*)[:;,\.]*$ /$1 [R,L,NS]
RewriteCond %{REQUEST_METHOD} POST
RewriteRule ^/?([^/]*\.html?|[^\./]*)[:;,\.]*$ /foo/show.php [L,NS]

What is DNS and types of DNS?

What is DNS?

Domain Name System (DNS) is a database system that translates a computer's fully qualified domain name into an IP address.
Networked computers use IP addresses to locate and connect to each other, but IP addresses can be difficult for people to remember. For example, on the web, it's much easier to remember the domain name www.eukhost.com than it is to remember its corresponding IP address (213.175.192.12).
DNS allows you to connect to another networked computer or remote service by using its user-friendly domain name rather than its numerical IP address. Conversely, Reverse DNS (rDNS) translates an IP address into a domain name.

Types of DNS

Domain name system translate domain name to ip address. There are different types of dns server available we can install any of them as per our requirement.

1) BIND -> BIND is the reference implementation of a DNS server and usually serves as the base for experimentation with DNS protocol extensions. BIND is free and has been ported to many operating systems; see the respective entries in the index. Most BIND servers run on some variant of Unix, although BIND on Windows is also available.
Url:- http://www.bind9.net/download

2) djbdns:- The two main name server functions of caching and acting as an authoritative server are sensibly split into two separate programs (dnscache and tinydns). The djbdns package is free, and comes with a $500 security guarantee. http://http://www.djbdnsrocks.org/single/download.htm

3) ANS/CNS:- ANS/CNS full form is Authoritative Name Server/ Caching Name Server. ANS/CNS are commercial DNS servers from Nominum, for enterprise applications that need maximum performance. Url:- http://www.nominum.com/products.php?id=6

4) PowerDNS:- PowerDNS has developed a complete suite of technologies surrounding Internet Naming and email. Internet Naming is at the core of all online activities and is involved in each and every transaction on the net.
Url:- http://www.powerdns.com/

5) NSD:- NSD full form is Name Server Daemon. NSD is an authoritative only, high performance, simple and open source name server. Url:- http://www.nlnetlabs.nl/

6) MaraDNS:- MaraDNS is a package that implements the Domain Name Service (DNS), an essential internet service. MaraDNS is easy to use highly secure. Url:- http://www.maradns.org/

7) MyDNS:- MyDNS is a free DNS server for UNIX. MyDNS does not include recursive name service, nor a resolver library. It is primarily designed for organizations with many zones and/or resource records who desire the ability to perform real-time dynamic updates on their DNS data via MySQL. Url:- http://mydns.bboy.net/

8) RBLDNSD :- Meaning is “DNS daemon suitable for running DNS-based blocklists”. rbldnsd is a small DNS-protocol daemon which is designed to handle queries to DNS-based IP-listing or NAME-listing services. Such services are a simple way to share/publish a list of IP addresses or (domain) names which are “listed” for for some reason, for example in order to be able to refuse a service to a client which is “listed” in some blocklist. Url:- http://www.corpit.ru/mjt/rbldnsd.html

9) Pdnsd:- pdnsd is a proxy DNS server that caches entries permanently to disk. pdnsd allows you to configure one address as the DNS server for all your internet software. This can be localhost, but I personally use a separate machine that I’ve configured as a gateway to the internet for my home LAN. pdnsd can then be configured to contact your ISP’s DNS servers when you make a dial-up connection. Url:- http://www.phys.uu.nl/~rombouts/pdnsd.html

10) Dents:- Dents is a from scratch implementation of the server side of the Domain Name System (DNS) protocol and it shares no code with any other project. Among its several features are compatibility with the named DNS daemon, a modular driver system and an extensible control facility which allows the administrator to control the running server. Url:- http://sourceforge.net/projects/dents/ or http://www.europe.redhat.com/documen....1-1.i386.php3

11) Microsoft’s DNS server :- The DNS server in Windows 2003 has seen increasing adoption since its first release for Windows 2000 in 1999. It is regarded as stable and is well-integrated with Microsoft’s server administration tools.
Url:- http://www.microsoft.com/downloads/d...displaylang=en

12) Simple DNS Plus:- Simple DNS Plus is commercial software for Windows (any version from Windows 95 to 2003). It seems fully functional and targeted to small sites and home users with permanent Internet connections. It has some innovative features, but I have no first hand experience with it. Url:- http://www.simpledns.com

Some useful commands to manage an Exim server.

The message-IDs that Exim uses to refer to messages in its queue are mixed-case alpha-numeric, and take the form of: XXXXXX-YYYYYY-ZZ. Below bold alpha-numeric letters is message-IDs [it's just for an example]

Quote:
2008-11-05 12:37:22 1KxhdN-0000VQ-Uq => supp0rt R=virtual_user T=virtual_userdelivery
2008-11-05 12:37:22 1KxhdN-0000VQ-Uq Completed

Most commands related to managing the queue and logging use these message-ids.

Files in /var/spool/exim/msglog contain logging information for each message and are named the same as the message-id.

Files in /var/spool/exim/input are named after the message-id, plus a suffix denoting whether it is the envelope header (-H) or message data (-D).

Here are some useful exim commands. These commands are useful, if you have an overloaded queue and need to clear it out.

Print a count of the messages in the queue

Quote:
root@supp0rt007# exim -bpc

Try to send the message with id

Quote:
root@supp0rt007# exim -M id

Count how many frozen mails in the queue

Quote:
root@supp0rt007# exim -bpr | grep frozen | wc -l

Delete frozen mails in the queue

Quote:
root@supp0rt007# exim -bpr | grep frozen | awk {'print $3'} | xargs exim -Mrm

To deliver all emails forcefully

Quote:
root@supp0rt007# exim -qff -v -C /etc/exim.conf &

Print a summary of messages in the queue (count, volume, oldest, newest, domain, and totals)

Quote:
root@supp0rt007# exim -bp | exiqsumm

Generate and display Exim stats from a logfile

Quote:
root@supp0rt007# eximstats /var/log/exim_mainlog

Generate and display Exim stats from a logfile, for one particular day

Quote:
root@supp0rt007# grep 2008-11-04 /var/log/exim_mainlog | eximstats

redirect for domain by using following RewriteRule entry in .htaccess

----------------------------------------------------------------
RewriteEngine on
RewriteCond %{HTTP_HOST} ^xyz.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.xyz.com$
RewriteRule ^(.*)$ http://www.xyz.com/test//$1 [R=301,L]
-----------------------------------------------------------------
If you do not want to change the address bar url chage R to P.

Removing Mysql sleep processes.

#mysqladmin processlist
#cd /var/lib/mysql/
#mysqlcheck -r eximstats
#myisamchk -r eximstats/*
#mysqladmin processlist

Apache error logs.

Kill -9 PID
ps aufx | grep nobody

tail -f /usr/local/apache/logs/access_log :-
tail -f /usr/local/apache/logs/error_log :- site access error logs
tail -f /var/log/exim_mainlog :- mail logs.
usr/local/apache/logs :: access log, error log, if configured php logs, domain logs(domlogs),module logs, httpd pid
tail -f /usr/local/apache/logs/access_log fro httpd

/var/log/
* /var/log/message: Genreal message and system releated stuff
* /var/log/auth.log: Authenication logs
* /var/log/kern.log: Kernel logs
* /var/log/cron.log: Crond logs
* /var/log/maillog: Mail logs
* /var/log/qmail/ : Qmail log directory (more files inside this directory)
* /var/log/httpd/: Apache access and error logs directory
* /var/log/lighttpd: Lighttpd access and error logs directory
* /var/log/boot.log : System boot log
* /var/log/mysqld.log: MySQL database server log file
* /var/log/secure: Authentication log
* /var/log/utmp or /var/log/wtmp : Login records file
* /var/log/yum.log: Yum log files


For spamming issue or high mail queue you can check the logs

tail -f /var/log/exim_mainlog | grep sendmail, public_html, tmp

MYSQL:-

mysqladmin processlist :- shows current mysql database usage

watch mysqladmin processlist :- dynamic usage of mysql process .

Service restart commands- /scripts/restartsrv_servicename
restartsrv_entropychat*
restartsrv_exim*
restartsrv_eximstats*
restartsrv_ftpserver*
restartsrv_httpd*
restartsrv_imap*
restartsrv_inetd*
restartsrv_interchange*
restartsrv_ipaliases*
restartsrv_melange*
restartsrv_mysql*
restartsrv_named*
restartsrv_nsd*
restartsrv_postgres*
restartsrv_postgresql*
restartsrv_proftpd*
restartsrv_pureftpd*
restartsrv_rsyslogd*
restartsrv_spamd*
restartsrv_sshd*
restartsrv_syslogd*
restartsrv_tailwatchd*
restartsrv_tomcat*
restartsrv_xinetd*
User-agent: Mediapartners-Google
Disallow:

User-agent: *
Disallow: /search

Sitemap: http://jacobmukalel.blogspot.com/feeds/posts/default?orderby=updated

Thursday, June 18, 2009

cPanel Mail Issues

The below has been known to fix most cPanel mail issues. They can range from spamd failed messages to exim just flat out not working at all.

/scripts/perlinstaller Digest::SHA1
/scripts/perlinstaller --force Mail::SpamAssassin
/scripts/fixspamassassinfailedupdate
/scripts/updatenow
/scripts/installspam --force
/scripts/exim4 --force

/etc/rc.d/init.d/exim restart
/scripts/restartsrv spamd
/etc/rc.d/init.d/chkservd restart

Installing FFMPEG

Go to your installation folder.


cd /usr/local/src

1. Lame MP3 encoder

Pure install of FFmpeg is not enough, the FLV (Flash Video Files) converted has no audio, because FLV audio codec is mp3, so you need LAME support.

Download from sourceforge.net

wget http://nchc.dl.sourceforge.net/sourceforge/lame/lame-3.96.tar.gz
tar xvzf lame-3.96.tar.gz
cd lame-3.96
./configure –enable-shared –prefix=/usr
make
make install

enable-shared to make sure FFmpeg can use LAME later. Type lame in command line to see help after install succeed.

Go to your installation folder.

cd /usr/local/src

2. Install subversion via yum, rpm or up2date (things are easier with Subversion).

For eg: If the server has yum installed, the following command would suffice.

yum install subversion

3. Download ffmpeg using subversion

svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg

cd ffmpeg


./configure –enable-gpl –enable-shared –enable-libmp3lame


==============================
If you are getting the following error

“Unable to create and execute files in /tmp. Set the TMPDIR environment…”
Try to unmount /tmp OR

mkdir /test ; chmod 777 /test
vi configure edit TMPDIR to /test
and execute it once again

====================
make
make install

Go to your installation folder.

cd /usr/local/src

4. Install Ruby (FLVTool2 is written in Ruby, so you have to install Ruby in server too)

FLVTool2 is a manipulation tool for Macromedia Flash Video files (FLV). It can calculate a lot of meta data, insert an onMetaData tag, cut FLV files, add cue points (onCuePoint), show the FLV structure and print meta data information in XML or YAML.

Download from Ruby site, type the following command to compile and install it:

./configure
make
make install

Note: if you have yum installed, just use

yum install ruby

Go to your installation folder.

cd /usr/local/src

5. Install FLVTool2

Download from FLVTool2 site, type the following command to compile and install it:

wget http://rubyforge.org/frs/download.php/9225/flvtool2_1.0.5_rc6.tgz
tar xvzf flvtool2_1.0.5_rc6.tgz
cd flvtool2_1.0.5_rc6/
ruby setup.rb config
ruby setup.rb setup
ruby setup.rb install

Type flvtool2 in command line to see help after install succeed.

Go to your installation folder.

cd /usr/local/src

6. Install ffmpeg-php

wget http://downloads.sourceforge.net/ffmpeg-php/ffmpeg-php-0.5.3.1.tbz2?modtime=1213135005&big_mirror=0
tar xjvf ffmpeg-php-0.5.3.1.tbz2
cd ffmpeg-php-0.5.3.1

phpize
./configure && make
make install

You will get a message as follows, which mention the path

############################
/usr/local/src/ffmpeg-php-0.5.3.1/modules/ffmpeg.so
cp ./.libs/ffmpeg.lai /usr/local/src/ffmpeg-php-0.5.3.1/modules/ffmpeg.la
PATH=”$PATH:/sbin” ldconfig -n /usr/local/src/ffmpeg-php-0.5.3.1/modules
———————————————————————-
Libraries have been installed in:
/usr/local/src/ffmpeg-php-0.5.3.1/modules

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

This creates the ffmpeg.so file. Include this extension in your php.ini file.
extension=ffmpeg.so

You can find the php.ini that the the server is using with the following command.

php -i |grep php.ini

Make sure that the php.ini has the above mentioned extension directory. Also note the PATH where the shared libraries loaded.

Go to your installation folder.

cd /usr/local/src

7. Libogg + Libvorbis

Download libogg from http://downloads.xiph.org/releases/ogg/

wget http://downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz
tar xvzf libogg-1.1.3.tar.gz
cd /usr/local/src/libogg-1.1.3
./configure && make && make install


Go to your installation folder.

cd /usr/local/src

Download Libvorbis from http://downloads.xiph.org/releases/ogg/

wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.1.2.tar.gz
tar xvzf libvorbis-1.1.2.tar.gz
cd /usr/local/src/libvorbis-1.1.2
./configure && make && make install


Go to your installation folder.

cd /usr/local/src

8. Mplayer & Codecs

wget http://www.mplayerhq.hu/MPlayer/releases/codecs/essential-20071007.tar.bz2
tar xjvf essential-20071007.tar.bz2
mv /usr/local/src/essential-20071007/ /usr/local/lib/codecs/
chmod -R 755 /usr/local/lib/codecs/
Go to your installation folder.

cd /usr/local/src


wget http://www1.mplayerhq.hu/MPlayer/releases/MPlayer-1.0rc1.tar.bz2
tar xjvf MPlayer-1.0rc1.tar.bz2
cd MPlayer-1.0rc1/
./configure
make
make install


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

For more information and FAQs,

http://ffmpeg.mplayerhq.hu/faq.html

Click here for the steps to install FFmpeg and FFmpeg-php in a Linux ( RHEL, CentOS, Fedora) Server.
Common Issues & fixes :
1) If you are getting the following error while running ffmpeg in shell, try the following.

ffmpeg: error while loading shared libraries: libavdevice.so.52: cannot open shared object file: No such file or directory

A)
Step 1: Check if the file “libavdevice.so.52″ exists in the server using the following command.

find / -name ‘libavdevice.so.*’

Step 2: You will get the directory in which the file “libavdevice.so.52″ exists from the above command.
Suppose the directory is “/usr/local/lib/” in this example.

Step 3: You have to add the directory name in the file “/etc/ld.so.conf”.

Step 4: Execute the command “ldconfig”.

OR

B)
export LD_LIBRARY_PATH=/usr/local/lib:LD_LIBRARY_PATH

But this value will be cleared once you log off that session.

So it is better to save this value in bashrc

vi .bashrc
LD_LIBRARY_PATH=/usr/local/lib

After closing the file execute the command : bash

2)

If you are getting the following errors while installing ffmpeg


"checking for ffmpeg headers... configure: error: ffmpeg headers not
found. Make sure you've built ffmpeg as shared libs using the --enable-
shared option"

Check whether “/usr/local/include/ffmpeg” directory is created while installing ffmpeg.
If not, create this directory.

mkdir /usr/local/include/ffmpeg

Copy the necessary ffmpeg header files to “/usr/local/include/ffmpeg”.

cp -p /usr/local/src/ffmpeg/libavformat/avio.h /usr/local/include/ffmpeg
cp -p /usr/local/src/ffmpeg/libavformat/avformat.h /usr/local/include/ffmpeg
cp -p /usr/local/src/ffmpeg/libavcodec/avcodec