ABHIONLINUX
Site useful for linux administration and web hosting

2011/09/19

FFmpeg installation

Installing a52

wget http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz
# tar -zxf a52dec-0.7.4.tar.gz
# cd a52dec-0.7.4
# ./configure --enable-shared=PKGS
# make
# make install



# wget http://sourceforge.net/projects/faac/files/faac-src/faac-1.28/faac-1.28.tar.gz/download
# tar -xvzf faac-1.28.tar.gz
# ./bootstrap
#  ./configure
# make
# make install
# cd ..

installing  faad
 # wget http://sourceforge.net/projects/faac/files/faad2-src/faad2-2.7/faad2-2.7.tar.gz/download
 # tar -xvzf faad2-2.7.tar.gz
]#  autoreconf -vif
# ./configure --disable-drm --disable-mpeg4ip
# make
# make install

installing lame:
# wget http://sourceforge.net/projects/lame/files/lame/3.98.4/lame-3.98.4.tar.gz/download
# tar -xvzf lame-3.98.4.tar.gz
# ./configure
# make
# make install
intall yasm
# wget http://www.tortall.net/projects/yasm/releases/yasm-1.1.0.tar.gz
# tar -xvzf yasm-1.1.0.tar.gz
]# ./configure
#make
# make install

x264
git clone git://git.videolan.org/x264.git
./configure --enable-shared --prefix=/usr
make
make install

xvidcore
wget http://downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gz
 tar -xvzf xvidcore-1.3.2.tar.gz
 cd build/generic/
./configure
make
make install


./configure
make
make install

libraw installation


wget http://sourceforge.net/projects/libraw1394/files/libraw1394/libraw1394-2.0.5.tar.gz/download
 tar -xvzf libraw1394-2.0.5.tar.gz
./configure 
make
make install

wget http://sourceforge.net/projects/libdc1394/files/libdc1394-2/2.1.2/libdc1394-2.1.2.tar.gz/download
./configure
make
make install


wget http://sourceforge.net/projects/opencore-amr/files/opencore-amr/0.1.2/opencore-amr-0.1.2.tar.gz/download
./configure
make
make install

echo y | cp * /usr/local/lib/codecs/
 echo y | cp * /usr/local/lib64/codecs/

libogg
 wget http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz
./configure
make 
make install

libvorbis
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.2.tar.gz
./configure
make
make install

wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.gz
tar -xvzf libtheora-1.1.1.tar.gz
./configure
make
make isntall

export LD_LIBRARY_PATH=/usr/local/lib/
echo /usr/local/lib > /etc/ld.so.conf.d/custom-libs.conf

yum install dirac dirac-devel


./configure --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvpx --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --disable-ffplay --enable-shared --enable-gpl --enable-postproc --enable-nonfree --enable-avfilter --enable-pthreads --extra-cflags=-fPIC






2011/09/16

MP4Box installation


Follow the steps given below to install MP4Box

#cd /usr/local/src/
# wget http://nchc.dl.sourceforge.net/project/gpac/GPAC/GPAC%200.4.5/gpac-0.4.5.tar.gz
# wget http://nchc.dl.sourceforge.net/project/gpac/GPAC%20extra%20libs/GPAC%20extra%20libs%200.4.5/gpac_extra_libs-0.4.5.tar.gz
# tar -zxvf gpac-0.4.5.tar.gz
# tar -zxvf gpac_extra_libs-0.4.5.tar.gz
# cd gpac_extra_libs
# cp -r * /usr/local/src/gpac/extra_lib
# cd gpac
# chmod 755 configure
# ./configure
# make lib
# make apps
# make install lib
# make install
# cp bin/gcc/libgpac.so /usr/lib

# which MP4Box
/usr/local/bin/MP4Box

2011/06/30

Missing pentaho while installing Kaltura

While installing Kaltura on your centos 5.6 64 bit server, you can  see the error
"Missing pentaho"

