Wednesday, August 12, 2009

Solaris Volume Manager SVM Mirror

Overview:

Server is used for GPRS facility...

  1. Two Sun Fire V240 servers are present.

Server Hostnames

· RADBAN1

· RADBAN2

Both nodes have the same configuration one will be active server & other will be passive for Redundant purpose.

  1. Two Radware switches are there. Its active-passive configuration.

Server Configuration:

  1. O.S solaris 9/05
  2. HDD 73 x 2 SCSI
  3. Processor 2

Network:

  1. IPMP configured in bge0 & bge1
  2. Static routes have been added in /etc/init.d/inetinit.
  3. Bharat network is connected in bge2 & bge3.

RAID:

* RAID 1 (Root-mirroring have been configured)

Procedures to install the O.S:

  1. Insert the OS media in the CDROM and type boot cdrom from ok prompt.
  2. partition details should be

Slice details:

Current partition table (original):

Total disk cylinders available: 14087 + 2 (reserved cylinders)

Part Tag Flag Cylinders Size Blocks

0 root wm 0 - 2060 10.00GB (2061/0/0) 20972736

1 swap wu 2061 - 3709 8.00GB (1649/0/0) 16780224

2 backup wm 0 - 14086 68.35GB (14087/0/0) 143349312

3 var wm 3710 - 5358 8.00GB (1649/0/0) 16780224

4 unassigned wm 5359 - 14013 42.00GB (8655/0/0) 88073280

5 unassigned wu 0 0 (0/0/0) 0

6 unassigned wu 0 0 (0/0/0) 0

7 unassigned wm 14014 - 14034 104.34MB (21/0/0) 213696

partition>

(slice7 don’t create filesystem as it is used for metadb )

Bge0 ip: RADBAN2 192.168.1.2

Netmask: 255.255.255.0

Gateway: 192.168.1.254

Install The latest patch:

  1. cd /cdrom/eid-dvd
  2. cd sun
  3. cd install
  4. ./setup-standard.sh - follow the wizard
  5. cd ..
  6. cd patch
  7. cd 9
  8. /opt/sun/bin/unpack-patches /var
  9. eject the media
  10. init 1
  11. cd /var/9
  12. ./install_all_patches.

Ip configuration.

# ifconfig bge1 plumb

# ifconfig bge2 plumb

# ifconfig bge3 plumb

# vi /etc/hosts

#

# Internet host table

#

127.0.0.1 localhost

192.168.1.2 RADBAN2 loghost

192.168.1.20 RADBAN2-bge0

192.168.1.21 RADBAN2-bge1

10.89.15.44 RADBAN2-bge2

10.89.15.46 RADBAN2-bge3

IPMP Configuration:

# vi /etc/hostname.bge0

RADBAN2 netmask + broadcast + group ipmp0 up \

addif RADBAN2-bge0 deprecated -failover netmask + broadcast + up

# vi /etc/hostname.bge1

RADBAN2-bge1 deprecated -failover netmask + broadcast + group ipmp0 up

# vi /etc/hostname.bge2

RADBAN2-bge2

# vi /etc/hostname.bge3

RADBAN2-bge3

# vi /etc/defaultrouter

192.168.1.254

# vi /etc/netmasks

10.89.0.0 255.255.255.0

192.168.0.0 255.255.255.0

# vi /etc/init.d/inetinit

#Static routes

route add net 100.1.0.0 10.89.15.33

route add host 10.89.15.40 192.168.1.254

route add host 10.89.15.41 192.168.1.254

route add host 10.89.15.42 192.168.1.254

route add net 10.89.0.0 10.89.15.33

route add host 100.1.200.99 10.89.15.33

route add host 10.151.1.26 10.89.15.33

route add host 10.151.1.18 10.89.15.33

route add net 10.64.12.0 10.89.15.33

route add net 10.2.10.0/24 10.89.15.33

route add net 10.89.15.0/27 10.89.15.37

route add net 10.2.94.0/24 10.89.15.33

