Archive for the ‘Linux General’ Category

h1

Missing Dependency: perl(URI)

November 10, 2010

Solution with an example below
###########################################

-bash-3.2# yum install subversion
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: centos.mirror.netriplex.com
* base: mirror.sanctuaryhost.com
* extras: mirror.steadfast.net
* updates: mirrors.serveraxis.net
addons                                                                                                                                           |  951 B     00:00
base                                                                                                                                             | 2.1 kB     00:00
extras                                                                                                                                           | 2.1 kB     00:00
updates                                                                                                                                          | 1.9 kB     00:00
Excluding Packages in global exclude list
Finished
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package subversion.i386 0:1.4.2-4.el5_3.1 set to be updated
–> Processing Dependency: perl(URI) >= 1.17 for package: subversion
–> Processing Dependency: neon >= 0.25.5-6.el5 for package: subversion
–> Processing Dependency: libneon.so.25 for package: subversion
–> Running transaction check
—> Package neon.i386 0:0.25.5-10.el5_4.1 set to be updated
—> Package subversion.i386 0:1.4.2-4.el5_3.1 set to be updated
–> Processing Dependency: perl(URI) >= 1.17 for package: subversion
–> Finished Dependency Resolution
subversion-1.4.2-4.el5_3.1.i386 from base has depsolving problems
–> Missing Dependency: perl(URI) >= 1.17 is needed by package subversion-1.4.2-4.el5_3.1.i386 (base)
Error: Missing Dependency: perl(URI) >= 1.17 is needed by package subversion-1.4.2-4.el5_3.1.i386 (base)
You could try using –skip-broken to work around the problem
You could try running: package-cleanup –problems
package-cleanup –dupes
rpm -Va –nofiles –nodigest
The program package-cleanup is found in the yum-utils package.

Solution
#########################
Get the latest perl-URI rpm from http://packages.sw.be/perl-URI/ and install it:


-bash-3.2# wget http://packages.sw.be/perl-URI/perl-URI-1.17-1.el2.rf.noarch.rpm
–2010-11-09 19:43:20–  http://packages.sw.be/perl-URI/perl-URI-1.17-1.el2.rf.noarch.rpm
Resolving packages.sw.be… 85.13.226.40
Connecting to packages.sw.be|85.13.226.40|:80… connected.
HTTP request sent, awaiting response… 302 Found
Location: http://rpmforge.sw.be/redhat/el2.1/en/i386/rpmforge/RPMS/perl-URI-1.17-1.el2.rf.noarch.rpm [following]
–2010-11-09 19:43:20–  http://rpmforge.sw.be/redhat/el2.1/en/i386/rpmforge/RPMS/perl-URI-1.17-1.el2.rf.noarch.rpm
Resolving rpmforge.sw.be… 85.13.226.40
Reusing existing connection to packages.sw.be:80.
HTTP request sent, awaiting response… 200 OK
Length: 94140 (92K) [application/x-rpm]
Saving to: `perl-URI-1.17-1.el2.rf.noarch.rpm’

100%[==============================================================================================================================>] 94,140       193K/s   in 0.5s

2010-11-09 19:43:21 (193 KB/s) – `perl-URI-1.17-1.el2.rf.noarch.rpm’ saved [94140/94140]

-bash-3.2# rpm -ivh perl-URI-1.17-1.el2.rf.noarch.rpm
Preparing…                ########################################### [100%]
1:perl-URI               ########################################### [100%]

-bash-3.2# yum install subversion
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: centos.mirror.netriplex.com
* base: mirror.sanctuaryhost.com
* extras: mirror.steadfast.net
* updates: mirrors.serveraxis.net
addons                                                                                                                                           |  951 B     00:00
base                                                                                                                                             | 2.1 kB     00:00
extras                                                                                                                                           | 2.1 kB     00:00
updates                                                                                                                                          | 1.9 kB     00:00
Excluding Packages in global exclude list
Finished
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package subversion.i386 0:1.4.2-4.el5_3.1 set to be updated
–> Processing Dependency: neon >= 0.25.5-6.el5 for package: subversion
–> Processing Dependency: libneon.so.25 for package: subversion
–> Running transaction check
—> Package neon.i386 0:0.25.5-10.el5_4.1 set to be updated
–> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
Package                                  Arch                               Version                                           Repository                          Size
========================================================================================================================================================================
Installing:
subversion                               i386                               1.4.2-4.el5_3.1                                   base                               2.3 M
Installing for dependencies:
neon                                     i386                               0.25.5-10.el5_4.1                                 base                               101 k

