Monday, December 21, 2009

How To Add DomainKeys and SPF Records on CPanel Servers

This how to describe how to add domainkeys and SPF (Sender Policy Framework) records on CPanel Servers. Whenever you create a domain on CPanel server using WHM, it wont add domainkeys and SPF records for particular domains. To add domainkeys and SPF records please use following steps.

We consider here we have a domain howtodolinux.com with cpanel username dothelinux

Please note on CPanel servers most of the work is done using cpanel username which then reflect setting on particular domains. If you have several domains / sub domains under one username, it will add domainkeys and SPF records for all domains / subdomains.

Execute the following command on your CPanel server using root.

1 DomainKeys

1.1 Add DomainKeys for single user

/usr/local/cpanel/bin/domain_keys_installer dothelinux

1.2 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


2 SPF (Sender Policy Framework)

2.1 Add SPF for single account.


/usr/local/cpanel/bin/spf_installer dothelinux



2.2 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


3 Enable DomainKeys and SPF for every new CPanel account.

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


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’}”;
system q(/usr/local/cpanel/bin/domain_keys_installer $USER);
system q(/usr/local/cpanel/bin/spf_installer $USER);





Saturday, December 12, 2009

How to Install FFmpeg in Linux

FFmpeg is a very fast video and audio converter. It can also grab from a live audio/video source. FFmpeg is so important if you are planning to run a video website with streaming with conversion of video files to different video formats. This blog is intended for Centos/Redhat versions of Linux where any novice user can install ffmpeg without compiling the source which is a more traditional way of installing the FFmpeg software on linux servers. In this blog i will show you the easy way to install ffmpeg and ffmpeg-php (php extension) with just yum rather than compiling ffmpeg from source files.

Installation

First you need to add a file in yum repository directory for dag packages installation. For this edit the following file:


Vi /etc/yum.repos.d/dag.repo

add the following contents to the file,

[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 enter the command,

yum install ffmpeg ffmpeg-devel

To check what audi/video formats are supported

ffmpeg -formats > ffmpeg-format.txt

Open the ffmpeg-formats.txt to see the ooutput

D means decode
E means encode
V means video
A means audio
T = Truncated

Installation of 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.
For downloading the source tarball click here

or

wget http://biznetnetworks.dl.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2

Extract the souce tarball.

tar -xjf ffmpeg-php-0.6.0.tbz2

cd ffmpeg-php-0.6.0/

phpize

Some time you will get an error like "Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable is set correctly and then rerun this script."

YOU CAN SEE THE FIX OF THIS ERROR UNDER COMMON ERRORS.

./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

vi /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

// # vi test.php


phpinfo();

?>

Picture.................................................paste here...

If any case the ffmpeg does not show in the phpinfo() test make sure that php.ini path to ffmpeg.so is correct. Still the problem occures, the reason could be you might be using older version of ffmpeg-php which is buggy. just download the latest version of ffmpeg-php sourse then complile it.

Common Errors

1. If you get command not found error for phpize, then you will need to do yum install php-devel

2.

2. If you get error like "ffmpeg headers not found" while configuring the source.

configure: error: ffmpeg headers not found. Make sure ffmpeg is compiled as shared libraries using the --enable-shared option

then it means you have not installed ffmpeg-devel packages.

To Fix: Just install ffmpeg-devel using

yum install ffmpeg-devel

3. If you get an error like shared libraries not found problem and the program halts in the middle, then you must specify the ffmpeg installed path explicitly to the ./configure.

A) configure: error: ffmpeg shared libraries not found. Make sure ffmpeg is compiled as shared libraries using the --enable-shared option

To Fix:

1. First find out the ffmpeg path with ffmpeg --help command. The prefix default path should be like /usr/local/cpffmpeg
2. Conf./configure --with-ffmpeg=/usr/local/cpffmpeg

That should resolve the problem!


B)


Installing Mplayer + Mencoder

Just issue the following yum commands to install the rest of the packages.

yum install mplayer mencoder

Installing FlvTool2

Flvtool2 is a flash video file manipulation tool. It can calculate metadata and can cut and edit cue points for flv files.

yum install flvtool2

Installing LAME MP3 Encoder, Libogg, LIBVORBIS

LAME is a high quality MPEG Audio Layer III (MP3) encoder licensed under the LGPL. Both quality and speed improvements are still happening, probably making LAME the only MP3 encoder still being actively developed.

yum install lame libogg libvorbis