route add net 10.133.32.0/24 10.89.15.33

RAID CONFIGURATION:

Root mirroring:

Both the HDD should have same partition details so copy the prtvtoc from 1st HDD to 2nd HDD.

# prtvtoc /dev/rdsk/c1t0d0s2 fmthard –s - /dev/rdsk/c1t1d0s2

Create metadb and start root mirroring:

  1. # metadb -afc3 /dev/dsk/c1t0d0s7 /dev/dsk/c1t1d0s7
  2. # metadb

flags first blk block count

a m p luo 16 8192 /dev/dsk/c1t0d0s7

a p luo 8208 8192 /dev/dsk/c1t0d0s7

a p luo 16400 8192 /dev/dsk/c1t0d0s7

a p luo 16 8192 /dev/dsk/c1t1d0s7

a p luo 8208 8192 /dev/dsk/c1t1d0s7

a p luo 16400 8192 /dev/dsk/c1t1d0s7

Defining meta devices

  1. Root slice

# metainit –f d10 1 1 c1t0d0s0

# metainit –f d20 1 1 c1t1d0s0

# metainit d30 –m d10

Swap

# metainit –f d11 1 1 c1t0d0s1

# metainit –f d21 1 1 c1t1d0s1

# metainit d31 –m d11

/var

# metainit –f d13 1 1 c1t0d0s3

# metainit –f d23 1 1 c1t1d0s3

# metainit d33 –m d13

/opt

# metainit –f d14 1 1 c1t0d0s4

# metainit –f d24 1 1 c1t1d0s4

# metainit d34 –m d14

# metaroot d30 (edits vfstab & system files automatically)

Before rebooting edit vfstab as:

#device device mount FS fsck mount mount

#to mount to fsck point type pass at boot options

#

fd - /dev/fd fd - no -

/proc - /proc proc - no -

/dev/md/dsk/d31 - - swap - no -

/dev/md/dsk/d30 /dev/md/rdsk/d30 / ufs 1 no -

/dev/md/dsk/d33 /dev/md/rdsk/d33 /var ufs 1 no -

/dev/md/dsk/d34 /dev/md/rdsk/d34 /opt ufs 2 yes -

swap - /tmp tmpfs - yes

One way mirroring is over now so we have to reboot now.

# lockfs -fa

# sync;sync;sync;

# init 6

Now the system should come up with metadevices (/dev/md/d30 / )

Then attach the sub-mirrors to the respective main mirror.

# metattach d30 d20

# metattach d31 d21

# metattach d33 d23

# metattach d34 d24

Install the boot block in 2nd HDD too

# installboot /usr/platform/sun4u/lib/fs/ufs/bootblk /dev/rdsk/c1t1d0s0

· Change the boot-device as disk, disk1 in ok prompt .

· Change use-nvramrc? True

· Boot the server normally



Monday, August 10, 2009

SUN OBP Commands


Sun SPARC (Scalable Processor Architecture) Open Boot Prompt Commands

  1. boot boot the OS into runlevel.
  2. boot cdrom booting from cdrom/dvd.
  3. boot -r boot in reconfiguration mode.
  4. boot -s boot in single user mode.
  5. printenv Display all configuration variables.
  6. setenv Set variable to value.
  7. devalias Display all defined aliases.
Some common configuration variables.
  1. auto-boot? Determine if solaris boots on power-on
  2. boot-device value disk or disk:a etc
  3. diag-level Determine the diagnostic level min,max etc.
Open Boot Commands.
  1. probe-scsi provide details of scsi devices.
  2. test-device test all devices self test method.
  3. watch-net test net devices and monitors for bad blocks.
  4. reset-all reset entire system.
  5. .speed show cpu speed and PCI bus speed.
  6. .version show OBP version.

Wednesday, July 8, 2009

Solaris patch installation

Solaris patch installation

patchadd’ is the command to install patches in solaris

eg. $ patchadd 99-118025

For removing installed patch from OS

