Archive for the ‘Linux’ Category

Installing 32 bit Adobe Reader 9 to a 64 bit Ubuntu 9.04

November 5, 2009

Hi,

M Back again.

I wanted to install the Abode acrobat on my ubuntu 9.04. Checked the site, it had only i386 version of Acrobat in the Deb format. It is really bad on their behalf.

So tried to install the i386 version on to my 64 bit machine and it displayed many errors.

So had to use a proper option with the dpkg command to install the 32 bit version.

dpkg -i --force-architecture AdbeRdr9.2-1_i386linux_enu.deb

And it installed properly.

I do not understand one thing ,linux community wants it to be more fexible than windows, then why differentiate between 32bit and 64bit  binaries and create a problem for the users who want to install the 32 bit programs on the 64 bit machine.

They have to find a solution for this. Comman man can not use linux unless such problems are removed or handled properly.

Bye for now, I will be back again some day.

 

Enabling a Microphone on Ubuntu

September 21, 2009

i am back again after many days.

i installed ubuntu jaunty on my laptop and was tryin to configure the microphone but it failed to work.  so after 2 days of search , i finally meet with a solution.

Carried out following things to enable the microphone settings.

  1. Open the “Volume Control” panel.
  2. In the “Volume Control” panel: “Edit” → “Preferences”.
  3. In the “Volume Control Preferences” panel: tick “Microphone”, “Capture”, and “Capture 1”.
  4. Close the “Volume Control Preferences” panel.
  5. In the “Volume Control” panel, “Playback” tab: unmute the microphone.
  6. In the “Volume Control” panel, “Recording” tab: enable audio recording from capture.

finally i was able to test sucessfuly the skype account. Hope this thing will help u.

Bye for now.

Finding out versions of java, apache , php and mysql

June 26, 2009

Hi,

Use the following to find out the version info

java -version
java version “1.6.0_03″
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Server VM (build 1.6.0_03-b05, mixed mode)

php -v
PHP 4.3.9 (cgi) (built: Apr 17 2009 19:13:06)
Copyright (c) 1997-2004 The PHP Group

mysql -V
mysql  Ver 14.7 Distrib 4.1.22, for redhat-linux-gnu (i686) using readline 4.3

httpd -v
Server version: Apache/2.0.52

Hope this will  help you to determine the versions of the softwares.

Running a syntax check on /etc/my.cnf

June 3, 2009

To verify the my.cnf parameter changes

/usr/libexec/mysqld –help –verbose

Thoughts by Swamy Vivekananda

March 16, 2009

When I Asked God for Strength
He Gave Me Difficult Situations to Face

When I Asked God for Brain & Brown
He Gave Me Puzzles in Life to Solve

When I Asked God for Happiness
He Showed Me Some Unhappy People

When I Asked God for Wealth
He Showed Me How to Work Hard

When I Asked God for Favors
He Showed Me Opportunities to Work Hard

When I Asked God for Peace
He Showed Me How to Help Others

God Gave Me Nothing I Wanted
He Gave Me Everything I Needed

Simple firewall in linux

June 26, 2008

Just try this.

To use it:

  1. Create a file named /etc/init.d/firewall
  2. Copy and paste the script into it and save
  3. Edit the ALLOWED variable with port numbers you want to allow, default is ports 22 (SSH) and 80 (HTTP)
  4. Execute:
    touch /usr/local/etc/whitelist.txt && touch /usr/local/etc/blacklist.txt
  5. Edit the whitelist/blacklist files if you want
  6. Execute:
    chmod 755 /etc/init.d/firewall
  7. Execute:
    chkconfig --add firewall && chkconfig firewall on

The script:

#!/bin/bash
# chkconfig: 345 30 99
# description: Starts and stops iptables based firewall

## List Locations
#

WHITELIST=/usr/local/etc/whitelist.txt
BLACKLIST=/usr/local/etc/blacklist.txt

#
## Specify ports you wish to use.
#

ALLOWED="22 80 25"

#
## Specify where IP Tables is located
#

