Sunday, December 11, 2011

How to do check the file system in Linux

 Take down system to single user mode and umount system

Following are steps :
=> Use init (process control initialization ) command to change runlevel 1 (singe user mode)
=> Use umount command to unmount /home file system
=> Run fsck using fsck command

Let us say you would like to run fsck on /home (/dev/sda3):

# init 1
# umount /home
# umount /dev/sda
# fsck /homeOR
# fsck /dev/sda3OR
# e2fsck -y /dev/sda3
(b) Boot from the installation CD into rescue mode

If you are using Cent OS/Fedora Core/RHEL linux, boot from first CD and at boot prompt type linux rescue nomount:
boot: linux rescue nomount

Now make new node for disk and partition 3:
# mknod /dev/sda
# mknod /dev/sda3
# fsck /dev/sda3
OR
# e2fsck -y /dev/sda3

Don't forget to reboot the system:
# exit;exit
# reboot

To configure VNC Server in Solaris

ncserver installation in solaris

1. Download latest version of VNC server for Solaris from http://www.realvnc.com/products/download.html

 Download vnc-4_1_3-sparc_solaris.pkg.gz

 Note : download .pkg.gz not tar.gz

2. The package will be in gzip format. Use gunzip command to extract and it will give a pkg file.
# gunzip vnc-4_1_3-sparc_solaris.pkg.gz

3. Install VNC server in the system.
# pkgadd -d vnc-4_1_3-sparc_solaris.pkg

4. Following command to be used to configure VNC server on the server.
# vncserver -alwaysshared -geometry 1152x864 :1

5. Set PATH variable in profile of user.
#  export PATH=$PATH:/usr/sbin:/usr/bin:/usr/java/bin:/usr/local/bin:/usr/openwin/bin
6. VNC server is using different set of login authentication than the /etc/passwd. Meaning that, you have to create VNC login password for individual solaris login accounts who are granted remote access with VNC client. To create VNC login password, just execute vncpasswd command and enter a valid password twice as usual.
7. To start an instance of VNC server, just execute vncserver command, which will create the $HOME/.vnc directory with VNC default startup scripts inside (if $HOME/.vnc is not currently exists).Following entries should be present in xstartup file in $HOME/.vnc
# vi $HOME/.vnc/xstartup
#! /bin/sh
Xrdb $HOME/.Xresources
xsetroot -solid grey
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
# twm &
/usr/dt/bin/Xsession &

8. The vncserver command will start up a VNC server that open 3 next available TCP/IP port, starting from 5801, 5901, and 6001 respectively. Port 5801 is for VNC client connection over HTTP protocol, port 5901 is for VNC client connection over RFB protocol and port 6001 is to allow X applications to connect to the VNC server. By executing vncserver for the second time or execute the vncserver :2 command, this will startup VNC server that bind and listen to port 5802, 5902, and 6002 respectively.
9. To connect to Solaris VNC server over HTTP protocol, just type http://:5801 at any javascripts-enabled web browser, such as Mozilla Firefox, Opera, or Internet Explorer.
10. To kill the VNC server, just execute vncserver -kill :1 will kill the first VNC server that bind and listen to port 5801, 5901, and 6001.
The vncserver -kill: 2 will kill the second VNC server, and so on.
11. Log files will be stored in $HOME/.vnc/systemname:port.log



server:
------------
Run below command on vnc server
#vncserver -rfbport 29001 (the display number you desired to use)

On client:
------------
Run below command from client machine:

#vncviewer server name or IP address:29001 (the display number you desired to use)

That should allow you to login into the system.

Password less authentication with ssh

bash-3.00$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/u02/app/appavnp/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /u02/app/appavnp/.ssh/id_rsa.
Your public key has been saved in /u02/app/appavnp/.ssh/id_rsa.pub.
The key fingerprint is:
65:c7:50:74:8b:f6:24:e8:9c:35:00:57:99:a4:24:ff appavnp@erp3

ssh-copy-id -i .ssh/id_rsa.pub ornellas@apanela.com

How to create Swap space with a file

a) Login as the root user
b) Type following command to create 8GB swap file (1024 * 1024 * 8  =  8388608 block size):
# dd if=/dev/zero of=/swapfile bs=1024 count=8388608
Note : In  server there was not enough space to create swap file of 8 GB on / parent directory

a)    Create a file /u01/swapfile
b)    Create a symlink from the parent directory
cd  /

ln –s /u01/swapfile                   /swapfile


c)  Set up a Linux swap area:
# mkswap /swapfile

d)  Activate /swapfile swap space immediately:
# swapon /swapfile

e) To activate /swapfile after Linux system reboot, add entry to /etc/fstab file. Open this file using text editor such as vi:
# vi /etc/fstab
Append following line:
/swapfile swap swap defaults 0 0
So next time Linux comes up after reboot, it enables the new swap file for you automatically.
f) How do I verify swap is activated or not?
Simply use free command:
#  free -m

Configuring Sudo with the log rotations for 90 days

 To create the logs for 90 days

