Archive

Archive for the ‘general’ Category

named capset failed

April 27th, 2009

Today I have come across an error when starting named service in cpanel. I could fix it by inserting the modules to the kernel using modprobe command.

 modprobe capability
modprobe commoncap
VN:F [1.9.6_1107]
Rating: 7.2/10 (6 votes cast)
VN:F [1.9.6_1107]
Rating: 0 (from 0 votes)

admin general, linux

random password generator

April 23rd, 2009

I was searching in google how to generate random password and got two good easy to use methods.

First one is the most simplest one

 uuidgen -r | cut -c-8 or uuidgen -t | cut -c-8  

The -r option is for random based uuid generation with help of /dev/random and -t uses system clock plus ethernet address.

Second method is to call a function

function randompass {
        pass= /dev/null 2>&1 || head -c 7)
        echo $pass
} 

now you can call this function in the shell script by just typing the name of the function “randompass”

VN:F [1.9.6_1107]
Rating: 6.2/10 (5 votes cast)
VN:F [1.9.6_1107]
Rating: 0 (from 0 votes)

admin general, linux ,

zlibVersion, version libmysqlclient_15 not defined in file libmysqlclient.so.15

April 16th, 2009

Hi,

I have come across this strange error after installing php-fpm for nginx.

 zlibVersion, version libmysqlclient_15 not defined in file libmysqlclient.so.15

From the error it was clear that there is a version mismatch that is defined for ZlibVersion in libmysqlclient.so.15. So next step was to find out which all libmysqlclient.so files are there in the server. Since I was not sure about the path of libmysqlclient locate was my command but before that I should update my database.

root@server1 [~]# updatedb &
root@server1 [~]# locate libmysqlclient.so

and the result was like this.

/usr/lib/libmysqlclient.so
/usr/lib/libmysqlclient.so.15
/usr/lib/libmysqlclient.so.15.0.0
/usr/lib/libmysqlclient.so.6
/usr/lib/mysql/libmysqlclient.so
/usr/lib/mysql/libmysqlclient.so.15
/usr/lib/mysql/libmysqlclient.so.15.0.0

Now I had removed the link file /usr/lib/libmysqlclient.so.15 and relinked to /usr/lib/libmysqlclient.so.15.0.0

by the command

root@server1 [~]#  ln -s /usr/lib/libmysqlclient.so.15.0.0 /usr/lib/libmysqlclient.so.15

Now issue php -V command you will see the error vanished.

VN:F [1.9.6_1107]
Rating: 2.0/10 (2 votes cast)
VN:F [1.9.6_1107]
Rating: -2 (from 2 votes)

admin general, linux ,

Tcpdump checking connections

March 10th, 2009

Hosting servers at some point of time should have faced a ddos attack. You will have lot of trouble in identifying the right command to use and check the connections to your server.Here is a small tip with tcpdump

tcpdump -v nn -w attack dst port 80

Catch upto 200 packets you can change the port number as well as the filename “attack” as per your need. Having done that you can now figure out the number of connections from the ips by following command

tcpdump -nr attack |awk ‘{print $3}’ |grep -oE ‘[0-9]{1,}.[0-9]{1,}.[0-9]{1,}.[0-9]{1,}’ |sort |uniq -c |sort -rn

Block the ips with maximum count using iptables.

iptables -I INPUT -s ipaddress -j DROP

VN:F [1.9.6_1107]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.6_1107]
Rating: 0 (from 0 votes)

admin general, linux

How to install clipshare

March 5th, 2009

First off download clipshare and unzip it. You will see installation.txt sql and upload folder after the extract.

Now check if your system is suPHP or not. Create a test php file test.php and add the following code




Now access this through the browser and if its showing your username then suPHP is enabled in the server so you can avoid the steps below of changing folder permission to 777 or else follow the complete steps.

1. Edit /upload/cgi-bin/ubr_upload.pl in a text editor, and change the path to (where you will insall the script)/tmp/uploader/ usually /home/user/public_hmtl/tmp/uploader/
2. Edit /upload/include/config.php in a text editor, and change the variables marked with “CHANGE HERE”
3. Edit /upload/include/dbconfig.php and enter your database info

Login to your control panel create a database,username and pass with all privileges.
4. Optional: Edit /upload/include/language.php to remove / add language files
5. Upload the contents (only the contents, not the folder itself) of the /upload folder on your server, in BINARY mode