$ patchrm 99-118025

Redhat package installation (rpm)

For installing an rpm

rpm –ivh package name

$ rpm –ivh squid-2.6.STABLE6-3.el5.i386.rpm

For removing a package

rpm –e package name

eg. $ rpm –e squid-2.6.STABLE6-3.el5.i386

For installing an rpm with dependencies

rpm –ivh package name --deps

Linux backup with dump command

Document in progress......

Solaris backup with ufsdump

Document in progress......

Unix File permissions

0 --- no permission
1 --x execute
2 -w- write
3 -wx write and execute
4 -- r-- read
5 --r-x read and execute
6 --rw- read and write
7 --rwx read, write and execute

Run levels in Solaris

Document in progress....

Run Levels in Linux



Runlevel 1: Single user mode

Runlevel 2: Basic multi user mode without NFS

Runlevel 3: Full multi user mode (text based)

Runlevel 4: unused

Runlevel 5: Multi user mode with Graphical User Interface

Runlevel 6: Reboot System

Solaris-SPARC The Boot Process

SPARC: The Boot Process

The following table describes the boot process on SPARC based systems.

Table 15–1 SPARC: Description of the Boot Process

Boot Phase

Description

Boot PROM

1. The PROM displays system identification information and then runs self-test diagnostics to verify the system's hardware and memory.

2. Then, the PROM loads the primary boot program, bootblk, whose purpose is to load the secondary boot program (that is located in the ufs file system) from the default boot device.

Boot Programs

3. The bootblk program finds and executes the secondary boot program, ufsboot, and loads it into memory.

4. After the ufsboot program is loaded, the ufsboot program loads the kernel.

Kernel Initialization

5. The kernel initializes itself and begins loading modules by using ufsboot to read the files. When the kernel has loaded enough modules to mount the root (/) file system, the kernel unmaps the ufsboot program and continues, using its own resources.

6. The kernel creates a user process and starts the /sbin/init process, which starts other processes by reading the /etc/inittab file.

init

7. The /sbin/init process starts the run control (rc) scripts, which execute a series of other scripts. These scripts (/sbin/rc*) check and mount file systems, start various processes, and perform system maintenance tasks.

Friday, June 12, 2009

RHEL Linux Booting Procedure

RHEL 5 Boot Sequence and GRUB......

Lets have a very quick review of how the Linux boots. Here are the very brief steps.

1) When a PC is booted it starts running a BIOS program which is a memory resident program on an EEPROM integrated circuit. The BIOS program will eventually try to read the first sector on a booting media such as a hard disk or floppy drive. The boot sector contains a small program that the BIOS will load and attempt to pass run control to. This program will attempt to read the operating system from the disk and run it.

2) The small program containing in the boot sector that BIOS will load and attempt to pass control to is called bootloader. This is a small program residing in the 1st sector of primary partition. Primary partition by default is always /boot. This directory will have all files required for bootup.

The boot loader program is present in 2 stages in Linux.

Stage 1: Small stage and resides in MBR (Master boot record) or boot sector. This is the once we were taking above – A small program residing in the 1st sector of primary partition /boot.
Stage 2: This is the complete bootup program present in /boot partiton and is called from first stage.
So 1st stage is present in MBR and just called for stage 2.
This MBR sector is 512 bytes size. The first 446 bytes contains the GRUB program (1st stage).

3) GRUB program reads the configuration file /boot/grub/grub.conf during boot time. Since this file is present in /boot partition, this partition should be present in file system that GRUB will understand, because it has to read the file before OS starts. So /boot mount point should be formated with either ext2 or ext3.

We will discuss about GRUB file shortly after finishing this brief booting sequence steps.
So once control comes to GRUB program it executes and you will see a red spashing windown comes up which gives the countdown in seconds like

Booting up Redhat Enterprise Linux in 5..4..3.. Secs

Now before the conuntdown ends, you can press either space or enter. Once you press that, you will see a table on a screen with list of operating systems present in that server. Example if you have installed Windows initially and then you installed Linux this table will show both OS in the option.