Fix:
# mkdir /usr/local/pentaho
#  wget http://sourceforge.net/projects/pentaho/files/Data%20Integration/3.2.0-stable/pdi-ce-3.2.0-stable.tar.gz
#  tar xvzf pdi-ce-3.2.0-stable.tar.gz
#  mv data-integration pdi


ref: https://github.com/instructure/canvas-lms/wiki/Kaltura-setup-instructions



2011/06/27

how to install memcached on centos

You can use the command given below to find the centos version.

# cat /etc/redhat-release


Dependency that is needed for memcached is libevent. First we will proceed with  libevent.
Steps for installation libevent.
 # cd /usr/local/src/
 # curl -O http://monkey.org/~provos/libevent-1.4.14b-stable.tar.gz
 # tar xzvf libevent-1.4.14b-stable.tar.gz 
 # cd libevent-1.4.14b-stable
 # ./configure --prefix=/usr/local/
 # make 
 # make  install

Next we need to  install memcached.
# cd /usr/local/src
# curl -O http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz
# tar -xvzf memcached-1.4.5.tar.gz
# cd memcached-1.4.5
# LDFLAGS='-Wl,--rpath /usr/local/lib' ./configure --prefix=/usr/local
# make
# make install

You can verify the memcache using the command
# memcached -u root -d
If there are no errors, memcache is successfully installed and is running.
# ps aux | grep memcached

Note: 
memcached: error while loading shared libraries: libevent-1.4.so.2: 
  cannot open shared object file: No such file or directory
  configure: error: libevent is required
  If it's already installed, specify its path using --with-libevent=/dir/


Install php-memcache

Please try the following steps
wget http://pecl.php.net/get/memcache-3.0.3.tgz
# tar -xvzf memcache-3.0.3.tgz
# cd memcache-3.0.3
# phpize
#./configure
# make
# make install

Open php.ini
# vi /etc/php.ini
add the line given below.
extension=memcache.so


Then restart apache. You can check this my "php -m | grep memcache"


How to reset a kloxo admin password

If you have forgot the kloxo admin password , you can try the following fix.

You should have root access to the server.
1. Ssh to the server as root.
2. Run the commands given below.


cd /usr/local/lxlabs//httpdocs
# /usr/bin/lphp.exe  ../bin/common/resetpassword.php admin


You can use the password admin as your kloxo admin password.


2011/06/24

Clipbucket admin area showing blank page

When trying to access admin area of clipbucket , we will get blank page,

Fix:
First step we need to check is permission. Make sure that all your files and folders are having 644 and 755 respectively. Still the issue persists, go to step2

Next step is to fix out the file ClipBucket.class.php and search for the line  



