Thursday, March 19, 2009

Video Hosting - Fedora 5 Server Configuration (Optimized for Dedibox servers)


Video Hosting - Fedora 5 Server Configuration (Optimized for Dedibox servers)
I found it quite hard to get up to date information on how to configure properly a video hosting server on Fedora.

Here is a quick tutorial to tell you every single step I used after setting up my server with fedora core 5 (bordeaux). My hosting provider is Dedibox. It is designed for beginners to follow the step by step; but advanced users will surely know which steps to skip !

This will help you installing:

* Fmpeg (http://ffmpeg.mplayerhq.hu)
* FFmpeg-PHP (http://ffmpeg-php.sourceforge.net)
* Mplayer + Mencoder (mencoder is now built into the mplayer svn release )
(http://www.mplayerhq.hu/design7/dload.html)
* flv2tool (http://inlet-media.de/flvtool2)
* LAME MP3 Encoder (http://lame.sourceforge.net)
* Libogg + Libvorbis (http://www.xiph.org/downloads)



Table of contents

* Requirements

* 1-click Setup

* Setup explained



REQUIREMENTS

First, here are all the packages I needed on my fresh FRESH INSTALL of FC5

yum install subversion
y
yum install ruby
y
yum install gcc
y
yum install ncurses-devel
y
yum install gcc-c++
y
yum install php*dev*
y


You'll need the Livna repository to install mplayer so let's set it up now:

vi /etc/yum.repos.d/livna.repo


Then in Vi, press the key "i" and copy and paste this:

[livna]
name=Livna for Fedora Core $releasever - $basearch - Base
baseurl=http://rpm.livna.org/fedora/$releasever/$basearch
http://livna.cat.pdx.edu/fedora/$releasever/$basearch
http://wftp.tu-chemnitz.de/pub/linux/livna/fedora/$releasever/$basearch
http://ftp-stud.fht-esslingen.de/pub/Mirrors/rpm.livna.org/fedora/$releasever/$basearch
#mirrorlist=http://rpm.livna.org/mirrorlist
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-livna

[livna-testing]
name=Livna for Fedora Core $releasever - $basearch - Testing
baseurl=http://rpm.livna.org/fedora/$releasever/$basearch/RPMS.lvn-testing
http://livna.cat.pdx.edu/fedora/$releasever/$basearch/RPMS.lvn-testing
http://wftp.tu-chemnitz.de/pub/linux/livna/fedora/$releasever/$basearch/RPMS.lvn-testing
http://ftp-stud.fht-esslingen.de/pub/Mirrors/rpm.livna.org/fedora/$releasever/$basearch/RPMS.lvn-testing
#mirrorlist=http://rpm.livna.org/mirrorlist-testing
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-livna


Save your file by pressing "esc" and:

:wq


Once Vi exited let's import the GPG Key for this repository:

wget rpm.livna.org/RPM-LIVNA-GPG-KEY
rpm --import RPM-LIVNA-GPG-KEY
rm -rf RPM-LIVNA-GPG-KEY



1-click SETUP (just copy and paste)

cd /usr/local/src
wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/all-20061022.tar.bz2
wget http://rubyforge.org/frs/download.php/17497/flvtool2-1.0.6.tgz
wget http://easynews.dl.sourceforge.net/sourceforge/lame/lame-3.97.tar.gz
wget http://switch.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.5.1.tbz2
wget http://downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.2.0.tar.gz
tar -xjf all-20061022.tar.bz2
tar -xzf flvtool2-1.0.6.tgz
tar -xzf lame-3.97.tar.gz
tar -xjf ffmpeg-php-0.5.1.tbz2
tar -xzf libogg-1.1.3.tar.gz
tar -xzf libvorbis-1.2.0.tar.gz
mkdir /usr/local/lib/codecs/
svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
mv /usr/local/src/all-20061022/* /usr/local/lib/codecs/
chmod -R 755 /usr/local/lib/codecs/
mkdir /usr/local/src/tmp
chmod 777 /usr/local/src/tmp
export TMPDIR=/usr/local/src/tmp
cd /usr/local/src/lame-3.97
./configure
make && make install
cd /usr/local/src/libogg-1.1.3
./configure && make && make install
cd /usr/local/src/libvorbis-1.2.0
./configure && make && make install
cd /usr/local/src/flvtool2-1.0.6/
ruby setup.rb config
ruby setup.rb setup
ruby setup.rb install
yum install mplayer
y
cd /usr/local/src/ffmpeg/
./configure --enable-libmp3lame --enable-libvorbis --disable-mmx --enable-shared
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
cd /usr/local/src/ffmpeg-php-0.5.1/
phpize
./configure
make
make install
echo ‘extension=/usr/local/lib/php/extensions/no-debug-non-zts-20020429/ffmpeg.so’ >> /etc/php.ini
service httpd restart

SETUP EXPLAINED

Download needed packages and unpack them:

cd /usr/local/src
wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/all-20061022.tar.bz2
wget http://rubyforge.org/frs/download.php/17497/flvtool2-1.0.6.tgz
wget http://easynews.dl.sourceforge.net/sourceforge/lame/lame-3.97.tar.gz
wget http://switch.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.5.1.tbz2
wget http://downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.2.0.tar.gz
tar -xjf all-20061022.tar.bz2
tar -xzf flvtool2-1.0.6.tgz
tar -xzf lame-3.97.tar.gz
tar -xjf ffmpeg-php-0.5.1.tbz2
tar -xzf libogg-1.1.3.tar.gz
tar -xzf libvorbis-1.2.0.tar.gz
svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg


Install Mplayer codecs

mkdir /usr/local/lib/codecs/
mv /usr/local/src/all-20061022/* /usr/local/lib/codecs/


Secure TMP folder

chmod -R 755 /usr/local/lib/codecs/
mkdir /usr/local/src/tmp
chmod 777 /usr/local/src/tmp
export TMPDIR=/usr/local/src/tmp


Install Lame

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


Install Ogg

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


Install Vorbis

cd /usr/local/src/libvorbis-1.2.0
./configure && make && make install


Install FLVtools

cd /usr/local/src/flvtool2-1.0.6/
ruby setup.rb config
ruby setup.rb setup
ruby setup.rb install


Install Mplayer

yum install mplayer


Install FFMpeg

cd /usr/local/src/ffmpeg/
./configure --enable-libmp3lame --enable-libvorbis --disable-mmx --enable-shared
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


Install FFMpeg-PHP

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


Add the FFMpeg extension in php.ini and restart httpd.

echo ‘extension=/usr/local/lib/php/extensions/no-debug-non-zts-20020429/ffmpeg.so’ >> /etc/php.ini
service httpd restart


Posted by Romain at 01:29
Labels: Tutorials

No comments:

Post a Comment