But to get this list of OS you need to enter space or enter, else it will bootup the default operating system which will be Linux.

This showing up of operating system list can be controlled by parameter hiddenmenu present in GRUB config file. We will see this in a short while. Also you can control the time for which it should countdown (timeout parameter in GRUB file).
GRUB will load the specific kernel into the RAM (which kernel to load is passed to GRUB in its script) and uncompress the kernel program in RAM. Once it uncompresses, the control is taken over by kernel and job of GRUB script ends here.

4) The kernel initialization files generates output which may not be possible to see on screen as it scrolls quickly but can be seen in log message file /var/log/dmesg which contains the snapsot of these kernel messages taken just after control is passed to init.

Many packages and device drivers present in kernel program are called. Device drivers will check all there respective hardware devices if they are available. If successful in locating devices, the driver will initialize and usually log output to kernel message buffer.

kernel of Linux is made light weight and hence will load only the required module and packages. But if some of the modules also needs to be loaded along with the kernel, its not a good idea to make it a part of kernel. Instead in redhat those additional modules are included in initrd file, which is then temporarily mounted by kernel on a RAM disk to make modules available for initialization process. This file initrd is password as one of the arguement in GRUB file for loading the kernel. We will see this arguement when we see GRUB file.

After all essential drivers are loaded, kernel will mount the root filesystem in read-only mode so that no process while booting should make any changes to any file on disk.
The first process is then created and loaded and control is passed from kernel to that process. This first process that gets created is called “init”. This process is having PID=1 and its the initialization process. This will intialize the system.

5) Init process created above will read its configuration file /etc/inittab. This file stores the information like initial run level, system initialization script, run level specific scripts, trap certain key sequences etc.We will discuss about this file in my next post when I will explain run levels.
The final file that is run in boot sequence is /etc/rc.d/rc.local
So if we have to make any customization or call a custom script, we can call from this file.

Example if we want to start a database when our server boots up we can add a script in /etc/rc.d/rc.local to start a database.
Having a brief idea about boot sequence for Linux, lets see the content of GRUB config file
/boot/grub/grub.conf
The GRUB file in RHEL is present in /boot/grub/grub.conf
Following is the content of this file
# cat /boot/grub/grub.conf# grub.conf generated by anaconda## Note that you do not have to rerun grub after making changes to this file# NOTICE: You have a /boot partition. This means that# all kernel and initrd paths are relative to /boot/, eg.# root (hd0,0)# kernel /vmlinuz-version ro root=/dev/sda2# initrd /initrd-version.img#boot=/dev/sdadefault=0timeout=5splashimage=(sd0,0)/grub/splash.xpm.gzhiddenmenutitle Enterprise (2.6.9-55.0.0.0.2.ELhugemem)root (sd0,0)kernel /vmlinuz-2.6.9-55.0.0.0.2.ELhugemem ro root=LABEL=/ rhgb quietinitrd /initrd-2.6.9-55.0.0.0.2.ELhugemem.imgtitle Enterprise-smp (2.6.9-55.0.0.0.2.ELsmp)root (sd0,0)kernel /vmlinuz-2.6.9-55.0.0.0.2.ELsmp ro root=LABEL=/ rhgb quietinitrd /initrd-2.6.9-55.0.0.0.2.ELsmp.imgtitle Enterprise-up (2.6.9-55.0.0.0.2.EL)root (sd0,0)kernel /vmlinuz-2.6.9-55.0.0.0.2.EL ro root=LABEL=/ rhgb quietinitrd /initrd-2.6.9-55.0.0.0.2.EL.img
lets understand meaning of each parameter here.