Transaction Summary
========================================================================================================================================================================
Install       2 Package(s)
Upgrade       0 Package(s)

Total download size: 2.4 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): neon-0.25.5-10.el5_4.1.i386.rpm                                                                                                           | 101 kB     00:00
(2/2): subversion-1.4.2-4.el5_3.1.i386.rpm                                                                                                       | 2.3 MB     00:01
————————————————————————————————————————————————————————
Total                                                                                                                                   1.2 MB/s | 2.4 MB     00:02
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing     : neon                                                                                                                                             1/2
Installing     : subversion                                                                                                                                       2/2

Installed:
subversion.i386 0:1.4.2-4.el5_3.1

Dependency Installed:
neon.i386 0:0.25.5-10.el5_4.1

Complete!
-bash-3.2#

h1

Automated Process monitoring during high server load

August 26, 2010

root@myServer [/root]# cat load-process-monitor.sh
#!/bin/bash

# Define Variables
DT=`date +”%A %b %e %r”`
HOSTNAME=`hostname`

# Create dir to store data
mkdir -p /opt/loadcheck/

# Retrieve the load average of the past 1 minute
LAVG=`uptime | awk {‘print $10}’ | cut -d. -f1`
LCURRENT=`uptime | awk {‘print $10,$11,$12}’`

# Define Threshold. This value will be compared with the current load average. Set the value as per your wish.
LIMIT=-1

# Compare the current load average with Threshold and email the server administrator if threshold is greater.

if [ $LAVG -gt $LIMIT ]
then

#Save the current running processes in a file
/bin/ps -auxf >> /opt/ps_output

echo “Current Time :: $DT. >> /tmp/loadmon.txt
echo “Current Load Average :: $LCURRENT. >> /tmp/loadmon.txt
echo “current processes list attached with the email 1 instance. >> /tmp/loadmon.txt
echo “Also check loadps.txt :: loadtop.txt :: netstat_all.txt :: netstat_port80.txt inside /opt/loadcheck/ on the server” >> /tmp/loadmon.txt
# Send email to support
/usr/bin/mutt -s “Server Load ALERT!!! High 1 minute load average on ‘$HOSTNAME'” -a /opt/ps_output support@somedomain.com > /opt/ps_output

echo “Current Time :: $DT” >> /tmp/loadmon.txt
echo “Current Load Average :: $LCURRENT” >> /tmp/loadmon.txt
echo “current processes list attached with the email 1 instance” >> /tmp/loadmon.txt
echo “Also check loadps.txt :: loadtop.txt :: netstat_all.txt :: netstat_port80.txt inside /opt/loadcheck/ on the server” >> /tmp/loadmon.txt
# Send email to support
/usr/bin/mutt -s ” Server Load ALERT ::: High 1 minute load average on ‘$HOSTNAME’ ” -a /opt/ps_output support@integrityhost.com > /opt/loadcheck/loadps.txt
echo “#########################################################################################################################” >> /opt/loadcheck/loadps.txt
/bin/top -c -n1 >> /opt/loadcheck/loadtop.txt
echo “#########################################################################################################################” >> /opt/loadcheck/loadtop.txt
/bin/netstat -ntu | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n >> /opt/loadcheck/netstat_all.txt
echo “#########################################################################################################################” >> /opt/loadcheck/netstat_all.txt
/bin/netstat -alntp | grep :80 | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n >> /opt/loadcheck/netstat_port80.txt
echo “#########################################################################################################################” >> /opt/loadcheck/netstat_port80.txt