IPTABLES=/sbin/iptables

##
#DO NOT EDIT BELOW THIS LINE
###
RETVAL=0

# To start the firewall
start() {
  echo "Setting up firewall rules..."

	echo 'Allowing Localhost'
	#Allow localhost.
	$IPTABLES -A INPUT -t filter -s 127.0.0.1 -j ACCEPT

	#
	## Whitelist
	#

	for x in `grep -v ^# $WHITELIST | awk '{print $1}'`; do
	        echo "Permitting $x..."
	        $IPTABLES -A INPUT -t filter -s $x -j ACCEPT
	done

	#
	## Blacklist
	#

	for x in `grep -v ^# $BLACKLIST | awk '{print $1}'`; do
	        echo "Denying $x..."
	        $IPTABLES -A INPUT -t filter -s $x -j DROP
	done

	#
	## Permitted Ports
	#

	for port in $ALLOWED; do
	        echo "Accepting port TCP $port..."
	        $IPTABLES -A INPUT -t filter -p tcp --dport $port -j ACCEPT
	done

	for port in $ALLOWED; do
	        echo "Accepting port UDP $port..."
	        $IPTABLES -A INPUT -t filter -p udp --dport $port -j ACCEPT
	done

	$IPTABLES -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
	$IPTABLES -A INPUT -p udp -j DROP
	$IPTABLES -A INPUT -p tcp --syn -j DROP

  RETVAL=0
}

# To stop the firewall
stop() {
  echo "Removing all iptables rules..."
  /sbin/iptables -F
  /sbin/iptables -X
  /sbin/iptables -Z
  RETVAL=0
}

case $1 in
  start)
		stop
    start
    ;;
  stop)
    stop
    ;;
  restart)
    stop
    start
    ;;
  status)
    /sbin/iptables -L
    /sbin/iptables -t nat -L
    RETVAL=0
    ;;
  *)
    echo "Usage: firewall {start|stop|restart|status}"
    RETVAL=1
esac

exit $RETVAL

how to delete last command from bash history

June 19, 2008

If you have ever typed something into a command prompt that you wished you hadn’t – you may find it useful to know that you can delete it from ~/.bash_history very easily.

The command:

history -d offset

will delete the history entry at position offset.

# history
1 cd
2 history
3 ls -alhF
4 history
5 wget username:password@private.ftp.com/secret/file.tar.gz
6 history

so to delete the wget command (which contains a password) – just use:
history -d 5

# history -d 5
# history
1 cd
2 history
3 ls -alhF
4 history
5 history
6 history -d 5
7 history

But suppose you KNOW you’re about to enter a command you don’t want to go into history. It’d be nice if you could just tack a little “hideme” modifer onto the front or tail of your command and be done with it. Unfortunately from what I’ve been able to google there is no such feature built into history or bash.

Naturally I made one.

TMP=$(history | tail -1 | awk ‘{print $1}’) && history -d $TMP && \
paste_in_shell_and_replace_this_with_whatever_you_want_to_hide

Rather than holding down backspace, you may find it useful to know that in bash Ctrl-W will delete from the cursor to the beginning of the previous word. Or if you think you’re going to use it A LOT you may try to put a little function/alias into your .bashrc:

func_hide ()
{
TMP=$(history | tail -1 | awk ‘{print $1}’) && history -d $TMP
}

alias hideme=’func_hide’

Dig the sneaky:

# history
1 cd
2 history
3 ls -alhF
4 history
5 history
6 history -d 5
7 history
8 vi .bashrc
9 history
# hideme && mysecretcommand
# history
1 cd
2 history
3 ls -alhF
4 history
5 history
6 history -d 5
7 history
8 vi .bashrc
9 history
10 history

Checking disks for errors using the badblocks command

April 11, 2008

For better or worse I’ve been needing to check drives for errors quite a bit recently and have been using the badblocks command to do it. It’s definitely a command that people should become familiar with. Where fsck checks the file system for problems, badblocks attempts to ascertain the status of physical media which can include hard disks, usb drives, and other usb devices such as media players. I’ve compiled a detailed list of commands I’ve been using.