default -> This gives the default operating system to be booted in case the user is not giving any choice. Example if there are 2 OS installed on a server (lets say Linux and Windows, linux with number 0 and windows with number 1) then default=0 will boot Linux by default. The number is decided by the sequence in which these OS are listed in grub.conf above.
If we see the lines starting with “title”, these are the list of OS installed on server and this list (only the title) will be displayed at the time of booting when control goes from BIOS to GRUB. Since its present in grub.conf 1st stage of bootloader program will display this OS list.
In above file default=0 will pick “Enterprise (2.6.9-55.0.0.0.2.ELhugemem)” OS by default.

timeout -> This gives the time for which countdown will continue or time for which the list of OS should be displayed before taking default option. Example in out case timeout=5 means it will show the option for 5 seconds.

splashimage -> This option gives a red spashing window of redhat linux while showing the list of OS or while booting. If you remove this file it will show a black window.
hiddenmenu -> This options will hide the list of OS installed on server. It will only show the countdown. If you press enter or space (as explained previously in point 3 of boot sequence) then it will show the list of OS. If you remove this option by default while booting it will show the list of OS installed.

title -> As explained just now these are the title to be shown during booting from where you can select. You can change title to anything that you want. Example “My OS”. This will show “My OS” as one of the option during booting.
root (sd0,0) -> This tells us that the boot loader program is present in 1st disk (sd0 indicate 1st hard disk) and 1st partition (,0 indicates 1st partition). So here we are telling where exactly is the bootloader program.
kernel /vmlinuz-2.6.9-55.0.0.0.2.ELhugemem ro root=LABEL=/ rhgb quiet
kernel is a parameter, /vmlinuz-2.6.9-55.0.0.0.2.ELhugemem is a value -> This is the name of kernel file to be used.
ro -> opens the filesystem in readonly mode during booting. If we remove this arguement it will open the filesystem in read write mode.

rhgb -> This is redhar graphical boot. This parameters gives a graphical progress bar while booting. If we remove this then it will give a traditional black window with many [ OK ] messages.

root=LABEL=/ -> This gives the location of root directory where all the installation has happened. this is usaully /. We can also give device name directly example in my case the device name is /dev/sda2. So we can give root=/dev/sda2This will also work.
quiet -> This will hide details while booting up and will show only few message ehgb mode or in traditional mode. Only few [ OK ] messages will be displayed corresponding to services that are getting started. Else if we remove this parameter many more detailed messages will be displayed.

initrd /initrd-2.6.9-55.0.0.0.2.ELsmp.img -> This gives the extended modules which we want to load while booting. As I explained that not all modules are part of kernel, in order to keep it light. So if additional extended modules needs to be intalled then we need to give this file as input.

NFS Server Configuration- Linux

Setting up NFS Server in linux servers.

$ vi /etc/exports ---file need to add the share directory in NFS server.

eg. /usr/share/man 192.168.1.10 (ro)
/home *.* (ro)

$exportfs -a (This command will export the file systems which is configured in /etc/exports)

For checking the exported file system.

$ showmount -e

Daemons running in NFS Server.

$ rpcinfo -p

Importent deamons are...

1. portmapper
2. rpc
3. mountd
4. nfsd
5. lockd

LDAP Admin Tool

LDAP Admin Tool connection properties.


LDAP Admin Tool object administration view



Squid-LDAP Authentication

OS: - RHEL 2.6.18-8.el5
Squid version : - squid-2.6.STABLE6-3.el5
##################################################################
$ vi /etc/squid/squid.conf
auth_param basic program /usr/lib/squid/squid_ldap_auth -b "dc=adminmart,dc=com" -D "cn=Manager,dc=adminmart,dc=com" -w secret -H ldap://10.248.1.15 -v 3 -f "uid=%s"

#auth_param basic program /usr/lib/squid/squid_ldap_auth -b "dc=adminmart,dc=com" -f "uid=%s" -h 10.248.1.15

acl ldap-auth proxy_auth REQUIRED
http_access allow ldap-auth
#################################################################
Note : - This doc only tells about LDAP integration, not squid configuration or acl settings.

OpenLDAP Installation

LDAP Installation

Download OpenLDAP 2.4.16 from http://www.openldap.org/