/bin/ps -auxf >> /opt/loadcheck/loadps.txt
echo “#########################################################################################################################” >> /opt/loadcheck/loadps.txt
/bin/top -c -n1 >> /opt/loadcheck/loadtop.txt
echo “#########################################################################################################################” >> /opt/loadcheck/loadtop.txt
/bin/netstat -ntu | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n >> /opt/loadcheck/netstat_all.txt
echo “#########################################################################################################################” >> /opt/loadcheck/netstat_all.txt
/bin/netstat -alntp | grep :80 | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n >> /opt/loadcheck/netstat_port80.txt
echo “#########################################################################################################################” >> /opt/loadcheck/netstat_port80.txt

/bin/ps -auxf >> /opt/loadcheck/loadps.txt
echo “#########################################################################################################################” >> /opt/loadcheck/loadps.txt
/bin/top -c -n1 >> /opt/loadcheck/loadtop.txt
echo “#########################################################################################################################” >> /opt/loadcheck/loadtop.txt
/bin/netstat -ntu | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n >> /opt/loadcheck/netstat_all.txt
echo “#########################################################################################################################” >> /opt/loadcheck/netstat_all.txt
/bin/netstat -alntp | grep :80 | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n >> /opt/loadcheck/netstat_port80.txt
echo “#########################################################################################################################” >> /opt/loadcheck/netstat_port80.txt

/bin/ps -auxf >> /opt/loadcheck/loadps.txt
echo “#########################################################################################################################” >> /opt/loadcheck/loadps.txt
/bin/top -c -n1 >> /opt/loadcheck/loadtop.txt
echo “#########################################################################################################################” >> /opt/loadcheck/loadtop.txt
/bin/netstat -ntu | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n >> /opt/loadcheck/netstat_all.txt
echo “#########################################################################################################################” >> /opt/loadcheck/netstat_all.txt
/bin/netstat -alntp | grep :80 | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n >> /opt/loadcheck/netstat_port80.txt
echo “#########################################################################################################################” >> /opt/loadcheck/netstat_port80.txt

/bin/ps -auxf >> /opt/loadcheck/loadps.txt
echo “#########################################################################################################################” >> /opt/loadcheck/loadps.txt
/bin/top -c -n1 >> /opt/loadcheck/loadtop.txt
echo “#########################################################################################################################” >> /opt/loadcheck/loadtop.txt
/bin/netstat -ntu | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n >> /opt/loadcheck/netstat_all.txt
echo “#########################################################################################################################” >> /opt/loadcheck/netstat_all.txt
/bin/netstat -alntp | grep :80 | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n >> /opt/loadcheck/netstat_port80.txt
echo ” ######################################################################################################################### ” >> /opt/loadcheck/netstat_port80.txt

fi

# Remove residue logs
/bin/rm -f /tmp/loadmon.txt
/bin/rm -f /opt/ps_output

root@myServer [/root]#

Add a cron to run load-process-monitor.sh ( * * * * * /bin/sh /path-to/load-process-monitor.sh ) every min and when server load goes beyond 4, it will send you email and log some important details, which can help to some extent to find some pointers to load issue from process and netstat listings.

h1

Error: Missing Dependency: perl(Convert::ASN1) is needed by package samba

April 1, 2010

Error
root@server276 [~]# yum -y install samba samba-client samba-common
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: hpc.arc.georgetown.edu
* base: mirror.trouble-free.net
* extras: ftp.lug.udel.edu
* rpmforge: apt.sw.be
* updates: mirror.clarkson.edu
Excluding Packages in global exclude list
Finished
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package samba.x86_64 0:3.0.33-3.15.el5_4.1 set to be updated
–> Processing Dependency: perl(Convert::ASN1) for package: samba
—> Package samba-client.x86_64 0:3.0.33-3.15.el5_4.1 set to be updated
—> Package samba-common.i386 0:3.0.33-3.15.el5_4.1 set to be updated
—> Package samba-common.x86_64 0:3.0.33-3.15.el5_4.1 set to be updated
–> Finished Dependency Resolution
samba-3.0.33-3.15.el5_4.1.x86_64 from updates has depsolving problems
–> Missing Dependency: perl(Convert::ASN1) is needed by package samba-3.0.33-3.15.el5_4.1.x86_64 (updates)
Error: Missing Dependency: perl(Convert::ASN1) is needed by package samba-3.0.33-3.15.el5_4.1.x86_64 (updates)
You could try using –skip-broken to work around the problem
You could try running: package-cleanup –problems
package-cleanup –dupes
rpm -Va –nofiles –nodigest
The program package-cleanup is found in the yum-utils package.

