Nov 20

Error while installing any package using apt-get

I was getting the following error while I tried to install any package using apt-get package manager.

For example:

Error
—–
# apt-get install wget
Reading package lists… Error!
E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/extra.linuxmint.com_dists_rafaela_main_i18n_Translation-en
E: The package lists or status file could not be parsed or opened.

Fix
—-
rm -vf /var/lib/apt/lists/* 

Then do,

apt-get update

Finally I was able to install packages using apt-get

# apt-get install wget
Reading package lists… Done
Building dependency tree
Reading state information… Done
wget is already the newest version.
The following packages were automatically installed and are no longer required:
empathy-common libfarstream-0.2-2 libfolks-telepathy25 libfolks25
libgssglue1 libtelepathy-farstream3 libtelepathy-logger3 libtirpc1
python-gst0.10 telepathy-logger
Use ‘apt-get autoremove’ to remove them.
0 upgraded, 0 newly installed, 0 to remove and 273 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up chromium-codecs-ffmpeg-extra (45.0.2454.101-0ubuntu0.14.04.1.1099) …
Setting up chromium-browser (45.0.2454.101-0ubuntu0.14.04.1.1099) …

Done…

 

Sep 01

Mysql error followed by Openfire XMPP server halt

I faced an issue as my IM messenger suddenly got disconnected from the openfire xmpp server. I checked the internet connection to my computer and it was still looking fine. So I hop into openfire server and tried to manually start it. It showed as openfire service starting, but it went off suddenly. I checked some of its logs and could see the issue was with connectivity to mysql service running in same box. Following was the step by step methods I tried to pin point the issue and to sort it out.

First I did ssh the server and got into bash shell.

Tried to manually start openfire service
host # /etc/init.d/openfire start
Starting openfire:

It started running
host # /etc/init.d/openfire status
openfire is running

Suddenly went off
host # /etc/init.d/openfire status
openfire is not running

Showed a pid already exists for openfire when I tried to start openfire again
host # /etc/init.d/openfire start
Openfire is already running. Remove /var/run/openfire.pid if you know this to be untrue.

Removed existing pid
host # rm /var/run/openfire.pid

Starting service
host # /etc/init.d/openfire start
Starting openfire:

It started once again
host # /etc/init.d/openfire status
openfire is running

Went off again
host # /etc/init.d/openfire status
openfire is not running

Checked one of openfire’s log. After referencing some threads, I could see this is due to connectivity issues with the database.
host # tail -f /opt/openfire/logs/info.log
at org.jivesoftware.openfire.XMPPServer.<init>(XMPPServer.java:216)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.jivesoftware.openfire.starter.ServerStarter.start(ServerStarter.java:113)
at org.jivesoftware.openfire.starter.ServerStarter.main(ServerStarter.java:58)
2015.08.31 11:49:23 org.jivesoftware.openfire.XMPPServer – Server halted

I checked status of mysql and found it was down
host # /etc/init.d/mysqld status
mysqld is stopped

Failed over and over while attempting on starting it.
host # /etc/init.d/mysqld start
MySQL Daemon failed to start.
Starting mysqld: [FAILED]

Found the issue with broken binary index file
host # tail -f /var/log/mysqld.log
150831 11:42:10 [ERROR] Failed to open log (file ‘/var/lib/mysql/mysql-bin.000078’, errno 2)
150831 11:42:10 [ERROR] Could not open log file
150831 11:42:10 [ERROR] Can’t init tc log
150831 11:42:10 [ERROR] Aborting

150831 11:42:10 InnoDB: Starting shutdown…
150831 11:42:11 InnoDB: Shutdown completed; log sequence number 97468154
150831 11:42:11 [Note] /usr/libexec/mysqld: Shutdown complete

150831 11:42:11 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

Removed current index file
host # rm /var/lib/mysql/mysql-bin.index

Started mysql server. Fresh Index file will automatically recreate.
host # /etc/init.d/mysqld start
Starting mysqld: [ OK ]

Found it was still running fine
host # /etc/init.d/mysqld status
mysqld (pid 10838) is running…

Finally fixed openfire issue as well.
host # /etc/init.d/openfire start
Starting openfire:

host # /etc/init.d/openfire status
openfire is running

Aug 26

Liblua error: relocation R_X86_64_32 against `luaO_nilobject_’

The full error will be like as below:

————————
/usr/bin/ld: /usr/local/lib/liblua.a(lapi.o): relocation R_X86_64_32 against `luaO_nilobject_’ can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/liblua.a: could not read symbols: Bad value
————————

I got the above error in between easyapache. It’s pretty sure lua is present in server but something went unoticed or bad while its installation. The missing part was nothing but I compiled 32 bit lua in 64 bit server, so the above error was showing mismatch class error for liblua.

I tried to recompile lua as follows:

Download lua source archive from their official site http://www.lua.org/download.html

# cd /usr/src
# curl -R -O http://www.lua.org/ftp/lua-5.2.3.tar.gz
# tar zxf lua-5.2.3.tar.gz

Now you need to make sure that you will compile this time for 64 bit class.

For compilation in 64 bit arch server, you should make the following changes in lua source file before proceeding with installation.

# cd lua-5.2.3
# vi src/Makefile

Change

CFLAGS= -O2 -Wall -DLUA_COMPAT_ALL $(SYSCFLAGS) $(MYCFLAGS)

to

CFLAGS= -O2 -Wall -DLUA_COMPAT_ALL $(SYSCFLAGS) -fPIC $(MYCFLAGS)

Save and exit from file.

Now do the installlation.

# make linux test

# make

# make install

you are done 🙂 now the job left is to finish the easyapache process.

Aug 26

Error while loading shared libraries: liblua.so

I got this liblua error while apache,php recompilation.

At first I tried to find the dependencies of lua

# ldd `which lua`
linux-vdso.so.1 => (0x00007fff1dd7d000)
liblua.so => not found
libreadline.so.6 => /lib64/libreadline.so.6 (0x0000003b68800000)
libncurses.so.5 => /lib64/libncurses.so.5 (0x0000003b68400000)
libm.so.6 => /lib64/libm.so.6 (0x0000003b68000000)
libdl.so.2 => /lib64/libdl.so.2 (0x0000003b67800000)
libc.so.6 => /lib64/libc.so.6 (0x0000003b67400000)
libtinfo.so.5 => /lib64/libtinfo.so.5 (0x0000003b6a400000)
/lib64/ld-linux-x86-64.so.2 (0x0000003b67000000)

Then I tried to search for liblua in “/” using find command.

# find / -iname liblua*
/opt/lua/lib/liblua.a
/opt/lua/lib/liblua-5.1.so

The made a symlink like as follows:

# ln -s /opt/lua/lib/liblua-5.1.so /opt/lua/lib/liblua.so

# ll /opt/lua/lib/liblua.so
lrwxrwxrwx 1 root root 13 Aug 18 11:08 /opt/lua/lib/liblua.so -> liblua-5.1.so*

Now do recompile again and finish the process successfully 🙂

In case if lua is completely missing, you can install using yum or do manual compilation.

# yum install lua lua-devel

for manual compilation, download lua source from http://www.lua.org/download.html and install it.

Aug 24

OpenVZ vps creation “Error in check_mount_restrictions (ploop.c:1627)”

I wasn’t able to create new vps in node due to following ploop error.

From the log
—————————
Creating image: /vz/private/350.tmp/root.hdd/root.hdd size=2306867K
Creating delta /vz/private/350.tmp/root.hdd/root.hdd bs=2048 size=4614144 sectors v2
Storing /vz/private/350.tmp/root.hdd/DiskDescriptor.xml
Error in check_mount_restrictions (ploop.c:1627): The ploop image can not be used on ext3 or ext4 file system without extents
Failed to create image: Error in check_mount_restrictions (ploop.c:1627): The ploop image can not be used on ext3 or ext4 file system without extents [21]
Destroying container private area: /vz/private/350
Creation of container private area failed

—————————

Check whether the partition is on ext4 filesystem or not. Ploop doesn’t work on ext3 filesystem. My node’s /vz partition was on ext3 filesystem.

We cannot simply upgrade the /vz partition from ext3 to ext4 as lots of vps are running on it. Here I have checked the vzctl version and found it was latest one 4.7.x

# vzctl --version
vzctl version 4.7.1

The latest vzctl tries to create template as ploop which is advanced than simfs. Since the partition runs on ext3 filesystem, the safest way to fix the issue is to downgrade the version of vzctl to 4.5.x

version 4.5.1 is not available in openvz anymore. You may need to manually download the rpm of vzctl and vzctl-core from https://openvz.org/Download/vzctl/4.5.1 and install it.

Before installing it, remove the current vzctl 4.7.x

# yum remove vzctl
# cd /usr/src
# wget http://download.openvz.org/utils/vzctl/4.5.1/vzctl-4.5.1-1.x86_64.rpm
# wget http://download.openvz.org/utils/vzctl/4.5.1/vzctl-core-4.5.1-1.x86_64.rpm

# rpm -Uvh vzctl-core-4.5.1-1.x86_64.rpm
Preparing... ########################################### [100%]
1:vzctl-core ########################################### [100%]

# rpm -Uvh vzctl-4.5.1-1.x86_64.rpm
Preparing... ########################################### [100%]
1:vzctl ########################################### [100%]
vz-postinstall: /etc/sysctl.conf: add net.bridge.bridge-nf-call-ip6tables = 1
vz-postinstall: /etc/sysctl.conf: add net.bridge.bridge-nf-call-iptables = 1
#

# vzctl --version
vzctl version 4.5.1

Create container now 🙂

# vzctl create 101 --ostemplate centos-6-x86_64-cpanel --private /vz/private/101 --root=/vz/root/101 --config configname
Creating container private area (centos-6-x86_64-cpanel)
Performing postcreate actions
CT configuration saved to /etc/vz/conf/101.conf
Container private area was created

Aug 24

How to change username when you have only one account in Ubuntu?

You cannot simply login as root in Ubuntu at the start up. Do it as the following way:

1) Open terminal and switch to root user. You can open terminal in search or by pressing Ctl+Alt+t.

2) Unlock root account and enable login as root like below

# passwd -u root (:::should be as root)

3) Reboot the machine

4) Once the login page appears, press Ctrl+Alt+Fx (x can be from 1 to 6) to open a terminal. Then switch root user and enter root password.

5) Change the username of account you wanted to.

# usermod -l newname oldname

6) Change the home folder name of user to new one if you want to. But this is optional.

# usermod -m -d /home/newname newname ((this would change home/oldname to /home/newname))

7) Lock the root account again

# passwd -l root

8) Switch back to GUI(the graphical login page at startup)

# Ctl + Alt + F7

(If it’s not working just reboot using “reboot” or “shutdown -r now” command)

Login with new username and enjoy working 🙂

((Above method is needed when only single user account is present in ubuntu. When you have only one account, you cannot do this username change by standing in the same account environment))

Aug 21

Where can you find the HOST_API_KEY of CloudFlare in server?

Suppose you have lot of servers and a new server setup is going on, and you want to install CloudFlare in it. While installation it asks for HOST_API_KEY. You can find the key on other servers from following file location.

/root/.cpanel/datastore/cf_api

It contains the key 🙂

Aug 19

Wowza Streaming Engine (RHEL/Centos/Fedora)

Wowza Streaming Engine (known as Wowza Media Server prior to version 4) is unified server software developed by Wowza Media Systems. The server is used for streaming of live and on-demand video, audio, and RIAs (rich Internet applications) over IP networks to desktop, laptop, and tablet computers, mobile devices, IPTV set-top boxes, internet-connected TV sets, and other network-connected devices. The server is a Java application deployable on the following operating systems: Linux, Mac OS X, Solaris, Unix, and Windows.

Installation of Wowza
———————

1) Firt install Java in your server as it is a Java based application.

#yum install java java-openjdk

# java -version
java version "1.6.0_18"
OpenJDK Runtime Environment (IcedTea6 1.8.8) (fedora-51.1.8.8.fc13-i386)
OpenJDK Client VM (build 14.0-b16, mixed mode)

2) Download Wowza installation binary from their site http://www.wowza.com/pricing/installer

#cd /usr/src
#wget http://www.wowza.com/downloads/WowzaStreamingEngine-4-0-6/WowzaStreamingEngine-4.0.6.rpm.bin

3) Give permission for execution

#chmod +x WowzaStreamingEngine-4.0.6.rpm.bin

4) Execute it

#./WowzaStreamingEngine-4.0.6.rpm.bin

Do you agree to the above license terms? [yes or no]
yes
Wowza Streaming Engine Manager is a browser-based application for managing the Wowza Streaming Engine software.
Enter an Administrator user name and password that you want to use to sign in to the manager.
Note: User Name and Password are case-sensitive.
User Name: wowza
Password:
Confirm Password:
Please enter a Wowza Streaming Engine license key in this format:
XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX[-XXXXXXXXXXXX] ET1A4-v8eub-FjZ9y-nYuwz-Uynnt-YjWJN-amQAywPrEQH

((( For the license you may need to purchase from http://www.wowza.com/media-server/developers/license or you can try free license just for installation purpose, they will send it to your mail after signing up)))

Wowza Streaming Engine license key accepted. Thank you!
Installing Wowza Streaming Engine
Preparing... ########################################### [100%]
1:WowzaStreamingEngine ########################################### [100%]

Start Wowza Streaming Engine automatically when this system reboots? [yes or no]
yes
Starting WowzaStreamingEngine (via systemctl):
WowzaStreamingEngine: stopping...
WowzaStreamingEngine stopped

WowzaStreamingEngine stopped

WowzaStreamingEngine: starting...
WowzaStreamingEngine started PID:(1751) [ OK ]
Starting WowzaStreamingEngine (via systemctl):
WowzaStreamingEngineManager: stopping...
WowzaStreamingEngineManager stopped
WowzaStreamingEngineManager stopped
WowzaStreamingEngineManager: starting...
WowzaStreamingEngineManager started PID:(1779) [ OK ]
Install Location:
/usr/local/WowzaStreamingEngine

To access Wowza Streaming Engine Manager, go to http://localhost:8088/enginemanager in a web browser.

wowza_installation

# chkconfig --level 345 WowzaStreamingEngine on
# chkconfig --level 345 WowzaStreamingEngineManager on

5) Allow it’s port to accept incoming connections.

# iptables -I INPUT -p tcp --dport 1935 -j ACCEPT

6) Check whether wowza is working?

# netstat -plan | grep :1935
tcp 0 0 :::1935 :::* LISTEN 1352/java

7) Install all examples in wowza
(LiveDVRStreaming, LiveVideoStreaming, ServerSideModules, SHOUTcast, VideoChat, VideoOnDemandStreaming, WebcamRecording)

#cd /usr/local/WowzaStreamingEngine/examples
# ./installall.sh
Skipping LiveVideoStreaming. Already configured.
Installing LiveDVRStreaming...
Installing ServerSideModules...
Installing SHOUTcast...
Installing VideoChat...
Skipping VideoOnDemandStreaming. Already configured.
Skipping WebcamRecording. Already configured.
If Wowza Streaming Engine is running, you must restart it to see the installed examples.

8) Go to http://WowzaserverIP:8088/enginemanager and supply the user/pass you have given while installation. Enjoy working with Wowza now 🙂

wowza1

wowza2

wowza3

 
If you see the wowza page getting connection time outs or connection refused error. Check wowza log for details.

# tail -f wowzastreamingengine_error.log
WARN vhost comment 2014-08-18 01:02:39 - - - - - 20.422 - - - - - - - _defaultVHost_ Bind failed, try again ([any]:1935): java.net.BindException: Address already in use
WARN vhost comment 2014-08-18 01:02:44 - - - - - 25.426 - - - - - - - _defaultVHost_ Bind failed, try again ([any]:1935): java.net.BindException: Address already in use
WARN vhost comment 2014-08-18 01:02:49 - - - - - 30.429 - - - - - - - _defaultVHost_ Bind failed, try again ([any]:1935): java.net.BindException: Address already in use
WARN vhost comment 2014-08-18 01:02:54 - - - - - 35.432 - - - - - - - _defaultVHost_ Bind failed, try again ([any]:1935): java.net.BindException: Address already in use
WARN vhost comment 2014-08-18 01:02:59 - - - - - 40.434 - - - - - - - _defaultVHost_ Bind failed, try again ([any]:1935): java.net.BindException: Address already in use

I found some other process started using the same port with server IP. I had to kill all the current processes and restart application.

# netstat -plan | grep :1935
tcp 0 0 :::1935 :::* LISTEN 1352/java
# kill -9 1352
# ps auxf | grep -i wowza

Kill all wowza process you get from ps command.

Now start WowzaStreamingEngine and WowzaStreamingEngineManager

# /etc/init.d/WowzaStreamingEngine start
WowzaStreamingEngine stopped

WowzaStreamingEngine: starting...
WowzaStreamingEngine started PID:(2751) [ OK ]
# /etc/init.d/WowzaStreamingEngineManager start
WowzaStreamingEngineManager stopped
WowzaStreamingEngineManager: starting...
WowzaStreamingEngineManager started PID:(2778) [ OK ]

 

Aug 09

Red5 Media Server: Installation And Configuration (Centos/Fedora/RHEL)

Red5 Media Server delivers a powerful video streaming and multi-user solution to the ©Adobe ©Flash Player and other exciting client technologies. It works based on Java and some of the most powerful open source frameworks, Red5 stands as a solid solution for business of all sizes including the enterprise.

Features
————
Streaming Video (FLV, F4V, MP4, 3GP)
Streaming Audio (MP3, F4A, M4A, AAC)
Recording Client Streams (FLV and AVC+AAC in FLV container)
Shared Objects
Live Stream Publishing
Remoting
Protocols: RTMP, RTMPT, RTMPS, and RTMPE

Lets look at the installation and configuration part:
——————————————————————-

1) First you need to install Java since red5 is a Java server. Use yum to install it.
If you are not sure about the version or proper package to be installed from yum repo, then search it.

# yum search java | grep openjdk
java-1.6.0-openjdk-devel.i686 : OpenJDK Development Environment
java-1.6.0-openjdk.i686 : OpenJDK Runtime Environment
java-1.6.0-openjdk-demo.i686 : OpenJDK Demos
java-1.6.0-openjdk-javadoc.i686 : OpenJDK API Documentation
java-1.6.0-openjdk-plugin.i686 : OpenJDK Web Browser Plugin
java-1.6.0-openjdk-src.i686 : OpenJDK Source Bundle

I am gonna install java-1.6.0-openjdk.i686 and java-1.6.0-openjdk-devel.i686 from it.

#yum install java-1.6.0-openjdk.i686 java-1.6.0-openjdk-devel.i686

2) Now we need to install SVN to retrieve new red5 release from Google SVN repositary.

#yum install subversion

3) Install Ant and Ivy in support for Java
Apache Ant is a Java library and command-line tool that help building software. Ivy is a dependency manager, it manages and controls the JAR files that your project depends on. If you don’t have the JARs, it works by default by taking from the Maven repository directly, which can make project setup a lot easier.

Download binary form of apache-ant(NOT THE SOURCE CODE)

# cd /usr/src
# wget http://www.motorlogy.com/apache//ant/binaries/apache-ant-1.9.4-bin.tar.gz (:::You can download latest from http://ant.apache.org/bindownload.cgi)
# tar xvf apache-ant-1.9.4-bin.tar.gz
# mv apache-ant-1.9.4 /usr/local/ant

Make a symlink for ant binary to /usr/bin for the shortcut and easiness to access it.

#ln -s /usr/local/ant/bin/ant /usr/bin/ant

Download Ivy from Apache repositary

# cd /usr/src
# svn co https://svn.apache.org/repos/asf/ant/ivy/core/trunk ivy
# cd ivy
# ant jar

Wait for few minutes for process to be over. Once it is success, you will see the Build Complete Message.

# cp build/artifact/jars/ivy.jar /usr/local/ant/lib/   (::: Since you are in path cd /usr/src/ivy)

4) Export Variables for Ant and Java:

Java and Ant is in place now, now we need to make sure we set Environment Variables. They are global variables with paths specified to different binaries or applications. ANT and JAVA will need those.

# export ANT_HOME=/usr/local/ant
# export JAVA_HOME=/usr/lib/jvm/java
# export PATH=$PATH:/usr/local/ant/bin

5) Actual Installation of Red5 Server begins

We need to fetch the Red5 source from Google SVN repositary.

# cd /usr/src
# svn co http://red5.googlecode.com/svn/java/server/tags/1_0/ red5
# mv red5 /usr/local/
# cd /usr/local/red5

(This is the folder where all the source files reside. From here on, we prepare and build the red5 source)

# ant prepare
# ant dist

Wait for sometime for the process to be completed. Once it is over, you will see message “BUILD SUCCESSFUL” at the end.

Copy the conf directory from the dist folder to the current directory and test the red5 installation.

# cp -r dist/conf .             (::: Since you are in path /usr/local/red5)
# ./red5.sh

You will see a lot of process going on in screen and it starts the Red5 server.

Check whether the ports 5080 and 1935 are listening or not in a second/duplicate shell

# netstat -plan | grep -E ‘:5080|:1935’
tcp 0 0 :::1935 :::* LISTEN 1309/java
tcp 0 0 :::5080 :::* LISTEN 1309/java

Test if server works by checking the url http://yourserverIP:5080

Make sure you enable incoming connections to ports 5080 and 1935 in server.

# iptables -A INPUT -p tcp -m tcp –dport 5080 -j ACCEPT
# iptables -A INPUT -p tcp -m tcp –dport 1935 -j ACCEPT
[[[NOTE::: The red5 runs only as long as you keep the terminal window open since you started running the script red5.sh in it. It will stop running if you close shell which is not an efficient way to run red5 server like that way. You need to make sure it can run by its own initiative]]]

You may need to set the script red5.sh starts running while server boots up, do the following for it.

#vi /root/red5_server_run.sh

Enter the following commands in it.

cd /usr/local/red5/
./red5.sh

#chmod +x /root/red5_server_run.sh

Set this script in file /etc/rc.local so that it will start running along with start up scripts in server.
So the rc.local would like as shown below:
=======================
# cat /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don’t
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
sh /root/red5_server_run.sh &
=======================

((In above the “&” at the tail end of command “sh /root/red5_server_run.sh” is run the process in background))
6) Setup an Init script for Red5 server

# vi /etc/init.d/red5

Then enter the following script in it.

=================================================================
#!/bin/sh
# For RedHat and cousins:
# chkconfig: 2345 85 85
# description: Red5 flash streaming server
# processname: red5
PROG=red5
RED5_HOME=/usr/local/red5
DAEMON=$RED5_HOME/$PROG.sh
PIDFILE=/var/run/$PROG.pid
# Source function library
. /etc/rc.d/init.d/functions
[ -r /etc/sysconfig/red5 ] && . /etc/sysconfig/red5
RETVAL=0
case “$1” in
start)
echo -n $”Starting $PROG: ”
cd $RED5_HOME
$DAEMON >/dev/null 2>/dev/null &
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo $! > $PIDFILE
touch /var/lock/subsys/$PROG
fi
[ $RETVAL -eq 0 ] && success $”$PROG startup” || failure $”$PROG startup”
echo
;;
stop)
echo -n $”Shutting down $PROG: ”
killproc -p $PIDFILE
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$PROG
;;
restart)
$0 stop
$0 start
;;
status)
status $PROG -p $PIDFILE
RETVAL=$?
;;
*)
echo $”Usage: $0 {start|stop|restart|status}”
RETVAL=1
esac
exit $RETVAL
=================================================================

Assign execute permission to red5 script

# chmod +x /etc/init.d/red5

Now start the service

# service red5 start OR /etc/init.d/red5 start

Set Red5 to start along with start up programs while server booting

# chkconfig –add red5
# chkconfig red5 on

To install some RED5 demos

# cd /usr/local/red5/webapps/root
# svn checkout http://red5.googlecode.com/svn/java/server/tags/0_9_1/webapps/root/demos/

To install some demo apps

http://yourserverip:5080/installer/

Then install Admin demo and Ofla Demo from the page

Access Demo Apps in Red5

http://yourserverip:5080/demos/

Test ofla demo

http://192.168.1.7:5080/demos/ofla_demo.html

red5_oflademo

Then correct rtmp url like rtmp://yourserverip/oflaDemo and hit connect. Choose any of the demos from the list and play it.

 

Test Publisher to live stream, record videos etc.

http://192.168.1.7:5080/demos/publisher.html

You will see three tabs on left side server, video, audio

In server tab, change the location to rtmp://yourserverip/oflaDemo and on the video tab, select your cam from Device scroll list.

red5_success

All the above would work fine if you follow the instructions correctly 🙂

 

Some error you may encounter while the installation time
============================================

1) During the step ant prepare and ant dist , you may sometime reach at the following error.

——————————————————————–
[ivy:resolve] :: UNRESOLVED DEPENDENCIES ::
[ivy:resolve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve] :: org.apache.commons#commons-modeler;2.0.1: not found
[ivy:resolve] :: red5#xmlrpc;2.0.1: not found
[ivy:resolve] ::::::::::::::::::::::::::::::::::::::::::::::
——————————————————————–

For this change the following path in file ivysettings.xml in directory /usr/local/red5/

——————————————————————–
replace the
<artifact pattern=”http://repo1.maven.org/maven2/[organisation]/[artifact]-[revision].[ext]”/>
with
<artifact pattern=”http://repo1.maven.org/maven2/[artifact]/[artifact]/[revision]/[artifact]-[revision].[ext]”/>
——————————————————————–

Reference:: https://issues.apache.org/jira/browse/OPENMEETINGS-1035

 

Aug 09

Install FFMPEG in Fedora/Centos/RHEL

Introduction
————
FFmpeg is a free software project that produces libraries and programs for handling multimedia data. FFmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. It supports the most obscure ancient formats up to the cutting edge. No matter if they were designed by some standards committee, the community or a corporation.

Reference from https://www.ffmpeg.org/about.html

How to install it?

(((First of all, please note the below installation steps are based on working with fedora/centos/rhel)))

1) Install the additional repo

Download it from http://pkgs.repoforge.org/rpmforge-release/ and choose it with your servers exact architecture and OS version.

I installed,

rpm -Uhv http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686

Since I am running Centos 6.x i686.

Update repository

# yum -y update

Install all necessary packages in support for ffmpeg

# yum install glibc gcc gcc-c++ autoconf automake libtool git make nasm pkgconfig
# yum install SDL-devel a52dec a52dec-devel alsa-lib-devel faac faac-devel faad2 faad2-devel
# yum install freetype-devel giflib gsm gsm-devel imlib2 imlib2-devel lame lame-devel libICE-devel libSM-devel libX11-devel
# yum install libXau-devel libXdmcp-devel libXext-devel libXrandr-devel libXrender-devel libXt-devel
# yum install libogg libvorbis vorbis-tools mesa-libGL-devel mesa-libGLU-devel xorg-x11-proto-devel zlib-devel
# yum install libtheora theora-tools
# yum install ncurses-devel
# yum install libdc1394 libdc1394-devel
# yum install amrnb-devel amrwb-devel opencore-amr-devel
2) Install xvid
————
It is a video codec library following the MPEG-4 standard, specifically MPEG-4 Part 2 Advanced Simple Profile (ASP). It uses ASP features such as b-frames, global and quarter pixel motion compensation, lumi masking, trellis quantization, and H.263, MPEG and custom quantization matrices.

#cd /opt
#wget http://downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gz
#tar xzvf xvidcore-1.3.2.tar.gz
#cd xvidcore/build/generic
#./configure –prefix=”$HOME/ffmpeg_build”
(::: Here $HOME means, since you run this as root, the home directory will be choosen as /root)
#make
#make install

3) Install LibOgg
————–
It is designed to provide for efficient streaming and manipulation of high quality digital multimedia.

#cd /opt
#wget http://downloads.xiph.org/releases/ogg/libogg-1.3.1.tar.gz
#tar xzvf libogg-1.3.1.tar.gz
#cd libogg-1.3.1
#./configure –prefix=”$HOME/ffmpeg_build” –disable-shared
#make
#make install

4) Install Libvorbis
—————–
It is the reference implementation of the Vorbis codec. It is the lowest-level interface to the Vorbis encoder and decoder, working with packets directly.

#cd /opt
#wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.4.tar.gz
#tar xzvf libvorbis-1.3.4.tar.gz
#cd libvorbis-1.3.4
#./configure –prefix=”$HOME/ffmpeg_build” –with-ogg=”$HOME/ffmpeg_build” –disable-shared
#make
#make install

5) Install Libtheora
—————–
It is a free lossy video compression format. It is developed by the Xiph.Org Foundation and distributed without licensing fees alongside their other free and open media projects, including the Vorbis audio format and the Ogg container.

#cd /opt
#wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.gz
#tar xzvf libtheora-1.1.1.tar.gz
#cd libtheora-1.1.1
#./configure –prefix=”$HOME/ffmpeg_build” –with-ogg=”$HOME/ffmpeg_build” –disable-examples –disable-shared –disable-sdltest –disable-vorbistest
#make
#make install

6) Install Aacenc
————–
It’s AAC(Advanced Audio Coding) Decoder.

# cd /opt
# wget http://downloads.sourceforge.net/opencore-amr/vo-aacenc-0.1.3.tar.gz
# tar xzvf vo-aacenc-0.1.3.tar.gz
# cd vo-aacenc-0.1.3
# ./configure –prefix=”$HOME/ffmpeg_build” –disable-shared
# make
# make install

7) Install Yasm
————
It is an assembler and disassembler for the Intel x86 architecture. It can be used to write 16-bit, 32-bit (IA-32) and 64-bit (x86-64) programs. Yasm is a full rewrite of Netwide Assembler (NASM).

# yum remove yasm
# cd /opt
# wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
# tar xzfv yasm-1.2.0.tar.gz
# cd yasm-1.2.0
# ./configure –prefix=”$HOME/ffmpeg_build” –bindir=”$HOME/bin”
# make
# make install
# export “PATH=$PATH:$HOME/bin”

8) Install Libvpx
————–
It is a video compression format owned by Google.

# cd /opt
# git clone http://git.chromium.org/webm/libvpx.git
# cd libvpx
# git checkout tags/v.1.3.0
# ./configure –prefix=”$HOME/ffmpeg_build” –disable-examples
# make
# make install

9) Install X264
————
It is a free software library for encoding video streams into the H.264/MPEG-4 AVC format. It is released under the terms of the GNU General Public License.

# cd /opt
# git clone git://git.videolan.org/x264.git
# cd x264
# ./configure –prefix=”$HOME/ffmpeg_build” –bindir=”$HOME/bin” –enable-static
# make
# make install

10) Configure Libraries
——————-

# export LD_LIBRARY_PATH=/usr/local/lib/
# echo /usr/local/lib >> /etc/ld.so.conf.d/custom-libs.conf
# ldconfig (:::It configures dynamic linker run-time bindings)
11) Now compile FFMPEG
——————

# cd /opt
# git clone git://source.ffmpeg.org/ffmpeg.git
# cd ffmpeg
# git checkout release/2.2
# PKG_CONFIG_PATH=”$HOME/ffmpeg_build/lib/pkgconfig”
# export PKG_CONFIG_PATH

(((Following compile options have to given line by line)))

# ./configure –prefix=”$HOME/ffmpeg_build” –extra-cflags=”-I$HOME/ffmpeg_build/include” –extra-ldflags=”-L$HOME/ffmpeg_build/lib” –bindir=”$HOME/bin” \
–extra-libs=-ldl –enable-version3 –enable-libopencore-amrnb –enable-libopencore-amrwb –enable-libvpx –enable-libfaac \
–enable-libmp3lame –enable-libtheora –enable-libvorbis –enable-libx264 –enable-libvo-aacenc –enable-libxvid –disable-ffplay \
–enable-gpl –enable-postproc –enable-nonfree –enable-avfilter –enable-pthreads

(((The –arch=x86_64 option should only be used if you are on a 64Bit System!)))

# make
# make install

 

An error you might come across while compiling FFMPEG
============================================

Error: libfaac not found
—————–
# cd /opt
# wget http://downloads.sourceforge.net/faac/faac-1.28.tar.gz
# cd faac-1.28
# ./configure –prefix=”$HOME/ffmpeg_build” –disable-shared
# make
# make install

Then compile ffmpeg again in step 11.
Some error you encounter after compilation
=================================
# ffmpeg -version
ffmpeg: error while loading shared libraries: libvo-aacenc.so.0: cannot open shared object file: No such file or directory

For this,

# ldd `which ffmpeg`
linux-gate.so.1 => (0x00872000)
libasound.so.2 => /lib/libasound.so.2 (0x07533000)
libSDL-1.2.so.0 => /usr/lib/libSDL-1.2.so.0 (0x00110000)
libpthread.so.0 => /lib/libpthread.so.0 (0x007e7000)
libvo-aacenc.so.0 => not found
libopencore-amrwb.so.0 => /usr/lib/libopencore-amrwb.so.0 (0x00f68000)
libopencore-amrnb.so.0 => /usr/lib/libopencore-amrnb.so.0 (0x00a3a000)
libmp3lame.so.0 => /usr/lib/libmp3lame.so.0 (0x001b0000)
libm.so.6 => /lib/libm.so.6 (0x0082b000)
libz.so.1 => /lib/libz.so.1 (0x00816000)
librt.so.1 => /lib/librt.so.1 (0x0080b000)
libdl.so.2 => /lib/libdl.so.2 (0x00804000)
libc.so.6 => /lib/libc.so.6 (0x0065a000)
/lib/ld-linux.so.2 (0x00638000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x07afb000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x077af000)

# find / -iname libvo-aacenc.so.0
/root/ffmpeg_build/lib/libvo-aacenc.so.0

# ln -s /root/ffmpeg_build/lib/libvo-aacenc.so.0 /lib/libvo-aacenc.so.0

# ll /lib/libvo-aacenc.so.0
lrwxrwxrwx. 1 root root 40 Aug 9 17:37 /lib/libvo-aacenc.so.0 -> /root/ffmpeg_build/lib/libvo-aacenc.so.0
==========================================
Finally you are done with FFMPEG installation 🙂

# ffmpeg -version
ffmpeg version n2.2.6
built on Aug 7 2014 17:44:37 with gcc 4.4.5 (GCC) 20101112 (Red Hat 4.4.5-2)
configuration: –prefix=/root/ffmpeg_build –extra-cflags=-I/root/ffmpeg_build/include –extra-ldflags=-L/root/ffmpeg_build/lib –bindir=/root/bin –extra-libs=-ldl –enable-version3 –enable-libopencore-amrnb –enable-libopencore-amrwb –enable-libvpx –enable-libfaac –enable-libmp3lame –enable-libtheora –enable-libvorbis –enable-libx264 –enable-libvo-aacenc –enable-libxvid –disable-ffplay –enable-gpl –enable-postproc –enable-nonfree –enable-avfilter –enable-pthreads
libavutil 52. 66.100 / 52. 66.100
libavcodec 55. 52.102 / 55. 52.102
libavformat 55. 33.100 / 55. 33.100
libavdevice 55. 10.100 / 55. 10.100
libavfilter 4. 2.100 / 4. 2.100
libswscale 2. 5.102 / 2. 5.102
libswresample 0. 18.100 / 0. 18.100
libpostproc 52. 3.100 / 52. 3.100

 

See complete list of ffmpeg options using # ffmpeg -h full | less
Now I am just showing, how to convert a video type to another format. I am converting a mp4 video to avi

# ffmpeg -i my_video.mp4 my_video.avi
ffmpeg version n2.2.6 Copyright (c) 2000-2014 the FFmpeg developers
built on Aug 7 2014 17:44:37 with gcc 4.4.5 (GCC) 20101112 (Red Hat 4.4.5-2)
configuration: –prefix=/root/ffmpeg_build –extra-cflags=-I/root/ffmpeg_build/include –extra-ldflags=-L/root/ffmpeg_build/lib –bindir=/root/bin –extra-libs=-ldl –enable-version3 –enable-libopencore-amrnb –enable-libopencore-amrwb –enable-libvpx –enable-libfaac –enable-libmp3lame –enable-libtheora –enable-libvorbis –enable-libx264 –enable-libvo-aacenc –enable-libxvid –disable-ffplay –enable-gpl –enable-postproc –enable-nonfree –enable-avfilter –enable-pthreads
libavutil 52. 66.100 / 52. 66.100
libavcodec 55. 52.102 / 55. 52.102
libavformat 55. 33.100 / 55. 33.100
libavdevice 55. 10.100 / 55. 10.100
libavfilter 4. 2.100 / 4. 2.100
libswscale 2. 5.102 / 2. 5.102
libswresample 0. 18.100 / 0. 18.100
libpostproc 52. 3.100 / 52. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from ‘my_video.mp4’:
Metadata:
major_brand : FACE
minor_version : 1337
compatible_brands: isomavc1FACE
creation_time : 2013-01-18 03:43:54
Duration: 00:00:59.23, start: 0.000000, bitrate: 325 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 400×224, 230 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
Metadata:
creation_time : 2013-01-18 03:43:54
handler_name : /tmp/tmpIZkUUJ/540138109343874.mp4_video.264 – Imported with GPAC 0.4.6-DEV-rev3544
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 93 kb/s (default)
Metadata:
creation_time : 2013-01-18 03:43:54
handler_name : /tmp/tmpIZkUUJ/540138109343874.mp4_audio.aac – Imported with GPAC 0.4.6-DEV-rev3544
Output #0, avi, to ‘my_video.avi’:
Metadata:
major_brand : FACE
minor_version : 1337
compatible_brands: isomavc1FACE
ISFT : Lavf55.33.100
Stream #0:0(und): Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 400×224, q=2-31, 200 kb/s, 29.97 tbn, 29.97 tbc (default)
Metadata:
creation_time : 2013-01-18 03:43:54
handler_name : /tmp/tmpIZkUUJ/540138109343874.mp4_video.264 – Imported with GPAC 0.4.6-DEV-rev3544
Stream #0:1(und): Audio: mp3 (libmp3lame) (U[0][0][0] / 0x0055), 44100 Hz, stereo, fltp (default)
Metadata:
creation_time : 2013-01-18 03:43:54
handler_name : /tmp/tmpIZkUUJ/540138109343874.mp4_audio.aac – Imported with GPAC 0.4.6-DEV-rev3544
Stream mapping:
Stream #0:0 -> #0:0 (h264 -> mpeg4)
Stream #0:1 -> #0:1 (aac -> libmp3lame)
Press [q] to stop, [?] for help
frame= 1773 fps=182 q=9.1 Lsize= 2725kB time=00:00:59.24 bitrate= 376.8kbits/s
video:1694kB audio:926kB subtitle:0 data:0 global headers:0kB muxing overhead 4.021155%

ffmpeg

 

You are good to go now 🙂

 

Older posts «