6. Set write permissions (chmod 777) to the following folders:
/flvideo
/video
/thumb
/chimg
/photo
/tmp
/tmp/logs
/tmp/sessions
/tmp/thumbs
/tmp/uploader
/cache/templates_c
7. Set execute permissions (chmod 755) to /cgi-bin and /cgi-bin/ubr_upload.pl
8. Create database and database user. Import the database dump from /sql/clipshare.sql with phpmyadmin
9. Access your ClipShare Admin Panel at http://www.yourdomain.com/siteadmin/
Default admin user / password: admin / admin
- Change the admin user / password !!
- Change the site name, email, meta keywords, description, etc
- Optional: change different settings
- Create channels
- Add your advertising

Enjoy sharing videos !!!

VN:F [1.9.6_1107]
Rating: 6.9/10 (8 votes cast)
VN:F [1.9.6_1107]
Rating: -1 (from 1 vote)

admin general, linux ,

rpm got stuck

March 5th, 2009

If your server got stuck with rpm command do the following steps.

Remove cached DB
rm -fv /var/lib/rpm/__db.00*
rpm –rebuilddb

The last command takes some time so don’t stop it.

VN:F [1.9.6_1107]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.6_1107]
Rating: 0 (from 0 votes)

admin general, linux

Twitter update via shell Script

February 17th, 2009

Hope everyone is familiar with twitter if you still don’t check twitter.com

Twitter can be used to check updates online and its a great people to get updates online.

Save the code in twitter.sh


#!/bin/bash

read -p "Give your input : " -e input

curl –-basic –-user username:password –-data status="$input"
http://twitter.com/statuses/update.xml > /dev/null

echo “OK”


username and password should be edited to that of your twitter account.

Make sure you have curl installed in the server.

yum -y install curl

Now execute the script

sh twitter.sh

It will ask “Give your input :”

Enter your update it should be less than 140 characthers.

Enjoy twittering

Jim

SparkSupport

VN:F [1.9.6_1107]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.6_1107]
Rating: 0 (from 0 votes)

Shijil T S general, linux ,

Exim commands

February 17th, 2009

Exim commands

BASIC COMMANDS

Print a count of the messages in the queue: exim -bpc

Print a listing of the messages in the queue (time queued, size, message-id, sender, recipient): exim -bp

Print a summary of messages in the queue (count, volume, oldest, newest, domain, and totals): exim -bp | exiqsumm

Print what Exim is doing right now: exiwhat

Run a pretend SMTP transaction from the command line.The message will NOT actually be delivered : exim -bh 192.168.11.22

Display all of Exim’s configuration settings: exim -bP

SEARCHING THE QUEUE WITH exiqgrep

Use -f to search the queue for messages from a specific sender: ‘exiqgrep -f [user]@domain’

Use -r to search the queue for messages for a specific recipient/domain: exiqgrep -r [user]@domain

Use -o to print messages older than the specified number of seconds. For example, messages older than 1 day:

exiqgrep -o 86400

Use -y to print messages that are younger than the specified number of seconds. For example, messages less than an hour old:

exiqgrep -y 3600

MANAGING THE QUEUE

Start a queue run: exim -q -v

Remove a message from the queue: exim -Mrm <message-id>

Freeze a message: exim -Mf <message-id>

Remove all frozen messages: exiqgrep -z -i | xargs exim -Mrm

View a message’s headers: exim -Mvh <message-id>

View a message’s body: exim -Mvb <message-id>

View a message’s logs: exim -Mvl <message-id>

VN:F [1.9.6_1107]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.6_1107]
Rating: 0 (from 0 votes)

admin general, linux ,

How to: Ruby on Rails Installation and Configuration

November 28th, 2007

This article will guide you through the installation of Ruby on Rails in a linux machine. As you are aware Ruby on Rails made a splash with its simplicity and ease of use for devoloping web applications.

What is Ruby?

Ruby is a pure object-oriented programming language with a super clean syntax that makes programming elegant and fun. Ruby successfully combines Smalltalk’s conceptual elegance, Python’s ease of use and learning, and Perl’s pragmatism. Ruby originated in Japan in the early 1990s, and has started to become popular worldwide in the past few years as more English language books and documentation have become available.

What is Rails?

Rails is an open source Ruby framework for developing database-backed web applications. Rails is designed from the ground up to create dynamic Web sites that use a relational database backend. It adds key words to the Ruby programming language that make Web applications easier to configure. In addition, it’s designed to automatically generate a complete, if somewhat crude, Web application from an existing database schema. The latter is both Ruby’s greatest strength and its Achilles’ heel. Rails makes assumptions about database schema naming conventions that, if followed, make generating a basic Web site a matter of executing single command.

