Post Thu Apr 16, 2015 3:34 pm

Installation Guide for CentOS 6.6 64-bit

###### -------->>>>>>> Serviio DNLA Media Server Installation Guide for CentoOS 6.6 Final minimal clean install<<<<<<<----------######

"OS Pre-Requirements"

Install CentOS-6.6-x86_64-minimal.iso once done run an update:

yum update -y

Turn off Firewall

chkconfig iptables off
chkconfig ip6tables off

Stop the running processes

/etc/init.d/iptables stop
/etc/init.d/ip6tables stop

Turnoff selinux

vi /etc/sysconfig/selinux
change to "SELINUX=disable"

reboot

###Modul Installation Updates & Repositories###

Create the Files and add the lines listed below:

1.) vi /etc/yum.repos.d/linuxtech.repo

#
[linuxtech]
name=LinuxTECH
baseurl=http://pkgrepo.linuxtech.net/el6/release/
enabled=1
gpgcheck=1
gpgkey=http://pkgrepo.linuxtech.net/el6/release/RPM-GPG-KEY-LinuxTECH.NET
#

2.) vi /etc/yum.repos.d/naulinux-school.repo

#
[naulinux-school]
name=NauLinux School
baseurl=http://downloads.naulinux.ru/pub/NauLinux/6.2/$basearch/sites/School/RPMS/
enabled=0
gpgcheck=1
gpgkey=http://downloads.naulinux.ru/pub/NauLinux/RPM-GPG-KEY-linux-ink
#

yum --enablerepo=naulinux-school install libavcodec52

Add Repository:

rpm -Uhv http://pkgs.repoforge.org/rpmforge-rele ... x86_64.rpm
rpm -Uhv http://rpm.pbone.net/index.php3/stat/26 ... ux.src.rpm
yum -y update
yum install wget -y
yum install glibc gcc gcc-c++ autoconf automake libtool git make nasm pkgconfig SDL-devel a52dec a52dec-devel alsa-lib-devel faac faac-devel faad2 faad2-devel freetype-devel giflib gsm gsm-devel imlib2 imlib2-devel lame lame-devel libICE-devel libSM-devel libX11-devel libXau-devel libXdmcp-devel libXext-devel libXrandr-devel libXrender-devel libXt-devel libogg libvorbis vorbis-tools mesa-libGL-devel mesa-libGLU-devel xorg-x11-proto-devel zlib-devel libtheora theora-tools ncurses-devel libdc1394 libdc1394-devel amrnb-devel amrwb-devel opencore-amr-devel -y
yum install git libfaac-devel libmp3lame-devel libtheora-devel libva-devel libvdpau-devel libvorbis-devel libX11-devel libXfixes-devel texi2html yasm libxvidcore-devel libXext-devel libXfixes-devel librtmp-devel
yum groupinstall "Development Tools"


">>> A:Java Installation <<<"

####For 64Bit Java####

cd /opt
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u40-b25/jdk-8u40-linux-x64.tar.gz"
tar xzf jdk-8u40-linux-x64.tar.gz
cd /opt/jdk1.8.0_40/

####For 32-bit Java####
cd /opt
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u40-b25/jdk-8u40-linux-i586.tar.gz"
tar xzf jdk-8u40-linux-i586.tar.gz
cd /opt/jdk1.8.0_40/

Choose Java Version
# alternatives --install /usr/bin/java java /opt/jdk1.8.0_40/bin/java 2
# alternatives --config java

There are 3 programs which provide 'java'.

Selection Command
-----------------------------------------------
*+ 1 /opt/jdk1.8.0_40/bin/java

Enter to keep the current selection[+], or type selection number: (1)

At this point JAVA 8 has been successfully installed on your system. We also recommend to setup javac and jar commands path using alternatives

alternatives --install /usr/bin/jar jar /opt/jdk1.8.0_40/bin/jar 2
alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_40/bin/javac 2
alternatives --set jar /opt/jdk1.8.0_40/bin/jar
alternatives --set javac /opt/jdk1.8.0_40/bin/javac

Check the installed version of java using following command.

java -version

java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b25)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)

######################JAVA Installation Complete#################################

">>>> B:Serviio Installation <<<<"

cd /opt
wget http://download.serviio.org/releases/se ... nux.tar.gz
tar -C /opt -zxvf serviio-1.5.1-linux.tar.gz
mv serviio-1.5.1 /opt/serviio

">>>> C:User Add <<<<"

useradd -d /opt/serviio -r serviio
chown -R serviio:serviio /opt/serviio
passwd serviio (Set a passwort outherwise access denied)

">>>> D:Creating and Strating the Serviio Service <<<<"

Create the initscript "vi /etc/init.d/serviio" with the following code:

Script begin:

############ SCRIPT START #####################
#! /bin/sh
#
# chkconfig 35 85 15
# description: Start the serviio DLNA server in headless mode
### BEGIN INIT INFO
# Provides: serviio
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: Start the serviio DLNA server in headless mode
### END INIT INFO

SERVIIO_HOME="/opt/serviio"
SERVIIO_DAEMON="serviio.sh"
SERVIIO_BIN="$SERVIIO_HOME/bin/$SERVIIO_DAEMON"
SERVIIO_USER="serviio"

# Source function library.
. /etc/rc.d/init.d/functions

