ABHIONLINUX
Site useful for linux administration and web hosting

2011/12/22

How to change the time zone for a domain

You can change the time zone for a domain in a shared server.

If the server php is compiled with Apache (dso module)
You can use htaccess to set the time zone for a domain.

SetEnv TZ location


For suphp servers,
You need to create custom php.ini for your domain and add the following

date.timezone = "location"

You can get the time zones from http://www.php.net/manual/en/timezones.php

special device *device-name* does not exist : LVM

OS in my server's hard disk  got corrupted. Only way to retrieve data is perform an OS reload in a new harddisk and connect the old hard disk as secondary. My drives are LVM. I have done OS reload on the new hard disk and connected the old one as secondary. When I try to mount the old hard disk, I am getting the error "special device *device-name* does not exist"

You can check the number of hard-disk connected to your server using fdisk -l.

I am trying to mount the old drive using the command.
mount /dev/VolGroup02/LogVol00   /old


/dev/VolGroup02/LogVol00  is the volomegroup name for the old hard disk.


Issue was when the new harddisk has been done with OS reload, its volume group name was  /dev/VolGroup01/LogVol00. Old harddisk volume group was already  /dev/VolGroup01/LogVol00  


When an os reload is performed, volume group for that drive will be /dev/VolGroup01/LogVol00. This will be done by default. When old harddisk volumegroup name and new harddisk volume group name became same, conflict occurs and can mount the old drive. What we have done is changed the volume group name for old drive to  /dev/VolGroup02/LogVol00

After that when we try to mount that old drive getting the error special device *device-name* does not exist.

You can fix it using the command

vgchange -ay  /dev/VolGroup02/LogVol00




"vgchange -ay" is to activate all known volume groups in the system. 
vgchange  allows you to change the attributes of one or more volume groups.



-a Controls the availability of the logical volumes in the volume group for input/output. In other
words, makes the logical volumes known/unknown to the kernel.





2011/12/14

Site error: the file /usr/local/cpanel/whostmgr/docroot/cgi/softaculous/enduser/main/functions.php requires the ionCube PHP Loader ioncube_loader_lin_5.2.so to be installed by the site administrator. - Softaculous

When we select Softaculous - Instant Installs under plugins option in WHM, you may get the error
"Site error: the file /usr/local/cpanel/whostmgr/docroot/cgi/softaculous/enduser/main/functions.php requires the ionCube PHP Loader ioncube_loader_lin_5.2.so to be installed by the site administrator."


Solution:
If you are getting this error, make sure that you have installed  ioncube loader in your server. You can do this using /scripts/easyapache

Still you are getting the error after installing  ioncube loader, You have to enable cPanels backend ioncube loader (WHM > Tweak settings > Loader to use for internal cPanel PHP).


Hope this will fix your issue.

2011/11/20

RKhunter installation

RKhunter is a tool used to scan the server for rootkits, backdoors and local exploits.

Steps to install RKhunter:

1. Download from

 wget http://sourceforge.net/projects/rkhunter/files/latest/download?source=files

2 Extract it
tar -xvzf rkhunter-1.3.8.tar.gz

3.  cd rkhunter-1.3.8

4. Run the installation command as given below.
./installer.sh --layout default --install


  /usr/local/bin/rkhunter --update

  /usr/local/bin/rkhunter --propupd

  /usr/local/bin/rkhunter -c









2011/11/06

Kaltura Installation

Kaltura is an open source video platform, video solutions, software and services for video publishing, management and monetization. It is mainly used in video hosting.
Following are the steps to install kalture in a cpanel server (Centos 5.6)

Pre-requisites:
1. Suphp and suexec should be disable for effective working of Kaltura.
2.  ini_set should be enable in php.ini
3. Php modules such as Exif, Mysqli, Iconv should be enabled in the server. This can be done using easyapache.
4. Apache module such as file_cache should be enabled .
5. Suhosin should be disabled in the server
6. Memcached and Pentaho should be installed.
7. Set 'lower_case_table_names = 1' in my.cnf and restart MySQL
8. Mysql root password should be taken. You can get this from the file /root/.my.cnf


Installation:
You can download the Kaltura installation file from Kaltura official website. Once the installation files is recieved, unzip that file. You can see a file called "install.php"


Login to the server as root and run the command given below.
php install.php


This will be asking certian questions such as 