Soln

root@server276 [~]# wget http://dag.wieers.com/rpm/packages/perl-Convert-ASN1/perl-Convert-ASN1-0.21-2.el5.rf.noarch.rpm
root@server276 [~]# rpm -Uvh perl-Convert-ASN1-0.21-2.el5.rf.noarch.rpm
Preparing… ########################################### [100%]
1:perl-Convert-ASN1 ########################################### [100%]
root@server276 [~]# yum -y install samba samba-client samba-common
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: hpc.arc.georgetown.edu
* base: mirror.trouble-free.net
* extras: ftp.lug.udel.edu
* rpmforge: apt.sw.be
* updates: mirror.clarkson.edu
Excluding Packages in global exclude list
Finished
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package samba.x86_64 0:3.0.33-3.15.el5_4.1 set to be updated
—> Package samba-client.x86_64 0:3.0.33-3.15.el5_4.1 set to be updated
—> Package samba-common.i386 0:3.0.33-3.15.el5_4.1 set to be updated
—> Package samba-common.x86_64 0:3.0.33-3.15.el5_4.1 set to be updated
–> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================================
Package Arch Version Repository Size
==============================================================================================================================================================
Installing:
samba x86_64 3.0.33-3.15.el5_4.1 updates 16 M
samba-client x86_64 3.0.33-3.15.el5_4.1 updates 5.7 M
samba-common i386 3.0.33-3.15.el5_4.1 updates 8.7 M
samba-common x86_64 3.0.33-3.15.el5_4.1 updates 8.8 M

Transaction Summary
==============================================================================================================================================================
Install 4 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 40 M
Downloading Packages:
(1/4): samba-client-3.0.33-3.15.el5_4.1.x86_64.rpm | 5.7 MB 00:03
(2/4): samba-common-3.0.33-3.15.el5_4.1.i386.rpm | 8.7 MB 00:03
(3/4): samba-common-3.0.33-3.15.el5_4.1.x86_64.rpm | 8.8 MB 00:02
(4/4): samba-3.0.33-3.15.el5_4.1.x86_64.rpm | 16 MB 00:04
————————————————————————————————————————————————————–
Total 2.7 MB/s | 40 MB 00:14
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : samba-common 1/4
Installing : samba-common 2/4
Installing : samba-client 3/4
Installing : samba 4/4

Installed:
samba.x86_64 0:3.0.33-3.15.el5_4.1 samba-client.x86_64 0:3.0.33-3.15.el5_4.1 samba-common.i386 0:3.0.33-3.15.el5_4.1
samba-common.x86_64 0:3.0.33-3.15.el5_4.1

Complete!
root@server276 [~]#

h1

There could also be a problem with the server’s session.save_path

June 9, 2009


New joomla install would show following:

An error has occurred.:Cookies do not appear to be enabled on your browser client. You will not be able to install the application with this feature disabled. Alternatively, there could also be a problem with the server’s session.save_path. If this is the case, please consult your hosting provider if you don’t know how to check or fix this yourself.

and

existing admin login to  joomla installations were not authenticating.

Soln=====>

Compare the following in php.ini

Working configuration
#############################