RETVAL=0

check() {
# Check that we're a privileged user
[ $(id -u) = 0 ] || exit 4

# Check if SERVIIO_HOME exists
test -d "$SERVIIO_HOME" || exit 5

# Check if SERVIIO_BIN is executable
test -x "$SERVIIO_BIN" || exit 5
}

start() {
check
echo -n "Starting Serviio DLNA server: "
/bin/su --session-command="$SERVIIO_BIN -headless" $SERVIIO_USER &
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
touch /var/lock/subsys/serviio.sh
echo_success
else
echo_failure
fi
echo
return $RETVAL
}

stop() {
check
echo -n "Shutting down Serviio DLNA daemon: "
# Retrieve JAVA Serviio process ID
PIDDAEMON=`pgrep $SERVIIO_DAEMON`
[ -z "$PIDDAEMON" ] || PIDJAVA=`ps -o pid= --ppid $PIDDAEMON`
# Kill the daemon
killproc "$SERVIIO_BIN"
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/serviio.sh
echo
# Kill the JAVA Serviio process if exists
[ -z "$PIDJAVA" ] || kill -9 $PIDJAVA
return $RETVAL
}

restart() {
stop
start
}


case "$1" in
start)
start
;;
stop)
stop
;;
force-reload)
restart
;;
restart)
restart
;;
condrestart)
if [ -f /var/lock/subsys/serviio.sh ]; then
restart
fi
;;
status)
status serviio.sh
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|force-reload}"
RETVAL=2
esac

exit $RETVAL

################SCRIPT END###############


"Include and activate Service into Autostart:"

chmod +x /etc/init.d/serviio
chkconfig --add serviio
chkconfig serviio on

Congrats you Server will run but without a decoder for now so lets complie ffmpeg in the next step.

####################################################################################################################################

#####---->>> FFMPEG Pre-Requirements Installation <<<----######

autoreconf -fiv
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"

#### 1.INSTALL Yasm ####

cd /opt
wget http://www.tortall.net/projects/yasm/re ... 3.0.tar.gz
tar xzvf yasm-1.3.0.tar.gz
chmod -R 750 /yasm-1.3.0
./configure
make
make install

#### 2.INSTALL libx264 ####

cd /opt
git clone --depth 1 git://git.videolan.org/x264
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static
make
make install
make distclean

#### 3.INSTALL libfdk_aac ####

cd /opt
git clone --depth 1 git://git.code.sf.net/p/opencore-amr/fdk-aac
autoreconf -fiv
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install
make distclean

#### 4.INSTALL libmp3lame ####

cd /opt
wget http://downloads.sourceforge.net/projec ... 9.5.tar.gz
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --disable-shared --enable-nasm
make
make install
make distclean

#### 5.INSTALL libopus ####

cd /opt
git clone git://git.opus-codec.org/opus.git
autoreconf -fiv
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install

#### 6.INSTALL libogg ####

cd /opt
wget http://downloads.xiph.org/releases/ogg/ ... 3.2.tar.gz
tar xzvf libogg-1.3.2.tar.gz
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install
make distclean

#### 7.INSTALL libvorbis ####

cd /opt
wget http://downloads.xiph.org/releases/vorb ... 3.4.tar.gz
tar xzvf libvorbis-1.3.4.tar.gz
./configure --prefix="$HOME/ffmpeg_build" --with-ogg="$HOME/ffmpeg_build" --disable-shared
make
make install
make distclean

#### 7.INSTALL libvpx ####

cd /opt
git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git
./configure --prefix="$HOME/ffmpeg_build" --disable-examples
make
make install
make distclean

#### 8.INSTALL libvo-aacenc ####

cd /opt
wget http://sourceforge.net/projects/opencor ... 1.3.tar.gz
tar xzvf vo-aacenc-0.1.3.tar.gz
./confirure
make
make install

#### 9.INSTALL libass ####

rpm -Uhv wget http://pkgs.repoforge.org/libass/libass ... x86_64.rpm
yum install libass

#### 10.INSTALL librtdump ####

cd /opt
wget http://rtmpdump.mplayerhq.hu/download/rtmpdump-2.3.tgz
tar xvf rtmpdump-2.3.tgz
make
make install

verify
rtmpdump
whereis librtmp

#### Now we are ready to Compile FFMPEG ####

cd /opt
git clone --depth 1 git://source.ffmpeg.org/ffmpeg
PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --bindir="$HOME/bin" --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-librtmp --enable-libvo-aacenc --enable-libass
make distclean
hash -r

whereis ffmpeg

/usr/local/bin/ffmpeg <----path for serviio config.

Now we need to tell Serviio where the FFMPEG File is located:

vi /opt/serviio/bin/serviio.sh
change option to : linux=true;
change location : Look for "-Dffmpeg.location=/usr/local/bin/ffmpeg(<---path)" and input the newley compiled ffmpeg which should be in "/usr/local/bin/ffmpeg"
chmod +x /usr/local/bin/ffmpeg (make FFMPEG an executable)

The Installation of "Serviio" on CentOS 6.6 Final is now complete to Start the Server use the following command:

"/etc//init.d/serviio start"

Starting Serviio DLNA server: [ OK ]

And you should be done !!! Open up the Server Console and set a Libary path.

Have fun hope you like the Instructions. Worked for me.