1. In order to improve Kaltura Community Edition, we would like your permission to send system data to Kaltura. This information will be used exclusively for improving our software and our service quality. I agree (Y/n)  Y
2. If you wish, please provide your email address so that we can offer you future assistance (leave empty to pass):  admin@abhionliux.in
3. The following apachectl script has been detected: /usr/sbin/apachectl. Do you want to use this script to run your Kaltura application? Leave empty to use or provide a pathname to an alternative apachectl script on your server.
Leave it as empty
4. The following PHP binary has been detected: /usr/local/bin/php. Do you want to use this script to run your Kaltura application? Leave empty to use or provide a pathname to an alternative PHP binary on your server.
Leave it as empy
5. Full target directory path for Kaltura application (leave empty for /opt/kaltura)
Leave it as empy
6. Please enter the domain name/virtual hostname that will be used for the Kaltura server (without http://)
abhionlinux.co.cc
7 . Your primary system administrator email address
admin@abhionlinux.co.cc
8. The password you want to set for your primary administrator
*********
9. Database host (leave empty for 'localhost')
Leave empty
10. Database port (leave empty for '3306')
Leave empty
11. Database username (with create & write privileges)
root             
12. Database password (leave empty for no password)
rootpassword
13. The URL to your xymon/hobbit monitoring location. Xymon is an optional installation. Leave empty to set manually later
Leave Empty

You will get the following message.

============================================
 Installation Completed Successfully.
Your Kaltura Admin Console credentials:
System Admin user: admin@abhionlinux.co.cc
System Admin password: admin123

Please keep this information for future use.

To start using Kaltura, please complete the following steps:
1. Add the following line to your /etc/hosts file:
        127.0.0.1  abhionlinux.co.cc
2. Add the following line to your Apache configurations file (Usually called httpd.conf or apache2.conf):
        Include /opt/kaltura/app/configurations/apache/my_kaltura.conf
3. Restart apache
4. Browse to your Kaltura start page at: http://abhionlinux.co.cc/start
==============================================

Once you get this message, open the file /opt/kaltura/app/configurations/apache/my_kaltura.conf and you need to replace the * with the IP address
Eg :  VirtualHost *:80  
This should be replaced by  VirtualHost 192.168.0.10:80

Now you can access kalture using http://abhionlinux.co.cc/start







2011/09/19

ffmpeg-php installation

Download the latest ffmpeg-php. You can download it using

# wget http://sourceforge.net/projects/ffmpeg-php/files/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2/download
# tar -xvjf ffmpeg-php-0.6.0.tbz2
# phpize
# ./configure --enable-shared
# make
# make install

Once the installation is completed, you need to add the ffmpeg.so file in your php.ini

Locate you php.ini using
#  php -i | grep php.ini
Configuration File (php.ini) Path => /usr/local/lib
Loaded Configuration File => /usr/local/lib/php.ini

# vi /usr/local/lib/php.ini

add the following line to your php.ini file.
extension=”ffmpeg.so”

restart apache
#/etc/init.d/http restart

You can check the ffmpeg-php module using the command


# php -m | grep ffmpeg
ffmpeg


Common issues in installing ffmpeg-php
1. While running make, you will get an error
make: *** [ffmpeg_frame.lo] Error 1

Fix: Copy the file ffmpeg_frame.loT to ffmpeg_frame.lo
#cp ffmpeg_frame.loT ffmpeg_frame.lo
This should fix the above issue.

2. After enabling ffmpeg in php.ini, you can get an error 
php: symbol lookup error: /usr/local/lib/php/extensions/no-debug-non-zts-
20060613/ffmpeg.so: undefined symbol: register_ffmpeg_frame_class

Fix : Goto ffmpeg-php installation folder and open the file ffmpeg_frame.c and replace  all
PIX_FMT_RGBA32 with  PIX_FMT_RGB32

cd /usr/local/src/ffmpeg-php
# vi ffmpeg_frame.c
:%s/PIX_FMT_RGBA32/PIX_FMT_RGB32

:wq!

then you need to compile ffmpeg

#./configure --enable-shared
#make
#make install


Hope this will help you in installing ffmpeg-php in your server.

flvtool2




wget http://rubyforge.org/frs/download.php/17497/flvtool2-1.0.6.tgz
cd /usr/local/src/flvtool2-1.0.6/
ruby setup.rb config
ruby setup.rb setup
ruby setup.rb install

create db and user in mysql

mysql -u root -p
mysql> create database db;
Query OK, 1 row affected (0.00 sec)


mysql> grant all privileges on amarokdb.* to amarokuser@localhost  identified by 'passwd';
Query OK, 0 rows affected (0.00 sec)

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