Archive for June, 2009

Checking the configuration of named.conf and zone files

The bind package has utilities to check the syntax of named.conf and any zone files. We can make use of those binaries to check our modifications done to those files before reloading or restarting named service.

To check the sytax of zone file /var/named/serverbuddies.com.db

[root@bash ~]# named-checkzone kb.com /var/named/serverbuddies.com.db
zone serverbuddies.com.db/IN: loaded serial 2006032401
OK

If everything is correct, it will show the serial number with which the zone file is loaded. Otherwise, it will give error message indicating the line number at which the error occured.

To check the syntax of named.conf file,

[root@bash ~]# named-checkconf /etc/named.conf

You may also load the configuration of all master zones listed in named.conf at the time of checking the syntax as,

[root@bash ~]# named-checkconf -z /etc/named.conf

The command will show a detailed output in case any error in named.conf file.

This way we can make sure that we are not editing the configuration file wrongly.

SBDavid

FFMPEG in Debian

FFMPEG in Debian

Install the essentials

apt-get update
apt-get upgrade
apt-get install libjpeg-progs libjpeg62 libjpeg62-dev libsdl1.2-dev php5-dev build-essential

Create a directory and download all the files inside it

cd /usr/local/ffmpeg
wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/essential-20061022.tar.bz2
wget http://rubyforge.org/frs/download.php/9225/flvtool2_1.0.5_rc6.tgz
wget http://easynews.dl.sourceforge.net/sourceforge/lame/lame-3.97.tar.gz
wget http://superb-west.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.5.0.tbz2
wget http://downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.1.2.tar.gz
wget http://ftp.penguin.cz/pub/users/utx/amr/amrnb-6.1.0.4.tar.bz2

Extract all the files

tar zxvf flvtool2_1.0.5_rc6.tgz
tar zxvf lame-3.97.tar.gz
tar zxvf libogg-1.1.3.tar.gz
tar zxvf libvorbis-1.1.2.tar.gz
tar zxvf flvtool2_1.0.5_rc6.tgz
tar jxvf essential-20061022.tar.bz2
tar jxvf ffmpeg-php-0.5.0.tbz2
bzip2 -cd amrnb-6.1.0.4.tar.bz2 | tar xvf -

We need a codec directory

mkdir /usr/local/lib/codecs/

Install Ruby on Rails, subversion & ncurses

apt-get install subversion ruby libcurses-ruby

Run some SVN queries

svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
cd /usr/local/src/mplayer
svn update

Copy Codecs for mplayer

mv /usr/local/ffmpeg/essential-20061022/* /usr/local/lib/codecs/
chmod -R 755 /usr/local/lib/codecs/

We also need to secure the tmp directory

mkdir /usr/local/ffmpeg/tmp
chmod 777 /usr/local/ffmpeg/tmp
export TMPDIR=/usr/local/ffmpeg/tmp

Install lame

cd /usr/local/ffmpeg/lame-3.97
./configure
make && make install

Install libogg

cd /usr/local/ffmpeg/libogg-1.1.3
./configure && make && make install

Install libvorbis

cd /usr/local/ffmpeg/libvorbis-1.1.2
./configure && make && make install

Install flvtool2

cd /usr/local/ffmpeg/flvtool2_1.0.5_rc6/
ruby setup.rb config
ruby setup.rb setup
ruby setup.rb install

Install mplayer & mencoder

cd /usr/local/ffmpeg/mplayer
./configure –enable-jpeg
make && make install

Install AMR (for 3gp conversion)

cd /usr/local/ffmpeg/amrnb-6.1.0.4
./configure
make && make install

Install ffmpeg

cd /usr/local/ffmpeg/ffmpeg/
./configure –enable-libmp3lame –enable-libogg –enable-libvorbis –disable-mmx –enable-shared –enable-amr-nb
make
make install
ln -s /usr/local/lib/libavformat.so.50 /usr/lib/libavformat.so.50
ln -s /usr/local/lib/libavcodec.so.51 /usr/lib/libavcodec.so.51
ln -s /usr/local/lib/libavutil.so.49 /usr/lib/libavutil.so.49
ln -s /usr/local/lib/libmp3lame.so.0 /usr/lib/libmp3lame.so.0
ln -s /usr/local/lib/libavformat.so.51 /usr/lib/libavformat.so.51
ln -s /usr/local/lib/libamrnb.so.2 /usr/lib/libamrnb.so.2

Install ffmpeg-php

cd /usr/local/ffmpeg/ffmpeg-php-0.5.0/
phpize
./configure
make
make install

You now need to add the new ffmpeg-php module to the php.ini file

pico /etc/php5/apache2/php.ini
extension=ffmpeg.so (add this line to the end of the file)

Restart & done

/etc/init.d/apache2 restart

Verify your work:

php -r ‘phpinfo();’ | grep ffmpeg

How to bind secondary IP addresses in Debian Server.

There is slight difference in binding secondary IP addresses in Debian server to that of a Redhat Linux server.

Open file /etc/network/interfaces
Contents of the file looks like

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.0.2
netmask 255.255.255.xyx
gateway 192.168.0.1

Suppose we wants to add an IP 192.168.0.3 add the following to /etc/network/interfaces.

auto eth0:1
iface eth0:1 inet static
address 192.168.0.3
netmask 255.255.255.xyx
gateway 192.168.0.1

Now run the command

ifup eth0:1

This will add Ip 192.168.0.3 in ifconfig output.

To add next secondary IP the next set of entry should be

auto eth0:2
iface eth0:2 inet static
address 192.168.0.4
netmask 255.255.255.xyx
gateway 192.168.0.1

Then Run

ifup eth0:2

These IP addresses are bounded to eth0 that is to the first NIC.
If you wants to bind the IP to the second network card the entry should be eth1:1 instead of eth0:1

Finally check whether the IP addresses are listed in the ifconfig output.

Enable service at boot time on debian server

To enable the a service on debian server at boot time you can use the following commands

update-rc.d service_name start NN runlevel . stop NN runlevel

where NN decide which order to run the scripts in the /etc/init.d folder.

Example

update-rc.d httpd start 20 2 3 4 5 . stop 20 0 1 6 .
update-rc.d httpd defaults

Both the command will start httpd service in run-levels 2, 3, 4, and 5, and stop the service in run-levels 0, 1, and 6.

To stop a service from starting on bootup, execute the command

update-rc.d –f service_name remove
Example: update-rc.d -f httpd remove

This command will stop the service httpd from starting when the server is booted.

To manually start a service you can use the command

/etc/init.d/httpd restart
invoke-rc.d httpd restart

How to upgrade apache in a directadmin server

For upgrading apache from 1.3.39 to Apache 2.0.63, just login to the server and run following commands/scripts.

#cd /usr/local/directadmin/customapache
#./build update
#./build clean
#./build update_data_ap2
#./build convert
#./build apache_2
#./build php_ap2 n
#./build mod_frontpage_ap2
#./build mod_perl_ap2

« Prev - Next »