" function get_cb_news()
{ "


Below this line, you need to add the following line
"return true "

Try this and your issue will be fixed.

2011/06/22

Connection to the server was reset - PHPmotion

Hello,


When you are trying to upload the larger videos in phpmotion, you may have got this error.


http://yourdomain.com/cgi-bin/uu_upload.pl?tmp_sid=815e201755c87c014ef49917cd76a186


The connection to the server was reset while the page was loading.
The network link was interrupted while negotiating a connection. Please try again

Fix: 
Issue may be due to apache or php getting timedout. You can fix by increasing the value Timeout in httpd.conf.

2011/06/10

SERVICE CURRENTLY NOT AVAILABLE! - Roundcube

Hello,

If you are getting this error "SERVICE CURRENTLY NOT AVAILABLE!" while accessing roundcube mail, you can fix it by  /usr/local/cpanel/bin/update-roundcube --force




2011/05/25

How to install memcache in the server

You can use the steps below to install memcache



cd /usr/local/src/
wget http://www.monkey.org/~provos/libevent-1.4.13-stable.tar.gz
tar -xvf libevent-1.4.13-stable.tar.gz
cd libevent-1.4.13-stable
./configure 
make
make install


cd ..
wget http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz


tar -xvf memcached-1.4.5.tar.gz
cd memcached-1.4.5
./configure && make
make install


 vi /etc/ld.so.conf.d/libevent-i386.conf  
create this file and add one line ->  # /usr/local/lib/


/sbin/ldconfig


start your memcached server up


/usr/local/bin/memcached -u nobody &


you should add this last command to /etc/rc.local so the memcached server starts if there is a reboot

2011/05/17

How to clear cache memory(RAM) in linux


Clear cache memory.

You can use the command given below to clear the pagecache
echo 1 > /proc/sys/vm/drop_caches

To  free dentries and inodes, you can use the command
echo 2 > /proc/sys/vm/drop_caches

To free pagecache, dentries and inodes:
echo 3 > /proc/sys/vm/drop_caches

2011/05/14

.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable


Is some cases, while browsing your domain you will be getting forbidden page. This is the problem with the directory / files permissions.

From /var/www/vhosts/domain.com/statistics/logs/error_log :  You can get the error

[critical] [client 192.168.1.1] (13)Permission
denied: /var/www/vhosts/domain.com/httpdocs/.htaccess pcfg_openfile:
unable to check htaccess file, ensure it is readable

This is due to incorrect permission for the httpdocs/httpsdocs

cd /var/www/vhosts/domain.com/
chmod 755 httpdocs
chmod 755 httpsdocs


This will work for you.

FFmpeg :: make: *** [ffmpeg_frame.lo] Error 1


When you try to install ffmpeg-php module in the server, you can get the error
FFmpeg :: make: *** [ffmpeg_frame.lo] Error 1

There are two fixes for this issue. Try the first one, if it doesnt fix then go to second.

Fix 1:

In the latest ffmpeg-php, you need to modify the file ffmpeg_frame.c
Usually location will be /usr/src/ffmpeginstaller/ffmpeg-php-0.6.0/ffmpeg_frame.c

Open the above mentioned file and  replace every instance of PIX_FMT_RGBA32 with PIX_FMT_RGB32

Then try to configure it,.

./configure
make
make install


Fix 2:
If the fix1 didnt fix the issue, you can follow this one.

You need to just copy the file ffmpeg_frame.loT to ffmpeg_frame.lo

cd /path/to/ffmpeg-php-0.6.0   ie  cd /usr/src/ffmpeginstaller/ffmpeg-php-0.6.0
cp  ffmpeg_frame.loT ffmpeg_frame.lo
make clean
./configure

This should fix the issue/

How to restore mysql database in linux plesk

You can use the command 'mysql' to restore the database. Exact command is given below.

mysql -u admin -p`cat /etc/psa/.psa/shadow` database_name < database_dump.sql

2011/05/12

How to install commands host, dig and nslookup in linux.


In a new linux server, when you try to run the command given below, it will be getting error.

[root@server /]# host abhionlinux.in
-bash: host: command not found

In such cases, you need to install the bind-utils package in the server.

1. ssh to the server.
2 run the command
[root@server /]# yum install bind-utils

Now host, dig and nslookup will be working fine.

2011/05/08

How to check open ports in linux


nmap -sS -O 127.0.0.1


Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2011-05-08 16:49 CEST
Interesting ports on server.abhi.com (127.0.0.1):
Not shown: 1660 closed ports
PORT     STATE SERVICE
21/tcp   open  ftp
22/tcp   open  ssh
25/tcp   open  smtp
53/tcp   open  domain
80/tcp   open  http
106/tcp  open  pop3pw
110/tcp  open  pop3
111/tcp  open  rpcbind
143/tcp  open  imap
443/tcp  open  https
465/tcp  open  smtps

Device type: general purpose
Running: Linux 2.4.X|2.5.X|2.6.X
OS details: Linux 2.5.25 - 2.6.3 
Uptime 95 days

Nmap run completed -- 1 IP address (1 host up) scanned in 2.341 seconds

2011/05/07

How to reset sshd config using WHM

In somecases your ssh config may have corrupted or ssh port may have blocked in the server due to mistake. In such cases, you can reset the sshd_config from whm.
Login to your whm, then you need to access the URL given below in your browser. Remember to replace the $IPADDRESS with your IP address. This will reset the ssh port to 22.


http://$IPADDRESS:2086/scripts2/doautofixer?autofix=safesshrestart

2011/05/05

Wrong mysql disk usage in cpanel.



You have zero databases in your cpanel account. After login to your cpanel, you can see the mysql database consuming more disk space.  This can be corrected by the following steps.

 Login to server and edit cpanel.config.

[root@server /]# vi /var/cpanel/users/cpanel.config

Replace 'disk_usage_include_sqldbs=0' with  'disk_usage_include_sqldbs=1'

Save this file and run the command given below.

[root@server /]# /scripts/update_db_cache

In the whm-tweak setting, you need to enable the option
'Use INFORMATION_SCHEMA to acquire MySQL disk usage (MySQL 5+ required) '


2011/04/25

/bin/mv: Argument list too long

When you are trying to move large number of files such 200000 files. you can use the command

mv  * /path/to/move

If you try the above command, you will be getting the error  "/bin/mv: Argument list too long"


You can use the command given below to avoid this error ,


find /path/to/file -type f | xargs -i mv "{}" /path/to/move


Try this out.. :)