Before check the pre-requisities like Berkeley DB 4.5, openssl etc…

For installing Berkeley DB see the docs directory index.html

(cd build_unix; ../dist/configure; make ; make install)

Set environment variables: -

export CPPFLAGS="-I/usr/local/BerkeleyDB.4.5/include"
export LDFLAGS="-L/usr/local/BerkeleyDB.4.5/lib"
export LD_LIBRARY_PATH=/usr/local/BerkeleyDB.4.5/lib

(if you are not setting the enviornment variables you may get an error "Berkeley DB version mismatch".. see the FAQ link)


OpenLDAP Installation

untar the package

% tar –xvf openldap-2.4.16.tar.gz
% cd openldap-2.4.16
% ./configure
% make depend
% make
% make test
% su root –c ‘make install’

That’s it.. if there is no error Enjoy!

Copy libdb to /usr/lib/.
# cp /usr/local/BerkeleyDB.4.5/lib/libdb-4.5.so /usr/lib/
reset rootpw.
#/usr/local/sbin/slappasswd (reset password)

The configuration files are located in /usr/local/etc/openldap

/usr/local/etc/openldap/slapd.conf ---- main configuration file for schema and all.
/usr/local/etc/openldap/schema/ ------ all schema files are located in this directory.
/usr/local/BerkeleyDB.4.5 –Berkeley Installation files located ….

slapd.conf file will look like this.....

% vi /usr/local/etc/openldap/slapd.conf

# See slapd.conf(5) for details on configuration options.
# This file should NOT be world readable.

include /usr/local/etc/openldap/schema/core.schema
include /usr/local/etc/openldap/schema/cosine.schema
include /usr/local/etc/openldap/schema/nis.schema
include /usr/local/etc/openldap/schema/inetorgperson.schema
include /usr/local/etc/openldap/schema/java.schema

# BDB database definitions
database bdb
suffix "dc=adminmart,dc=com"
rootdn "cn=Manager,dc=adminmart,dc=com"
rootpw {SSHA}5xkIfOGiLNYkh4PbwTp1XFigY/pRjxwy
directory /usr/local/var/openldap-data


Starting and Stopping LDAP Server

% /usr/local/libexec/slapd –d 256 –f /usr/local/etc/openldap/slapd.conf --(will start with console)
Or
% /usr/local/libexec/slapd

Stopping slapd

To kill off slapd(8) safely, you should give a command like this
% Kill –INT `cat /usr/local/var/run/slapd.pid`



CREATING A DATABASE (Getting Start to add users, group, etc)


Creating LDIF file for importing objects like users and groups.

Sample LDIF

# root
dn: dc=example,dc=com
objectClass: organization
objectClass: dcObject
o: Example, Inc.
dc: example
# people
dn: ou=People,dc=example,dc=com
objectClass: organizationalUnit
ou: People
# company-wide address book
dn: ou=Address Book,dc=example,dc=com
objectClass: organizationalUnit
ou: Address Book
http://www.sys-net.it/~ando/Download/abook.ldif


LDAP Add a user.

$ldapadd -x -D "cn=Manager,dc=adminmart,dc=com" -W -f rttest.ldif

where rttest.ldif
dn: uid=charihar,ou=users,dc=adminmart,dc=com
objectclass: top
objectclass: person
objectclass: uidObject
uid: charihar
cn: Full Name
sn: Name
userPassword: your passwordhere.


LDAP Search quires.

$ ldapsearch -x -b "dc=adminmart,dc=com" '(objectclass=*)'
$ ldapsearch -x -b "dc=adminmart,dc=com" '(uid=sajan)'
$ldapsearch -LLL -H ldap:/// -xWD 'cn=Manager,dc=adminmart,dc=com' -b "ou=users,dc=adminmart,dc=com" "(uid=charihar)"

LDAP delete a user

ldapdelete -xWD "cn=Manager,dc=adminmart,dc=com" "uid=charihar,ou=users,dc=adminmart,dc=com"
Note : - Document not completed.