[root@server  root]# grep session. /usr/local/lib/php.ini
session.save_handler = files
; variable in order to use PHP’s session functions.
;     session.save_path = “N;/path”
; where N is an integer.  Instead of storing all the session files in
; store the session data in those directories.  This is useful if you
; a more efficient layout for servers that handle lots of sessions.
;         You can use the script in the ext/session dir for that purpose.
;         use subdirectories for session storage
;session.save_path = /tmp
session.use_cookies = 1
; attacks which involve passing session ids in URLs; defaults to 0.
; session.use_only_cookies = 1
; Name of the session (used as cookie name).
session.name = PHPSESSID
; Initialize session on request startup.
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.serialize_handler = php
; on every session initialization.
session.gc_probability = 1
session.gc_divisor     = 100
session.gc_maxlifetime = 1440
; NOTE: If you are using the subdirectory option for storing session files
;       (see session.save_path above), then garbage collection does *not*
;       setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes):
;          cd /path/to/sessions; find -cmin +24 | xargs rm
; to initialize a session variable in the global scope, albeit register_globals
session.bug_compat_42 = 1
session.bug_compat_warn = 1
; HTTP_REFERER has to contain this substring for the session to be
session.referer_check =
session.entropy_length = 0
; Specified here to create the session id.
session.entropy_file =
;session.entropy_length = 16
;session.entropy_file = /dev/urandom
session.cache_limiter = nocache
session.cache_expire = 180
; – User may send URL contains active session ID
; – URL that contains active session ID may be stored
; – User may access your site with the same session ID
session.use_trans_sid = 0
[root@server root]#

Things to check for
##########################

1) check that the above are set and check that:

2) /tmp has permissions 1777

3) /dev/urandom exists, if not create it with following commands:
mknod -m 644 /dev/urandom c 1 9
chown root:root /dev/random /dev/urandom

4) uncomment
;session.save_path = /tmp
in php.ini , if the sessions folder is not /tmp ( by default for cpanel server installation it is /tmp , however if php/apache is installed on a plain server, the sessions folder is usually /var/lib/php/sessions or something)

h1

Install Latest postgresql using yum from pgsqlrpms

September 29, 2008

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

[root@server ~]# yum erase postgresql postgresql-server
[root@server ~]# wget http://yum.pgsqlrpms.org/reporpms/8.3/pgdg-centos-8.3-4.noarch.rpm
[root@server ~]# rpm -ivh pgdg-centos-8.3-4.noarch.rpm
[root@server ~]# yum install postgresql postgresql-server
[root@server ~]# chkconfig postgresql on
[root@server ~]# service postgresql initdb
[root@server ~]# chkconfig postgresql on && service postgresql start

[root@server ~]# /usr/bin/postgres –version
postgres (PostgreSQL) 8.3.4
[root@server ~]#

Set port and the interface to bind to

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

vi /var/lib/pgsql/data/postgresql.conf

# – Connection Settings –

listen_addresses = ‘*’
port = 5432

h1

NMAP

September 23, 2008

echo ” ========== Installing NMAP network Scanner ================= ”
echo “…………………………………………………………………………………………………………………..”
echo “…………………………………………………………………………………………………………………..”

echo “Cleaning old nmap installation, if any ”

yum -y remove nmap
echo “…………………………………………………………………………………………………………………..”
echo “Install beings ”
yum -y install nmap

if [ -f /usr/bin/nmap ]
then

echo ” Nmap successfully installed”
sleep 2
echo ” Testing Nmap ”
echo ” ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++”
sleep 3
/usr/bin/nmap localhost -v
sleep 5
else
echo ” Nmap faield to install”
fi

echo ” =========== Install NMAP network Scanner process completed  ===============”
echo “…………………………………………………………………………………………………………………..”
echo “…………………………………………………………………………………………………………………..”
echo “…………………………………………………………………………………………………………………..”

h1

htaccess 302 ( temporary ) and 301 ( primary) redirects

August 22, 2008

There are permanent are temporary redirect methods that can be applied to .htaccess.

A permanent redirect will notify the visitor’s browser to update any bookmarks that are linked to the page that is being redirected. Temporary redirects will not update the visitor’s bookmarks.

Temporary Redirect ( 302 redirect )
########################################
RewriteEngine on

RewriteCond %{HTTP_HOST} ^domain.com$
RewriteRule ^/?$ “http\:\/\/www\.domain\.com” [R=302,L]

###

Permanent Redirect ( 302 redirect )

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

RewriteEngine on

RewriteCond %{HTTP_HOST} ^domain.com$
RewriteRule ^/?$ “http\:\/\/www\.domain\.com” [R=301,L]

###

The above example will redirect domain.com to http://www.domain.com in browser.

.