2011/04/19

FFmpeg :: make: *** [ffmpeg_frame.lo] Error 1/

Sometimes you will get the error given below when installing ffmpeg-php in your server.
FFmpeg :: make: *** [ffmpeg_frame.lo] Error 1


Fix:
modify the file ffmpeg_frame.c and replace every instance of PIX_FMT_RGBA32 with PIX_FMT_RGB32


Now run make and make install


Eg: 
  • vi ffmpeg_frame.c
  • :%s/PIX_FMT_RGBA32/PIX_FMT_RGB32
  • :wq!

Another method is 
  • cd /path/to/ffmpeg-php-0.6.0
  • cp -aP ffmpeg_frame.loT ffmpeg_frame.lo
  • make clean
  • ./configure

How to install yasm

You can follow the steps given below to install yasm from source.


# wget http://www.tortall.net/projects/yasm/releases/yasm-0.7.0.tar.gz
# tar zfvx yasm-0.7.0.tar.gz
# cd yasm-0.7.0
#  ./configure
# make 
# make install
You can check the yasm binary using the command
# which yasm
/usr/local/bin/yasm

How to install Yamdi

You can follow the steps given below to install Yamdi

cd /usr/local/src/
wget http://downloads.sourceforge.net/project/yamdi/yamdi/1.4/yamdi-1.4.tar.gz?use_mirror=ufpr
tar zxf yamdi-1.4.tar.gz
cd yamdi-1.4
gcc yamdi.c -o yamdi -O2 -Wall
mv yamdi /usr/bin/
yamdi -h



You can check the yamdi binary using "which yamdi'

2011/04/09

How to install qt-faststart with ffmpeg


You can follow the steps given below to install qt-ffmpeg with ffmpeg. For this steps to work out, you should have a working ffmpeg installation in your server.

# svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
# cd ffmpeg
# ./configure
# make
#make tools/qt-faststart
#cp -a tools/qt-faststart /usr/bin/




2011/04/04

Spool file is locked (another process is handling this message) : Unable to send emails ,exim




There are many resons for this error. They may be due to dns, firewall.

Please try the fix given below.

#cd /var/spool/exim4/db
# mv * /backup
move all the files to a backup folder

#/etc/init.d/exim restart

This should fix the issue. If this doesnt fix the issue, please try by restarting the firewall. Firewall may be blocking your emails.

How to enable IP rotation in exim.


If your server are having multiple IP and you want to send each emails in different IP address. You can follow the steps given below. This is used to maintain the ip reputation. While doing this, please make sure that this is not used for spamming.

