Thursday, September 30, 2010

Changing IP or Hostname on Linux

--Linux/OS Installation

IP=10.224.8.151
Subnet Mask=255.255.255.0
Gateway=10.224.8.1

Domain=abc.com
DNS=10.224.8.126
         10.224.8.120

Make sure IP is unused.

Below show IP address associated with eth0(which is primary NIC card)

# ifconfig eth0

Below shows default gateway

# route -n

To Change IP
================

Bringing down a network interface with ifconfig

# ifconfig eth0 down

Bringing up an Ethernet interface with ifconfig

# ifconfig eth0 192.168.99.14 netmask 255.255.255.0 up

Setting the Default Route

# route add default gw 192.168.99.254


To Change Hostnme
===================

Backup and edit the the file /etc/sysconfig/network

HOSTNAME=.

this will be available after a reboot.

a quicker way, in memory change is- edit

Backup and Edit the file /proc/sys/kernel/hostname.

but that won't be saved when you reboot.

Fixing bad fstab entries

How modify fstab when its 'ro' in "repair filesystem" mode ?

When Logged in as "Repair Filesystem" mode at console, by default "/" filessystem is READ only mode.

Remount "/" filesystem with RW option.

# mount -o remount,rw /


Then backup and edit /etc/fstab file for any wrong entries and reboot system again

#init 6

Linux init commands(To bounce server)

Init RUnlevels
====================

0        -        halt
1        -        Single user mode
2        -        Multiuser, without NFS (The same as 3, if you don't have networking)
3        -        Full multiuser mode
4        -        unused
5        -        X11
6        -        Reboot

to Reboot

#init 6

to Shutdown

# init 0

Mount CDROM in Linux

To mount CDROM on Linux

Use following command

Make sure /cdrom folder is available.

# mount -t iso9660 -o ro /dev/cdrom /cdrom

NFS monut notes

fuser -u /gbg

umount /gbg

Manual Mount
==================
mount -F nfs sgtnas:/life_backups /gbg

mount -o rw,bg,intr,hard,timeo=600,wsize=32768,rsize=32768 sgtnas:/life_backups /gbg

mount -o hard,vers=3,intr,suid,proto=udp,rsize=32768,wsize=32768 sgtnas:/life_backups /gbg


Auto Mount
=============
In /etc/vfstab, make sure that there is an entry for the backup mount point:

sgtnas:/life_backups -/gbg nfs -yes hard,vers=3,intr,suid,proto=udp,rsize=32768,wsize=32768


Check NFS Mount
======================
showmount -e sgtnas

showmount -e


rpcinfo -u sgtnas nfs

rpcinfo -u sgtnas mountd



rpcinfo -u nfs

rpcinfo -u mountd




mount -o rw,bg,intr,hard,timeo=600,wsize=32768,rsize=32768 nfsserver.domain.com:/path/to/remote/mountpoint /local-mountpoint


mount -o hard,vers=3,intr,suid,proto=udp,rsize=32768,wsize=32768 nfsserver.domain.com:/path/to/remote/mountpoint /local-mountpoint

In /etc/vfstab, make sure that there is an entry for the backup mount point:

ausmelb-corp-netappsfiler-tier3:/vol/vol1/dbbackup - /U99 nfs -  yes
             hard,vers=3,intr,suid,proto=udp,rsize=32768,wsize=32768


If you would like your machine to have normal root permissions to a
filesystem, the filesystem must be exported with the option
"root=clientmachine".



The exact checks used for an NFS mounted disk vary between platforms but in general the basic checks will include the following checks


a) The mount table (eg; /etc/mnttab) can be read to check the mount options
b) The NFS mount is mounted with the "hard" option
c) The mount options include rsize>=32768 and wsize>=32768
d) For RAC environments, where NFS disks are supported, the "noac" mount option is used.

JRE    1.6.0_13    C:\Program Files\Java\jre6        true

Running process in background

nohup rman target / cmdfile arch_purge.rcv log arch_purge.log &

nohup rman target / cmdfile arch_bkp.rcv log arch_bkp.log &

Linux RPM notes

Install RPM
==============
# rpm -ivh package.rpm

De-Install RPM
=============
# rpm -e package.rpm

Upgrade RPM
=============

# rpm -Uvh package.rpm

Query RPM
============
# rpm -qa| grep package

List all RPM installed
=======================

# rpm -qa

Unix USe Maint

To add Unix User account
===========================
useradd -g dba -d /export/home/pvaze -m -s /bin/sh -c "unix accnt" pvaze

To change Unix User Default Shell
=================================
usermod -u 100 -s /bin/bash oracle

Tuesday, September 14, 2010

Setting Unix Prompt

The command below, when adding to your .bash_profile or .proifle will make your 
prompt look something like this:
PS1='${LOGNAME}@${HOSTNAME}:${PWD}>'; export PS1
 
You may need to set the HOSTNAME environment variable for the hostname 
part to work, like this:

HOSTNAME=`hostname`; export HOSTNAME