$touch /var/log/sudolog
 vi /etc/sudoers and add following lines : -----
 Defaults !syslog
 Defaults logfile = /var/log/sudolog ----- Then save it.
 Rotating this log file : vi /etc/logrotate.d/sudolog and put following : ------
/var/log/sudolog {
rotate 90
size 5M
postrotate
/usr/bin/killall -HUP syslogd
endscript
}
To add user in the sudo
User_Alias   SIERRA = sadba

# Cmnd alias specification

# Defaults specification

# User privilege specification
root    ALL=(ALL) ALL
SIERRA  ALL=/bin/chmod , /bin/chown , /bin/su - * , /bin/su * , !/bin/su - , !/bin/su - root
arvind ALL=(ALL) ALL
# Uncomment to allow people in group wheel to run all commands
# %wheel        ALL=(ALL)       ALL

Defaults:SIERRA         !lecture

# Same thing without a password
# %wheel        ALL=(ALL)       NOPASSWD: ALL

# Samples
# %users  ALL=/sbin/mount /cdrom,/sbin/umount /cdrom
# %users  localhost=/sbin/shutdown -h now
Defaults:SIERRA         !lecture,timestamp_timeout=30

Friday, December 2, 2011

Upgradation of Veritas NETBACKUP from 6.5 to 7.1


How to upgrade VERITAS Netbackup from 6.5 - 7.1

1) First take full hot Catalog backup.
2) Install RHEL 5.6 64 bit OS
3) Install java 1.6. yum install java, it will install openjdk 1.6
4) Download the software Veritas Netbackup NetBackup_6.5_ICS_LinuxX86.tar.gz, NetBackup_6.5_LinuxRedhat2.6.tar.gz
NB_6.5.4.linuxR_x86_326374.tar
NB_JAV_6.5.4_326406.tar
NB_CLT_6.5.4_326396.tar
NetBackup_7.1_LinuxR_x86_64

5) First install NetBackup_6.5_ICS_LinuxX86.tar.gz

# tar -xvf NetBackup_6.5_ICS_LinuxX86.tar.gz

# cd NetBackup_6.5_ICS_LinuxX86.tar.gz

# ./install

 Symantec Infrastructure Core Services Installer 5.0             

Symantec Product                            Version Installed   Licensed
===========================================================================
Symantec Private Branch Exchange                    1.5.0.6       no
Symantec Product Authentication Service             no            no
Symantec Product Authorization Service              no            no

Task Menu:

    I) Install/Upgrade a Product  C) Configure an Installed Product
    L) License a Product          P) Perform a Pre-Installation Check
    U) Uninstall a Product        D) View a Product Description
    Q) Quit                       ?) Help

Enter a Task: [I,C,L,P,U,D,Q,?] I

             Symantec Infrastructure Core Services Installer 5.0             

     1)  Symantec Private Branch Exchange
     2)  Symantec Product Authentication Service
     3)  Symantec Product Authorization Service
     b)  Back to previous menu

Select a product to install: [1-3,b,q]

Choose option 1

and it will install the PBX ( Private Branch Exchange )



6)# tar -xvf NetBackup_6.5_LinuxRedhat2.6.tar.gz
# cd NB_65_LinuxR_x86_20070723 

# ./install

It will ask for the serial number. Please provide the serial number

After that installation will be completed.


# Next Step is to patch it Veritas 6.5.4


7) Created a directory patch

#mkdir patches

#cd patches

# tar -xvf ../NB_JAV_6.5.4_326406.tar
# tar -xvf ../NB_CLT_6.5.4_326396.tar
# tar -xvf ../NB_6.5.4.linuxR_x86_326374.tar


# ./NB_update.install

# ./NB_update.install

There are 3 packs available in /opt/patches:
(* denotes installed pack)

        NB_6.5.4
        NB_CLT_6.5.4
        NB_JAV_6.5.4
   
Enter pack name (or q) [q]:


Type NB_CLT_6.5.4


After that it will install all the patches.


Now access

# cd /usr/openv/netbackup/bin

#./jnbSA


Note : Here I was getting an error for libXp

Note: We should have same host name & IP .i.e. we should used the same hostname & IP after converting the POLK & TAFT to 64 BIT OS



Click on the Recover the catalogs


Click on Next


Specify the full path where hot Catalog backup file exist. Then Click on Next.




Note: Server is expecting to have media. Since this is test box and media server is not connected.
### Restore the hot Catalog backup only on 6.5.4 not in 7.1, since the database is different.

8) Now update it VERITAS NETBACKUP 7.1

# tar –xvf NetBackup_7.1_LinuxR_x86_64.tar.gz

# cd NetBackup_7.1_LinuxR_x86_64

#./install



Press y and provide the license key and it will installed.




Note: While recovery the Catalog I got an error not able to sync the media


Solution:




Right Click on the Media----------à Run the Inventory

Click on update volume configuration & click advanced options

Click on Media ID Generation (Robot number: 0 Barcode length: 8
Media ID generation rule: 1:2:3:4:5:6)