Open you exim config,

vi  /etc/exim.conf

search for the line : interface =

replace this line with
interface = 192.168.0.1${eval:${substr{-2}{1}{$tod_zulu}}%7+1}

If your server is having ip's from 192.168.0.11 to 192.168.0.20 , you can use above line.
+1 is  is the starting ip ie  192.168.0.1'1'
%9 is the incriment value ie 11(192.168.0.11) to how much. here it is 20 (192.168.0.20)



2011/03/28

Unable to load dynamic library ‘/usr/lib64/php/modules/ffmpeg.so


if you are getting the error message “Unable to load dynamic library ‘/usr/lib64/php/modules/ffmpeg.so” when you add the ffmpeg.so extension to the PHP configuration file i.e. php.ini file and tries to run PHP.

PHP Warning:  PHP Startup: Unable to load dynamic library ‘/usr/lib64/php/modules/ffmpeg.so’ – /usr/lib64/php/modules/ffmpeg.so: undefined symbol: _php_create_ffmpeg_frame in Unknown on line 0

Please try the fix given below.

Goto the the ffmpeg-php-0.x.0 directory and edit the ffmpeg_frame.c file

vi  /usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c

Now replace every instance of ‘PIX_FMT_RGBA32′ with ‘PIX_FMT_RGB32′ in the file by executing

Save the file and recompile ffmpeg-php

#ldconfig
#phpize
#./configure --enable-shared --with-ffmpeg=/usr/local/cpffmpeg
#make -j$cpu
#make install

phpize : command not found

#-bash: phpize: command not found


This error is due to "phpize" command not available on your server. To fix, install php-devel package.


yum  install php-devel

How to install GIT

Git is distributed version control system focused on speed, effectivity and real-world usability on large projects. Following are the steps to intsall Git

wget http://kernel.org/pub/software/scm/git/git-1.7.3.tar.bz2
tar jxvf git-1.7.3.tar.bz2
cd git-1.7.3
./configure
make && make install
git

2011/03/23

Yum update failed.


Yum update failed.
===================================
"-bash-3.1# yum update
Loading “installonlyn” plugin
error: no dbpath has been set
error: cannot open Packages database in /%{_dbpath}
Traceback (most recent call last):
File “/usr/bin/yum”, line 29, in ?
yummain.main(sys.argv[1:])
File “/usr/share/yum-cli/yummain.py”, line 82, in main
base.getOptionsConfig(args)
File “/usr/share/yum-cli/cli.py”, line 206, in getOptionsConfig
errorlevel=opts.errorlevel)
File “/usr/lib/python2.4/site-packages/yum/__init__.py”, line 132, in
doConfigSetup
self.conf = config.readMainConfig(startupconf)
File “/usr/lib/python2.4/site-packages/yum/config.py”, line 598, in
readMainConfig
yumvars['releasever'] = _getsysver(startupconf.installroot,
startupconf.distroverpkg)
File “/usr/lib/python2.4/site-packages/yum/config.py”, line 661, in
_getsysver
idx = ts.dbMatch(‘provides’, distroverpkg)
TypeError: rpmdb open failed"
==========================


If you are getting this error, you need to clear the database.

Yum clean all
rm -f /var/lib/rpm/_db*
rpm -rebuilddb
yum update

If this doesnt fix your issue, try the following steps also.

rm /dev/urandom
mknod -m 644 /dev/urandom c 1 9
yum clean all.


This should fix your issue.

2011/03/21

Command to check the performance of the hard disk.


Command to check the performance of the hard disk.

You can use the command given below to check the hard disk performance.

hdparm /dev/sda

/dev/sda:
 multcount     = 16 (on)
 IO_support    =  1 (32-bit)
 readonly      =  0 (off)
 readahead     = 256 (on)
 geometry      = 19457/255/63, sectors = 312581808, start = 0


You can replace /dev/sda with the name of your disk device.