Installing the Software on CentOS

1. Install Ruby

Need to install the testing repository so add a file named “testing” to the directory /etc/yum.repos.d/ That will allow you to rock ruby 1.8.4.


# packages in testing

[testing]

name=CentOS-$releasever - Testing

baseurl=http://dev.centos.org/centos/$releasever/testing/$basearch/

gpgcheck=1

enabled=1

gpgkey=http://dev.centos.org/centos/RPM-GPG-KEY-CentOS-testing

Now you can use yum to install ruby
yum update

yum install ruby ruby-devel ruby-libs irb rdoc

2. Install Gem


cd /usr/local/src

wget http://rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgz

tar -xvzf rubygems-0.8.11.tgz

cd rubygems-0.8.11

ruby setup.rb

cd ..

3. Install fast-cgi


cd /usr/local/src

wget http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz

tar xzvf fcgi-2.4.0.tar.gz

cd fcgi-2.4.0

./configure

make

make install

cd ..

4. Install fast-cgi Bindings


cd /usr/local/src

wget http://sugi.nemui.org/pub/ruby/fcgi/ruby-fcgi-0.8.6.tar.gz

tar zxvf ruby-fcgi-0.8.6.tar.gz

cd ruby-fcgi-0.8.6

ruby install.rb config

ruby install.rb setup

ruby install.rb install

cd ..

5. Install Rails

gem install rails –include-dependencies

Ruby and Rails on Red Hat Enterprise Linux

Make sure you have installed zlib-devel installed otherwise Gem will fail.
up2date zlib-devel

First you need to install ruby installed using rpm’s from the machine.
To determine which all rpm’s installed


rpm -qa | egrep '(ruby)|(irb)'

To uninstall the installed ruby rpm’s


rpm -e ruby-docs-1.8.1-7.EL4.2 \

ruby-1.8.1-7.EL4.2 \

irb-1.8.1-7.EL4.2 \

ruby-libs-1.8.1-7.EL4.2 \

ruby-mode-1.8.1-7.EL4.2 \

ruby-tcltk-1.8.1-7.EL4.2 \

ruby-devel-1.8.1-7.EL4.2

Install Ruby from source


wget ftp://ftp.ruby-lang.org/pub/ruby/stable/ruby-1.8.4.tar.gz

tar xvzf ruby-1.8.4.tar.gz

cd ruby-1.8.4

./configure --prefix=/usr

make

make install

Install Ruby Gems


wget http://rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgz

tar xvzf rubygems-0.8.11.tgz

cd rubygems-0.8.11

ruby setup.rb

Install Rails


cd

gem update

gem update --system

rm `gem env gempath`/source_cache

rm -f ~/.gem/source_cache

gem update

gem install rails --include-dependencies

Now configuring mod_fastcgi Apache (1.3) config file httpd.conf

1. Install mod_fcgi module


curl -O http://fastcgi.com/dist/mod_fastcgi-2.4.2.tar.gz

or


wget http://fastcgi.com/dist/mod_fastcgi-2.4.2.tar.gz

tar xvfz mod_fastcgi-2.4.2.tar.gz

cd mod_fastcgi-2.4.2

/usr/local/apache/bin/apxs -cia mod_fastcgi.c

2. Configuring httpd.conf


LoadModule fastcgi_module modules/mod_fastcgi.so

AddHandler fastcgi-script .fcgi .fcg .fpl

service httpd restart

3. Edit the .htaccess file


change /dispatch.cgi to /dispatch.fcgi

4. This server has been upgraded to MySQL 4.1

The default Ruby mysql driver will not connect because it is running in old_password compatibility mode (otherwise Ensim cannot connect). In order to fix it we need to reinstall the mysql-ruby client


wget http://www.tmtm.org/en/mysql/ruby/mysql-ruby-2.5.tar.gz

tar vxzf mysql-ruby-2.5.tar.gz

cd mysql-ruby-2.5

ruby extconf.rb --with-mysql-config=/usr/bin/mysql_config

5. Edit your .htaccess with following entries


#Set to development, test, or production

DefaultInitEnv RAILS_ENV production

 Options Indexes ExecCGI FollowSymLinks

RewriteEngine On

RewriteRule ^$ index.html [QSA]

RewriteRule ^([^.]+)$ $1.html [QSA]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
VN:F [1.9.6_1107]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.6_1107]
Rating: 0 (from 0 votes)

Shijil T S Articles, general, linux ,