Read-only Test

This is a non-destructive read-only test which can be run on disk even if it contains a mounted filesystem. It simply verifies that each block can be read; it does not test for write errors.

  • sudo badblocks -s -v -c 10240 /dev/sdx
    • -s = show progress
    • -v = verbose mode
    • -c 10240 – check 10K blocks at a time

Read-write Test

This test is non-destructive read-write test which reads each block, writes it, then verifies it. It should not be used on block devices with mounted filesystems as it can lead to filesystem corruption.

  • sudo badblocks -n -s -v -c 10240 /dev/sdx
    • -n = non-destructive read-write mode
    • -s = show progress
    • -v = verbose mode
    • -c 10240 – check 10K blocks at a time

Write-mode Test

Using this command will erase all data on the device so only use it if that is what you want. This will write a few patterns to each block, verifying that each one is written and read correctly.

  • sudo badblocks -w -s -v -c 10240 /dev/sdx
    • -w = destructive write-mode test
    • -s = show progress
    • -v = verbose mode
    • -c 10240 – check 10K blocks at a time

Prepare a disk for encryption

The command will completely erase the data on a disk and replace it with random data. This is often a preferred way to prepare a disk for encryption as it is faster than other methods of filling a disk with random data and serves the purpose of checking the disk for errors before the encryption process.

  • sudo badblocks -w -t random -s -v -c 10240 /dev/sdx
    • -w = destructive write-mode test
    • -t random = write random data onto the disk
    • -s = show progress
    • -v = verbose mode
    • -c 10240 – check 10K blocks at a time

Convert -File System- ext2 to ext3

March 26, 2008

Hi all,

The tune2fs program can add a journal to an existing ext2 file system without altering the data already on the partition. If the file system is already mounted while it is being transitioned, the journal will be visible as the file .journal in the root directory of the file system. If the file system is not mounted, the journal will be hidden and will not appear in the file system at all.

To convert an ext2 file system to ext3, log in as root and type:

tune2fs -j /dev/xxx

This will create ext3 file system in the partition specified. Once this is over “without any errors” you should change the “file system type” in /etc/fstab and make it ext3. Then do a

mount -a

To check whether its mounted properly and the file system type, do

mount

PostgreSQL error (FATAL: invalid value for parameter “lc_monetary”: “en_US”)

February 14, 2008

Hi ,

m back after a long vacation.

If u get some error like this after installing postgresql

(Note m using a ubuntu Linux )

* Restarting PostgreSQL 8.1 database server  * The PostgreSQL server failed to start. Please check the log output:
FATAL:  invalid value for parameter “lc_monetary”: “en_US”  [fail]
Check which locales u are using.

for a unix system u can check it with this command

root@mail:/home/devenix# locale

Output wat i got is

LANG=en_US.UTF-8
LC_CTYPE=”en_US.UTF-8″
LC_NUMERIC=”en_US.UTF-8″
LC_TIME=”en_US.UTF-8″
LC_COLLATE=”en_US.UTF-8″
LC_MONETARY=”en_US.UTF-8″
LC_MESSAGES=”en_US.UTF-8″
LC_PAPER=”en_US.UTF-8″
LC_NAME=”en_US.UTF-8″
LC_ADDRESS=”en_US.UTF-8″
LC_TELEPHONE=”en_US.UTF-8″
LC_MEASUREMENT=”en_US.UTF-8″
LC_IDENTIFICATION=”en_US.UTF-8″
LC_ALL=

so with this u got wat locale u are using

after that copy the locale and paste in ur postgresql  config file at defined locations

File Path: /etc/postgresql/8.1/main/postgresql.conf

change following entries with the locale wat u got

lc_messages = ‘en_US.UTF-8′                     # locale for system error message
# strings
lc_monetary = ‘en_US.UTF-8′                     # locale for monetary formatting
lc_numeric = ‘en_US.UTF-8′                      # locale for number formatting
lc_time = ‘en_US.UTF-8′

and restart postgresql and check .