2011/03/20

Request exceeded the limit of 10 internal redirects due to probable configuration error. Use ‘LimitInternalRecursion’ to increase the limit ifnecessary. Use ‘LogLevel debug’ to get a backtrace

Request exceeded the limit of 10 internal redirects due to probable configuration error. Use ‘LimitInternalRecursion’ to increase the limit ifnecessary. Use ‘LogLevel debug’ to get a backtrace


When you try to browse your website, if you are getting this error. This means that you have exceeded the limit of intername redictions used in your website.


To avoid  this error message simply use following code in .htaccess file.


RewriteRule .* - [L]

2011/01/22

Linux Plesk Back end files.

Plesk root directory :  /usr/local/psa
Plesk version          :  /usr/local/psa/version
Plesk Admin pass    :  /etc/psa/.psa.shadow
Plesk conf file         : /etc/psa/psa.conf
Apache conf           : /etc/httpd/conf/httpd.conf
Plesk apache startup script  : /usr/local/psa/admin/bin/httpsdctl start
Apache log files      : /var/log/http/
Php conf                :  /etc/php.ini
Named conf           : /var/named/run-root/etc/named.conf
Named db              : /var/named/run-root/var/domainname
Log                       : /var/log/messages
Names restart         : /etc/init.d/named restart
Mysql Db location  : /var/lib/mysql
Mysql conf            : /etc/my.cnf
Mysql log              : /var/log/mysql.log
Plesk qmail            : /var/qmail
Mail Dir for domain: /var/qmail/mailnames/domainname
Maillog                  : /var/log/maillog
Plesk home dir       : /var/www/vhosts/domain.com
Plesk Doc root       :  /var/www/vhost/domainname/httpdocs
Subdomain Docroot:  /var/www/vhost/domainname/subdomain
Domain specific log: /var/www/vhosts/domainname/statistics/logs


Plesk Db:
Plesk database is called psa. Admin logins are used to access psa db.

Following are the tables in psa db
1. Domains

2. Clients
3. db_users
4. db_bases
5. disk_spaces
6. mail
7. lockout
8. web_users

2011/01/14

Move worpress site from subfolder to root

Assume that wordpress is installed in /blog folder and root domain is abhionlinux.co.cc
You can follow the steps below to move the blog to root dir.

1. Backup the folder /blog , this is done as  a precaution.
2. Copy all the files in blog to root dir, make sure .htaccess file is also copied. There shouldnt be any index files such as index.php or index.html.
3. Add the following line in wp-config.php under root dir.


define('RELOCATE',true);

4. Open the URL abhionlinux.co.cc/wp-login.php and enter the admin login details.
5. Go to general settings, Make sure  in wordpress address field  you have abhionlinux.co.cc(root dir) and make blog address URL as abhionlinux.co.cc(root dir). Most likely it will be having
http://abhionlinux.co.cc/blog, dont leave '/' in domain name.
6. Check htaccess in root dir and make sure it is similar to the one given below.
====================
IfModule mod_rewrite.c
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
IfModule
===================

Now your wordpress site is move from subfolder to root dir. 
7. You can remove the line below from the file wp-config.php

define('RELOCATE',true);

Try it out !!!



2011/01/13

Moodle : ERROR: Could not find or create a directory (/home/username/public_html/uploaddata/16)

After creating the course, when you try to add files/folders in the course you will get an error "ERROR: Could not find or create a directory (/home/username/public_html/uploaddata/16"

This is due permission/ownership issue/.
Make sure that all your files and folders are having correct  ownership (username.username)
Check the permission for /uploaddata/, this should be set to 777.

Unable to login to Moodle site "Your session has timed out. Please login again"

When you try to login to your Moodle admin section,  you will get an error showing "Your session has timed out. Please login again"

Fix:
Check whether the folder /uploaddata/sessions/ is having 777 permission.
Clear all the session files in this folder.

Then you will be able to login to your website.