Showing posts with label Solaris. Show all posts
Showing posts with label Solaris. Show all posts

Friday, March 22, 2013

What is the difference between Solaris and Linux?

tux-resized-600What is the difference between Solaris and Linux?

Question


What is the difference between Solaris and Linux?

Answer



  • The first Solaris OS was released in 1983 while Linux was first released in 1991. Solaris OS started as proprietary software and recently moved to freeware while Linux started as open source freeware.



  • Linux boasts a smaller kernel and its code was rewritten from the ground up while Solaris was originally based on Berkeley UNIX or BSD. With the release of SunOS 5 (see version changes) Sun switched from a BSD based OS to a SRV4 based OS. For a chronological relational list showing 100's of the major names in UNIX see Unix History



  • In 1991 with the release of SunOS 5, Sun renamed their product Solaris 2 and later releases were versioned 2.6, 2.7, 2.8, etc. Sun again changed the way they versioned their product after 2.6 by dropping the 2 and simply using Solaris 6, Solaris 7, until the current release of Solaris 10.



  • Solaris was originally a proprietary product and operated strictly on SPARC platforms while Linux operates on x86 platforms. Solaris now supports x86 platforms in addition to SPARC. Solaris also boasts full Linux compatibility Sun.com.



  • Solaris UNIX is trademarked by The Open Group and Linux is not. Acquiring a trademark is challenging and costly. For more on this see The Open Group.



  • There is an ongoing debate about what is a "true" UNIX OS and what is a UNIX-like or UNIX-flavor OS. However, there is no official definition that distinguishes between the thousands of products that use UNIX commands and UNIX shells. The only official way to differentiate is by the trademark controlled by The Open Group (see above). For more on the debate see Linux and UNIX Flavor.



  • POSIX (Portable Operating System Interface) is a family of standards to define the API primarily for the various UNIX OS's. However, Windows does provide some POSIX compatibility. For more on this topic see POSIX and IEEE POSIX Certificaton Authority.

What is the difference between Solaris and Linux?

tux-resized-600What is the difference between Solaris and Linux?

Question


What is the difference between Solaris and Linux?

Answer



  • The first Solaris OS was released in 1983 while Linux was first released in 1991. Solaris OS started as proprietary software and recently moved to freeware while Linux started as open source freeware.



  • Linux boasts a smaller kernel and its code was rewritten from the ground up while Solaris was originally based on Berkeley UNIX or BSD. With the release of SunOS 5 (see version changes) Sun switched from a BSD based OS to a SRV4 based OS. For a chronological relational list showing 100's of the major names in UNIX see Unix History



  • In 1991 with the release of SunOS 5, Sun renamed their product Solaris 2 and later releases were versioned 2.6, 2.7, 2.8, etc. Sun again changed the way they versioned their product after 2.6 by dropping the 2 and simply using Solaris 6, Solaris 7, until the current release of Solaris 10.



  • Solaris was originally a proprietary product and operated strictly on SPARC platforms while Linux operates on x86 platforms. Solaris now supports x86 platforms in addition to SPARC. Solaris also boasts full Linux compatibility Sun.com.



  • Solaris UNIX is trademarked by The Open Group and Linux is not. Acquiring a trademark is challenging and costly. For more on this see The Open Group.



  • There is an ongoing debate about what is a "true" UNIX OS and what is a UNIX-like or UNIX-flavor OS. However, there is no official definition that distinguishes between the thousands of products that use UNIX commands and UNIX shells. The only official way to differentiate is by the trademark controlled by The Open Group (see above). For more on the debate see Linux and UNIX Flavor.



  • POSIX (Portable Operating System Interface) is a family of standards to define the API primarily for the various UNIX OS's. However, Windows does provide some POSIX compatibility. For more on this topic see POSIX and IEEE POSIX Certificaton Authority.

Useful Files in Solaris

logo-solarisUseful Files in Solaris


Message log /var/adm/messages
Tape driver configuration file /kernel/drv/st.conf
Disk driver configuration file /kernel/drv/sd.conf
File defining filesystems to mount /etc/vfstab
Kernel configuration parameters /etc/system
Names and IP addr of machines /etc/hosts
Default Port Numbers /etc/services

Useful Files in Solaris

logo-solarisUseful Files in Solaris


Message log /var/adm/messages
Tape driver configuration file /kernel/drv/st.conf
Disk driver configuration file /kernel/drv/sd.conf
File defining filesystems to mount /etc/vfstab
Kernel configuration parameters /etc/system
Names and IP addr of machines /etc/hosts
Default Port Numbers /etc/services

Solaris vfstab file explained

logo-solarisSolaris vfstab file explained


To manually add a drive to a Solaris system, the vfstab file must be edited. The columns are tab delimited so if you manually edit this file, make sure to use tab and spaces to separate the columns. The file is located in /etc/ and contains the following header.
#device device mount FS fsck mount mount #to mount to fsck point type pass at boot options # #/dev/dsk/c1d0s2 /dev/rdsk/c1d0s2 /usr ufs 1 yes -

Notice the 'mount at boot' column? To automount a drive that option must exist and be entered as yes. If the option is entered as no, the drive will NOT automount, but you can use the command mount or mountall to mount the drive at a later time.

The first two device columns will exist in /dev/ only if a drive has been formatted, installed correctly and a reconfigure boot (boot -r) has been completed.

The device path comes in two types; the dsk or character device and the rdsk or raw device. Each identifies the hard drive using what is sometimes called the ctd number or ctd path. The c# is the controller id, the t# (not shown in the example) is the target id, the d# is the device id, and s# is the specific slice (partition) to be mounted.

You will never use slice 2 to mount a drive as that is the backup slice which represents the entire drive and is not a true slice. You can view the slices of a drive using the format command. First select the drive number, then p for partition, then p for print. This will not make any changes to the drive and will display the current partition as in this example;
Part Tag Flag Cylinders Size Blocks 0 root wm 0 - 1451 2.00GB (1452/0/0) 4194828 1 swap wu 1452 - 7259 8.00GB (5808/0/0) 16779312 2 backup wm 0 - 24619 33.92GB (24620/0/0) 71127180 3 var wm 7260 - 10163 4.00GB (2904/0/0) 8389656 4 usr wm 10164 - 23230 18.00GB (13067/0/0) 37750563 5 unassigned wm 0 0 (0/0/0) 0 6 - wu 0 - 24619 33.92GB (24620/0/0) 71127180 7 - wu 24619 - 24619 1.41MB (1/0/0) 2889

In the example above, note the Cylinders column. Partition 2, the backup partition, contains cylinders 0 - 24619, all the available cylinders on the drive. This drive has been partitioned into smaller slices, typical of a root drive and each slice shows the cylinders being used. These cylinders must not overlap. Partition 0 uses cylinders 0 - 1451 and partition 2 uses 1452 - 7259.

A drive can be created with overlapping cylinders, mounted and used. However, when files are written in the area of the overlapping cylinders severe problems and data loss will occur.

To mount all the available slices on this drive, a vfstab entry must be included for each slice. To mount all the slices on this drive, there must be a vfstab entry for slices 0,1,3, and 4. Slice 7 represents unused cylinders. Sometimes, cylinders are reserved to grow partitions later, in this case the extra cylinders have been wasted.
NOTES:

  1. Additional drives can be added with all the cylinders combined on one slice, usually slice 6, then only one vfstab entry is needed to mount the entire drive.

  2. CAUTION: Make sure to read the man pages on both vfstab and mount before using them. Also, make sure to keep a backup copy of your working vfstab, both in the /etc/ directory and on another system, before making any changes. You should also have a boot cd handy just in case there are problems. A bad vfstab can cause severe problems. I don't think you can lose any data unless you mess with the FS type column, but it is always good to have a backup of your data.

  3. All the options in the vfstab are required except the mount options column and that the # sign causes the lines to be ignored just as in a shell script.

  4. Using a file system manager like Veritas, will automatically edit the vfstab file and leave entries such as: #NOTE: volume rootvol (/) encapsulated partition c0t0d0s0

  5. The tag entries are mostly irrelevant. They do not effect how the slice operates.

Solaris vfstab file explained

logo-solarisSolaris vfstab file explained


To manually add a drive to a Solaris system, the vfstab file must be edited. The columns are tab delimited so if you manually edit this file, make sure to use tab and spaces to separate the columns. The file is located in /etc/ and contains the following header.
#device device mount FS fsck mount mount #to mount to fsck point type pass at boot options # #/dev/dsk/c1d0s2 /dev/rdsk/c1d0s2 /usr ufs 1 yes -

Notice the 'mount at boot' column? To automount a drive that option must exist and be entered as yes. If the option is entered as no, the drive will NOT automount, but you can use the command mount or mountall to mount the drive at a later time.

The first two device columns will exist in /dev/ only if a drive has been formatted, installed correctly and a reconfigure boot (boot -r) has been completed.

The device path comes in two types; the dsk or character device and the rdsk or raw device. Each identifies the hard drive using what is sometimes called the ctd number or ctd path. The c# is the controller id, the t# (not shown in the example) is the target id, the d# is the device id, and s# is the specific slice (partition) to be mounted.

You will never use slice 2 to mount a drive as that is the backup slice which represents the entire drive and is not a true slice. You can view the slices of a drive using the format command. First select the drive number, then p for partition, then p for print. This will not make any changes to the drive and will display the current partition as in this example;
Part Tag Flag Cylinders Size Blocks 0 root wm 0 - 1451 2.00GB (1452/0/0) 4194828 1 swap wu 1452 - 7259 8.00GB (5808/0/0) 16779312 2 backup wm 0 - 24619 33.92GB (24620/0/0) 71127180 3 var wm 7260 - 10163 4.00GB (2904/0/0) 8389656 4 usr wm 10164 - 23230 18.00GB (13067/0/0) 37750563 5 unassigned wm 0 0 (0/0/0) 0 6 - wu 0 - 24619 33.92GB (24620/0/0) 71127180 7 - wu 24619 - 24619 1.41MB (1/0/0) 2889

In the example above, note the Cylinders column. Partition 2, the backup partition, contains cylinders 0 - 24619, all the available cylinders on the drive. This drive has been partitioned into smaller slices, typical of a root drive and each slice shows the cylinders being used. These cylinders must not overlap. Partition 0 uses cylinders 0 - 1451 and partition 2 uses 1452 - 7259.

A drive can be created with overlapping cylinders, mounted and used. However, when files are written in the area of the overlapping cylinders severe problems and data loss will occur.

To mount all the available slices on this drive, a vfstab entry must be included for each slice. To mount all the slices on this drive, there must be a vfstab entry for slices 0,1,3, and 4. Slice 7 represents unused cylinders. Sometimes, cylinders are reserved to grow partitions later, in this case the extra cylinders have been wasted.
NOTES:

  1. Additional drives can be added with all the cylinders combined on one slice, usually slice 6, then only one vfstab entry is needed to mount the entire drive.

  2. CAUTION: Make sure to read the man pages on both vfstab and mount before using them. Also, make sure to keep a backup copy of your working vfstab, both in the /etc/ directory and on another system, before making any changes. You should also have a boot cd handy just in case there are problems. A bad vfstab can cause severe problems. I don't think you can lose any data unless you mess with the FS type column, but it is always good to have a backup of your data.

  3. All the options in the vfstab are required except the mount options column and that the # sign causes the lines to be ignored just as in a shell script.

  4. Using a file system manager like Veritas, will automatically edit the vfstab file and leave entries such as: #NOTE: volume rootvol (/) encapsulated partition c0t0d0s0

  5. The tag entries are mostly irrelevant. They do not effect how the slice operates.

Solaris x86 root filesystem mirroring

logo-solarisSolaris x86 root filesystem mirroring






Contents


  • 1 Preamble

  • 2 Prerequisites

  • 3 LVM

  • 4 Boot

  • 5 Conclusion





Preamble


This document is directed to give idea how to create mirroring of root filesystem in Solaris x86 with the help of Solaris Volume Manager. Here will be used already installed OS and all the work will be done without need of reinstall

Prerequisites


1. First we should be sure have two identical harddisks in the server
# format Searching for disks...done AVAILABLE DISK SELECTIONS: 0. c0d0 <DEFAULT cyl 1563 alt 2 hd 255 sec 63> /pci@0,0/pci-ide@7,1/ide@0/cmdk@0,0 1. c0d1 <DEFAULT cyl 1563 alt 2 hd 255 sec 63> /pci@0,0/pci-ide@7,1/ide@0/cmdk@1,0 Specify disk (enter its number): ^C

2. Its need to create small slice for metadb information (usually slice 7) like:
partition> p Current partition table (unnamed): Total disk cylinders available: 1563 + 2 (reserved cylinders) Part Tag Flag Cylinders Size Blocks 0 root wm 518 - 1562 8.01GB (1045/0/0) 16787925 1 swap wu 3 - 133 1.00GB (131/0/0) 2104515 2 backup wm 0 - 1562 11.97GB (1563/0/0) 25109595 3 unassigned wm 0 0 (0/0/0) 0 4 unassigned wm 0 0 (0/0/0) 0 5 unassigned wm 0 0 (0/0/0) 0 6 unassigned wm 0 0 (0/0/0) 0 7 unassigned wm 134 - 135 15.69MB (2/0/0) 32130 8 boot wu 0 - 0 7.84MB (1/0/0) 16065 9 alternates wu 1 - 2 15.69MB (2/0/0) 32130

3. Next step is to create the same partitions on the second disk. To avoid human error it is much better to use some kind of automations:
prtvtoc /dev/rdsk/c0d0s2 > /tmp/c0d0s2.toc fmthard -s /tmp/c0d0s2.toc /dev/rdsk/c0d1s2

4. Then we should identify the partitions need to be mirrored:
# egrep "ufs|swap" /etc/vfstab|grep "/dev/dsk" /dev/dsk/c0d0s1 - - swap - no - /dev/dsk/c0d0s0 /dev/rdsk/c0d0s0 / ufs 1 no -

LVM


1. Let’s create few copies of metadb on the partitions we create for this puspose:
# metadb -a -f -c 2 c0d0s7 c0d1s7

2. It’s time to put our disks where OS reside under management of SVM
# metainit -f d10 1 1 c0d0s0 d10: Concat/Stripe is setup # metainit -f d11 1 1 c0d0s1 d11: Concat/Stripe is setup # metainit d0 -m d10 d0: Mirror is setup # metainit d1 -m d11 d1: Mirror is setup # metaroot d0

3. Check newly created devices:
# ls -l /dev/md/rdsk total 8 lrwxrwxrwx 1 root root 36 Aug 30 18:29 d0 -> ../../../devices/pseudo/md@0:0,0,raw lrwxrwxrwx 1 root root 36 Aug 30 18:29 d1 -> ../../../devices/pseudo/md@0:0,1,raw lrwxrwxrwx 1 root root 37 Aug 30 18:28 d10 -> ../../../devices/pseudo/md@0:0,10,raw lrwxrwxrwx 1 root root 37 Aug 30 18:28 d11 -> ../../../devices/pseudo/md@0:0,11,raw # ls -l /dev/md/dsk total 8 lrwxrwxrwx 1 root root 36 Aug 30 18:29 d0 -> ../../../devices/pseudo/md@0:0,0,blk lrwxrwxrwx 1 root root 36 Aug 30 18:29 d1 -> ../../../devices/pseudo/md@0:0,1,blk lrwxrwxrwx 1 root root 37 Aug 30 18:28 d10 -> ../../../devices/pseudo/md@0:0,10,blk lrwxrwxrwx 1 root root 37 Aug 30 18:28 d11 -> ../../../devices/pseudo/md@0:0,11,blk

4. Make appropriate changes in /etc/vfstab to get boot from mirror, not standard disks
# egrep "ufs|swap" /etc/vfstab|grep "/dev/md/dsk" /dev/md/dsk/d1 - - swap - no - /dev/md/dsk/d0 /dev/md/rdsk/d0 / ufs 1 no -

5. The next step is to flush cache buffers and reboot
# sync;sync;sync # reboot

6. It is time to put second disk under management of SVN
# metainit -f d20 1 1 c0d1s0 d20: Concat/Stripe is setup # metainit -f d21 1 1 c0d1s1 d21: Concat/Stripe is setup

7. And to add them to created previously mirrors. Be aware process of synchronisation will continue in background and you can check the process
# metattach d0 d20 d0: submirror d20 is attached # metattach d1 d21 d1: submirror d21 is attached

8. Check the process of building mirrors and wait till they finnish
# metastat d1: Mirror Submirror 0: d11 State: Okay Submirror 1: d21 State: Resyncing Resync in progress: 96 % done Pass: 1 Read option: roundrobin (default) Write option: parallel (default) Size: 2104515 blocks (1.0 GB) d11: Submirror of d1 State: Okay Size: 2104515 blocks (1.0 GB) Stripe 0: Device Start Block Dbase State Reloc Hot Spare c0d0s1 0 No Okay Yes d21: Submirror of d1 State: Resyncing Size: 2104515 blocks (1.0 GB) Stripe 0: Device Start Block Dbase State Reloc Hot Spare c0d1s1 0 No Okay Yes d0: Mirror Submirror 0: d10 State: Okay Submirror 1: d20 State: Resyncing Resync in progress: 13 % done Pass: 1 Read option: roundrobin (default) Write option: parallel (default) Size: 16787925 blocks (8.0 GB) d10: Submirror of d0 State: Okay Size: 16787925 blocks (8.0 GB) Stripe 0: Device Start Block Dbase State Reloc Hot Spare c0d0s0 0 No Okay Yes d20: Submirror of d0 State: Resyncing Size: 16787925 blocks (8.0 GB) Stripe 0: Device Start Block Dbase State Reloc Hot Spare c0d1s0 0 No Okay Yes Device Relocation Information: Device Reloc Device ID c0d1 Yes id1,cmdk@AVMware_Virtual_IDE_Hard_Drive=01000000000000000001 c0d0 Yes id1,cmdk@AVMware_Virtual_IDE_Hard_Drive=00000000000000000001

Boot


1. Next step is to check if partition on second disk is active
# fdisk /dev/rdsk/c0d1p0 Total disk size is 1566 cylinders Cylinder size is 16065 (512 byte) blocks Cylinders Partition Status Type Start End Length % ========= ====== ============ ===== === ====== === 1 Active Solaris2 1 1565 1565 100 SELECT ONE OF THE FOLLOWING: 1. Create a partition 2. Specify the active partition 3. Delete a partition 4. Change between Solaris and Solaris2 Partition IDs 5. Exit (update disk configuration and exit) 6. Cancel (exit without updating disk configuration) Enter Selection: 5

2. And to add boot record to the second disk to make it bootable
# /sbin/installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c0d1s0 stage1 written to partition 0 sector 0 (abs 16065) stage2 written to partition 0, 233 sectors starting at 50 (abs 16115)

3. Add new item in the boot menu (/boot/grub/menu.lst) to have alternative way to boot
title Alternate boot root (hd1,0,a) kernel /platform/i86pc/multiboot module /platform/i86pc/boot_archive

4. Check if the new item is added to the boot menu
# bootadm list-menu The location for the active GRUB menu is: /boot/grub/menu.lst default 0 timeout 10 0 Solaris 10 5/08 s10x_u5wos_10 X86 1 Solaris failsafe 2 Alternate boot

5. That’s all, you have already mirrored root partition (plus swap)

Solaris x86 root filesystem mirroring

logo-solarisSolaris x86 root filesystem mirroring






Contents


  • 1 Preamble

  • 2 Prerequisites

  • 3 LVM

  • 4 Boot

  • 5 Conclusion





Preamble


This document is directed to give idea how to create mirroring of root filesystem in Solaris x86 with the help of Solaris Volume Manager. Here will be used already installed OS and all the work will be done without need of reinstall

Prerequisites


1. First we should be sure have two identical harddisks in the server
# format Searching for disks...done AVAILABLE DISK SELECTIONS: 0. c0d0 <DEFAULT cyl 1563 alt 2 hd 255 sec 63> /pci@0,0/pci-ide@7,1/ide@0/cmdk@0,0 1. c0d1 <DEFAULT cyl 1563 alt 2 hd 255 sec 63> /pci@0,0/pci-ide@7,1/ide@0/cmdk@1,0 Specify disk (enter its number): ^C

2. Its need to create small slice for metadb information (usually slice 7) like:
partition> p Current partition table (unnamed): Total disk cylinders available: 1563 + 2 (reserved cylinders) Part Tag Flag Cylinders Size Blocks 0 root wm 518 - 1562 8.01GB (1045/0/0) 16787925 1 swap wu 3 - 133 1.00GB (131/0/0) 2104515 2 backup wm 0 - 1562 11.97GB (1563/0/0) 25109595 3 unassigned wm 0 0 (0/0/0) 0 4 unassigned wm 0 0 (0/0/0) 0 5 unassigned wm 0 0 (0/0/0) 0 6 unassigned wm 0 0 (0/0/0) 0 7 unassigned wm 134 - 135 15.69MB (2/0/0) 32130 8 boot wu 0 - 0 7.84MB (1/0/0) 16065 9 alternates wu 1 - 2 15.69MB (2/0/0) 32130

3. Next step is to create the same partitions on the second disk. To avoid human error it is much better to use some kind of automations:
prtvtoc /dev/rdsk/c0d0s2 > /tmp/c0d0s2.toc fmthard -s /tmp/c0d0s2.toc /dev/rdsk/c0d1s2

4. Then we should identify the partitions need to be mirrored:
# egrep "ufs|swap" /etc/vfstab|grep "/dev/dsk" /dev/dsk/c0d0s1 - - swap - no - /dev/dsk/c0d0s0 /dev/rdsk/c0d0s0 / ufs 1 no -

LVM


1. Let’s create few copies of metadb on the partitions we create for this puspose:
# metadb -a -f -c 2 c0d0s7 c0d1s7

2. It’s time to put our disks where OS reside under management of SVM
# metainit -f d10 1 1 c0d0s0 d10: Concat/Stripe is setup # metainit -f d11 1 1 c0d0s1 d11: Concat/Stripe is setup # metainit d0 -m d10 d0: Mirror is setup # metainit d1 -m d11 d1: Mirror is setup # metaroot d0

3. Check newly created devices:
# ls -l /dev/md/rdsk total 8 lrwxrwxrwx 1 root root 36 Aug 30 18:29 d0 -> ../../../devices/pseudo/md@0:0,0,raw lrwxrwxrwx 1 root root 36 Aug 30 18:29 d1 -> ../../../devices/pseudo/md@0:0,1,raw lrwxrwxrwx 1 root root 37 Aug 30 18:28 d10 -> ../../../devices/pseudo/md@0:0,10,raw lrwxrwxrwx 1 root root 37 Aug 30 18:28 d11 -> ../../../devices/pseudo/md@0:0,11,raw # ls -l /dev/md/dsk total 8 lrwxrwxrwx 1 root root 36 Aug 30 18:29 d0 -> ../../../devices/pseudo/md@0:0,0,blk lrwxrwxrwx 1 root root 36 Aug 30 18:29 d1 -> ../../../devices/pseudo/md@0:0,1,blk lrwxrwxrwx 1 root root 37 Aug 30 18:28 d10 -> ../../../devices/pseudo/md@0:0,10,blk lrwxrwxrwx 1 root root 37 Aug 30 18:28 d11 -> ../../../devices/pseudo/md@0:0,11,blk

4. Make appropriate changes in /etc/vfstab to get boot from mirror, not standard disks
# egrep "ufs|swap" /etc/vfstab|grep "/dev/md/dsk" /dev/md/dsk/d1 - - swap - no - /dev/md/dsk/d0 /dev/md/rdsk/d0 / ufs 1 no -

5. The next step is to flush cache buffers and reboot
# sync;sync;sync # reboot

6. It is time to put second disk under management of SVN
# metainit -f d20 1 1 c0d1s0 d20: Concat/Stripe is setup # metainit -f d21 1 1 c0d1s1 d21: Concat/Stripe is setup

7. And to add them to created previously mirrors. Be aware process of synchronisation will continue in background and you can check the process
# metattach d0 d20 d0: submirror d20 is attached # metattach d1 d21 d1: submirror d21 is attached

8. Check the process of building mirrors and wait till they finnish
# metastat d1: Mirror Submirror 0: d11 State: Okay Submirror 1: d21 State: Resyncing Resync in progress: 96 % done Pass: 1 Read option: roundrobin (default) Write option: parallel (default) Size: 2104515 blocks (1.0 GB) d11: Submirror of d1 State: Okay Size: 2104515 blocks (1.0 GB) Stripe 0: Device Start Block Dbase State Reloc Hot Spare c0d0s1 0 No Okay Yes d21: Submirror of d1 State: Resyncing Size: 2104515 blocks (1.0 GB) Stripe 0: Device Start Block Dbase State Reloc Hot Spare c0d1s1 0 No Okay Yes d0: Mirror Submirror 0: d10 State: Okay Submirror 1: d20 State: Resyncing Resync in progress: 13 % done Pass: 1 Read option: roundrobin (default) Write option: parallel (default) Size: 16787925 blocks (8.0 GB) d10: Submirror of d0 State: Okay Size: 16787925 blocks (8.0 GB) Stripe 0: Device Start Block Dbase State Reloc Hot Spare c0d0s0 0 No Okay Yes d20: Submirror of d0 State: Resyncing Size: 16787925 blocks (8.0 GB) Stripe 0: Device Start Block Dbase State Reloc Hot Spare c0d1s0 0 No Okay Yes Device Relocation Information: Device Reloc Device ID c0d1 Yes id1,cmdk@AVMware_Virtual_IDE_Hard_Drive=01000000000000000001 c0d0 Yes id1,cmdk@AVMware_Virtual_IDE_Hard_Drive=00000000000000000001

Boot


1. Next step is to check if partition on second disk is active
# fdisk /dev/rdsk/c0d1p0 Total disk size is 1566 cylinders Cylinder size is 16065 (512 byte) blocks Cylinders Partition Status Type Start End Length % ========= ====== ============ ===== === ====== === 1 Active Solaris2 1 1565 1565 100 SELECT ONE OF THE FOLLOWING: 1. Create a partition 2. Specify the active partition 3. Delete a partition 4. Change between Solaris and Solaris2 Partition IDs 5. Exit (update disk configuration and exit) 6. Cancel (exit without updating disk configuration) Enter Selection: 5

2. And to add boot record to the second disk to make it bootable
# /sbin/installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c0d1s0 stage1 written to partition 0 sector 0 (abs 16065) stage2 written to partition 0, 233 sectors starting at 50 (abs 16115)

3. Add new item in the boot menu (/boot/grub/menu.lst) to have alternative way to boot
title Alternate boot root (hd1,0,a) kernel /platform/i86pc/multiboot module /platform/i86pc/boot_archive

4. Check if the new item is added to the boot menu
# bootadm list-menu The location for the active GRUB menu is: /boot/grub/menu.lst default 0 timeout 10 0 Solaris 10 5/08 s10x_u5wos_10 X86 1 Solaris failsafe 2 Alternate boot

5. That’s all, you have already mirrored root partition (plus swap)

Solaris System Administration Commands

logo-solarisSolaris System Administration Commands

Some commands to allow you to manage your environment

Starting, Stopping and Rebooting


Boot solaris from ok prompt boot
Boot Solaris and reconfigure from ok prompt boot –r
Boot Solaris from CD / Install Solaris boot cdrom
Boot Solaris from network boot net
Install Solaris from network boot net - install
Shutdown machine to OK prompt init 0
Shutdown and power off machine init 5
How to interrupt bootup STOP key and A key together or send from terminal emulator BREAKsignal
Boot solaris in single user & system maintenance mode init s or S
Shutdown with grace time shutdown -y -g5 -i6
Rebooting to Default Runlevel init 6
If system has 2 Solaris OS say 8/9 to boot in OS us eeprom

Installing and Managing software


Display list of all installed packages pkginfo
Display patches installed showrev –p
Display patches installed patchadd –p
Install a package in file fcaw.pkg pkgadd –d fcaw.pkg
Check the install of package JNIfcaw pkgchk JNIfcaw
Display version / info etc of package abc pkginfo –l abc
Remove a package JNIfcaw pkgrm JNIfcaw
Find what package a file called x is in grep x /var/sadm/install/contents
==========================================

User Management

Display All users > logins -x. Perticular user information > logins -x | grep user name. how do change passwd for user > passwd user name. how do change shell & home directory > using " usermod" command. set non expiry passwd for user > give NP in /etc/shadow file.

Solaris System Administration Commands

logo-solarisSolaris System Administration Commands

Some commands to allow you to manage your environment

Starting, Stopping and Rebooting


Boot solaris from ok prompt boot
Boot Solaris and reconfigure from ok prompt boot –r
Boot Solaris from CD / Install Solaris boot cdrom
Boot Solaris from network boot net
Install Solaris from network boot net - install
Shutdown machine to OK prompt init 0
Shutdown and power off machine init 5
How to interrupt bootup STOP key and A key together or send from terminal emulator BREAKsignal
Boot solaris in single user & system maintenance mode init s or S
Shutdown with grace time shutdown -y -g5 -i6
Rebooting to Default Runlevel init 6
If system has 2 Solaris OS say 8/9 to boot in OS us eeprom

Installing and Managing software


Display list of all installed packages pkginfo
Display patches installed showrev –p
Display patches installed patchadd –p
Install a package in file fcaw.pkg pkgadd –d fcaw.pkg
Check the install of package JNIfcaw pkgchk JNIfcaw
Display version / info etc of package abc pkginfo –l abc
Remove a package JNIfcaw pkgrm JNIfcaw
Find what package a file called x is in grep x /var/sadm/install/contents
==========================================

User Management

Display All users > logins -x. Perticular user information > logins -x | grep user name. how do change passwd for user > passwd user name. how do change shell & home directory > using " usermod" command. set non expiry passwd for user > give NP in /etc/shadow file.

How to install DHCP server on Solaris

[caption id="attachment_389" align="aligncenter" width="464"]logo-solaris How to install DHCP server on Solaris[/caption]

How to install DHCP server on Solaris



Preamble


This document is intended to show how to create DHCP server on Solaris using only command line tools. Of course exist GUI tool, named dhcpmgr, located in /usr/sadm/admin/bin directory, but first usually system administrators prefer and do they work via command line and second graphical environment can be inappropriate in some situations because of security, bandwidth or other reasons.

Installation


1. For our installation we will assume our domain is example.com and default gateway is 10.0.1.1

2. First step is to configure server itself, defining directory where the files will be located, type of repository (can be text files, binary files or NIS+ repository), lease time and default gateway. IN this example will be used domain example.com, text files as repository and leased time 2 days
# dhcpconfig -D -p /var/dhcp -r SUNWfiles -d example.com -l 172000 -a 10.0.1.1 Created DHCP configuration file. Created dhcptab. Added "Locale" macro to dhcptab. Added server macro to dhcptab - sol3. DHCP server started.

3. Next we should create network from where the IP addresses will be leased.
# pntadm -C 10.0.1.0

4. Just in case let check the list of configured networks
# pntadm -L 10.0.1.0

5. Lets put in repository addresses from 10.0.1.64 to 10.0.1.79 to be managed by DHCP server
# for i in `echo "echo 10.0.1.{64..79}"|bash`; do pntadm -r SUNWfiles -p /var/dhcp -A $i 10.0.1.0; done

6. And check what the situation with addresses is.
# pntadm -P 10.0.1.0 Client ID Flags Client IP Server IP Lease Expiration Macro Comment 01000C2913E7E8 00 10.0.1.79 10.0.1.12 08/31/2008 UNKNOWN 00 00 10.0.1.78 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.77 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.76 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.75 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.74 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.73 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.72 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.71 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.70 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.69 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.68 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.67 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.66 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.65 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.64 10.0.1.12 Zero UNKNOWN

7. For our surprise someone already lease 10.0.1.79, so our server work

How to install DHCP server on Solaris

[caption id="attachment_389" align="aligncenter" width="464"]logo-solaris How to install DHCP server on Solaris[/caption]

How to install DHCP server on Solaris



Preamble


This document is intended to show how to create DHCP server on Solaris using only command line tools. Of course exist GUI tool, named dhcpmgr, located in /usr/sadm/admin/bin directory, but first usually system administrators prefer and do they work via command line and second graphical environment can be inappropriate in some situations because of security, bandwidth or other reasons.

Installation


1. For our installation we will assume our domain is example.com and default gateway is 10.0.1.1

2. First step is to configure server itself, defining directory where the files will be located, type of repository (can be text files, binary files or NIS+ repository), lease time and default gateway. IN this example will be used domain example.com, text files as repository and leased time 2 days
# dhcpconfig -D -p /var/dhcp -r SUNWfiles -d example.com -l 172000 -a 10.0.1.1 Created DHCP configuration file. Created dhcptab. Added "Locale" macro to dhcptab. Added server macro to dhcptab - sol3. DHCP server started.

3. Next we should create network from where the IP addresses will be leased.
# pntadm -C 10.0.1.0

4. Just in case let check the list of configured networks
# pntadm -L 10.0.1.0

5. Lets put in repository addresses from 10.0.1.64 to 10.0.1.79 to be managed by DHCP server
# for i in `echo "echo 10.0.1.{64..79}"|bash`; do pntadm -r SUNWfiles -p /var/dhcp -A $i 10.0.1.0; done

6. And check what the situation with addresses is.
# pntadm -P 10.0.1.0 Client ID Flags Client IP Server IP Lease Expiration Macro Comment 01000C2913E7E8 00 10.0.1.79 10.0.1.12 08/31/2008 UNKNOWN 00 00 10.0.1.78 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.77 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.76 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.75 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.74 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.73 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.72 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.71 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.70 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.69 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.68 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.67 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.66 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.65 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.64 10.0.1.12 Zero UNKNOWN

7. For our surprise someone already lease 10.0.1.79, so our server work

How to Implement NIS on Solaris

[caption id="attachment_389" align="aligncenter" width="464"]logo-solaris How to Implement NIS on Solaris[/caption]

How to Implement NIS on Solaris



Preamble


This document is intended to give idea about sample implementation of NIS. In the document will be used commands and files as they are in SUN Solaris 10. For your flavour of UNIX or Linux refer to the documentation.

Implementation


1. We should set in the beginning the domain name of our new NIS domain. Here will be used domain name “example”, for your configuration, consult your infrastructure manager and documentation. With command domainname we can set the domain, but until next reboot, so better edit file /etc/defaultdomain and put in to the file the name of your domain. Be careful to set the same name as you enter in domainname command.
# domainname example # domainname > /etc/defaultdomain

2. It’s very wise to define dedicated repository for NIS files instead of using original files of the machine. This can help in case of problems with NIS server and avoid potential risk, based on usage of the same root password on all NIS clients. And in some circumstances it’s good to have local users like sys, adm, mail, so we should exclude them from passwd file. For this purpose we will set up directory, named nisfiles and /etc look a fine container for the directory.
# mkdir /etc/nisfiles

3. Here is the example list of files to be copied in our NIS repository: auto_home auto_master bootparams ethers group hosts ipnodes netgroup netmasks networks passwd protocols rpc services shadow user_attr publickey timezone

4. Next step is to go in directory /var/yp and edit Makefile. Change the line DIR =/etc to be DIR =/etc/nisfiles and if need the line started with all: to define services will be served by NIS. The actual creation of map files can be done via command make or ypinit –m
# ypinit -m In order for NIS to operate sucessfully, we have to construct a list of the NIS servers. Please continue to add the names for YP servers in order of preference, one per line. When you are done with the list, type a <control D> or a return on a line by itself. next host to add: sol1 next host to add: ^D The current list of yp servers looks like this: sol1 Is this correct? [y/n: y] Installing the YP database will require that you answer a few questions. Questions will all be asked at the beginning of the procedure. Do you want this procedure to quit on non-fatal errors? [y/n: n] OK, please remember to go back and redo manually whatever fails. If you don't, some part of the system (perhaps the yp itself) won't work. The yp domain directory is /var/yp/example There will be no further questions. The remainder of the procedure should take 5 to 10 minutes. Building /var/yp/example/ypservers... Running /var/yp /Makefile... updated passwd updated group updated hosts updated ipnodes updated networks updated rpc updated services updated protocols /var/yp/example/mail.aliases: 12 aliases, longest 10 bytes, 138 bytes total /usr/lib/netsvc/yp/mkalias /var/yp/`domainname`/mail.aliases /var/yp/`domainname`/mail.byaddr; updated aliases updated publickey updated netid /usr/sbin/makedbm /etc/nisfiles/netmasks /var/yp/`domainname`/netmasks.byaddr; updated netmasks updated timezone updated auto.master updated auto.home updated ageing updated auth_attr updated exec_attr updated prof_attr updated user_attr updated audit_user updated bootparams updated ethers updated netgroup sol1 has been set up as a yp master server without any errors. If there are running slave yp servers, run yppush now for any data bases which have been changed. If there are no running slaves, run ypinit on those hosts which are to be slave servers.

5. Edit /var/yp/securenets to add networks, to be served by server. Record should look like”
255.255.255.0	 10.0.1.0

6. It’s time to start (restart) our NIS server and check if it running
# svcadm restart nis/server # svcs -av|grep nis disabled - 7:25:29 - svc:/network/rpc/nisplus:default disabled - 7:25:30 - svc:/system/patch-finish:delete online - 8:16:53 96 svc:/network/nis/xfr:default online - 8:16:54 97 svc:/network/nis/passwd:default online - 8:16:54 99 svc:/network/nis/update:default online - 8:31:58 102 svc:/network/nis/client:default online - 8:36:49 103 svc:/network/nis/server:default # ps -efl|grep yp 0 S daemon 149 1 0 40 20  ? 1075  ? 07:25:42 ? 0:00 /usr/lib/crypto/kcfd 0 S root 2404 1 0 40 20  ? 1289  ? 08:36:49 ? 0:00 /usr/lib/netsvc/yp/ypserv 0 S root 1429 1 0 40 20  ? 1302  ? 08:16:54 ? 0:00 /usr/lib/netsvc/yp/ypxfrd 0 S root 1443 1 0 40 20  ? 468  ? 08:16:54 ? 0:00 /usr/lib/netsvc/yp/rpc.ypupdated 0 S root 1436 1 0 40 20  ? 1288  ? 08:16:54 ? 0:00 /usr/lib/netsvc/yp/rpc.yppasswdd -m 0 S root 2390 1 0 40 20  ? 526  ? 08:31:58 ? 0:00 /usr/lib/netsvc/yp/ypbind

7. Then we should set your server as client. This is usual situation and only in special circumstances you should set one machine only as NIS server, but not client. When you configure other servers as clients do not forget to set /etc/defaultdomain and nsswitch.conf files
# ypinit -c In order for NIS to operate sucessfully, we have to construct a list of the NIS servers. Please continue to add the names for YP servers in order of preference, one per line. When you are done with the list, type a <control D> or a return on a line by itself. next host to add: sol1 next host to add: ^D The current list of yp servers looks like this: sol1 Is this correct? [y/n: y]

8. And now is time to check if everything works fine. There is in /etc/nisfiles/hosts record for host m1, but not in /etc/inet/hosts:
# getent hosts m1 10.0.1.51 m1 # ypcat hosts 127.0.0.1 localhost 10.0.1.10 sol1 loghost 10.0.1.53 m3 10.0.1.52 m2 10.0.1.51 m1

How to Implement NIS on Solaris

[caption id="attachment_389" align="aligncenter" width="464"]logo-solaris How to Implement NIS on Solaris[/caption]

How to Implement NIS on Solaris



Preamble


This document is intended to give idea about sample implementation of NIS. In the document will be used commands and files as they are in SUN Solaris 10. For your flavour of UNIX or Linux refer to the documentation.

Implementation


1. We should set in the beginning the domain name of our new NIS domain. Here will be used domain name “example”, for your configuration, consult your infrastructure manager and documentation. With command domainname we can set the domain, but until next reboot, so better edit file /etc/defaultdomain and put in to the file the name of your domain. Be careful to set the same name as you enter in domainname command.
# domainname example # domainname > /etc/defaultdomain

2. It’s very wise to define dedicated repository for NIS files instead of using original files of the machine. This can help in case of problems with NIS server and avoid potential risk, based on usage of the same root password on all NIS clients. And in some circumstances it’s good to have local users like sys, adm, mail, so we should exclude them from passwd file. For this purpose we will set up directory, named nisfiles and /etc look a fine container for the directory.
# mkdir /etc/nisfiles

3. Here is the example list of files to be copied in our NIS repository: auto_home auto_master bootparams ethers group hosts ipnodes netgroup netmasks networks passwd protocols rpc services shadow user_attr publickey timezone

4. Next step is to go in directory /var/yp and edit Makefile. Change the line DIR =/etc to be DIR =/etc/nisfiles and if need the line started with all: to define services will be served by NIS. The actual creation of map files can be done via command make or ypinit –m
# ypinit -m In order for NIS to operate sucessfully, we have to construct a list of the NIS servers. Please continue to add the names for YP servers in order of preference, one per line. When you are done with the list, type a <control D> or a return on a line by itself. next host to add: sol1 next host to add: ^D The current list of yp servers looks like this: sol1 Is this correct? [y/n: y] Installing the YP database will require that you answer a few questions. Questions will all be asked at the beginning of the procedure. Do you want this procedure to quit on non-fatal errors? [y/n: n] OK, please remember to go back and redo manually whatever fails. If you don't, some part of the system (perhaps the yp itself) won't work. The yp domain directory is /var/yp/example There will be no further questions. The remainder of the procedure should take 5 to 10 minutes. Building /var/yp/example/ypservers... Running /var/yp /Makefile... updated passwd updated group updated hosts updated ipnodes updated networks updated rpc updated services updated protocols /var/yp/example/mail.aliases: 12 aliases, longest 10 bytes, 138 bytes total /usr/lib/netsvc/yp/mkalias /var/yp/`domainname`/mail.aliases /var/yp/`domainname`/mail.byaddr; updated aliases updated publickey updated netid /usr/sbin/makedbm /etc/nisfiles/netmasks /var/yp/`domainname`/netmasks.byaddr; updated netmasks updated timezone updated auto.master updated auto.home updated ageing updated auth_attr updated exec_attr updated prof_attr updated user_attr updated audit_user updated bootparams updated ethers updated netgroup sol1 has been set up as a yp master server without any errors. If there are running slave yp servers, run yppush now for any data bases which have been changed. If there are no running slaves, run ypinit on those hosts which are to be slave servers.

5. Edit /var/yp/securenets to add networks, to be served by server. Record should look like”
255.255.255.0	 10.0.1.0

6. It’s time to start (restart) our NIS server and check if it running
# svcadm restart nis/server # svcs -av|grep nis disabled - 7:25:29 - svc:/network/rpc/nisplus:default disabled - 7:25:30 - svc:/system/patch-finish:delete online - 8:16:53 96 svc:/network/nis/xfr:default online - 8:16:54 97 svc:/network/nis/passwd:default online - 8:16:54 99 svc:/network/nis/update:default online - 8:31:58 102 svc:/network/nis/client:default online - 8:36:49 103 svc:/network/nis/server:default # ps -efl|grep yp 0 S daemon 149 1 0 40 20  ? 1075  ? 07:25:42 ? 0:00 /usr/lib/crypto/kcfd 0 S root 2404 1 0 40 20  ? 1289  ? 08:36:49 ? 0:00 /usr/lib/netsvc/yp/ypserv 0 S root 1429 1 0 40 20  ? 1302  ? 08:16:54 ? 0:00 /usr/lib/netsvc/yp/ypxfrd 0 S root 1443 1 0 40 20  ? 468  ? 08:16:54 ? 0:00 /usr/lib/netsvc/yp/rpc.ypupdated 0 S root 1436 1 0 40 20  ? 1288  ? 08:16:54 ? 0:00 /usr/lib/netsvc/yp/rpc.yppasswdd -m 0 S root 2390 1 0 40 20  ? 526  ? 08:31:58 ? 0:00 /usr/lib/netsvc/yp/ypbind

7. Then we should set your server as client. This is usual situation and only in special circumstances you should set one machine only as NIS server, but not client. When you configure other servers as clients do not forget to set /etc/defaultdomain and nsswitch.conf files
# ypinit -c In order for NIS to operate sucessfully, we have to construct a list of the NIS servers. Please continue to add the names for YP servers in order of preference, one per line. When you are done with the list, type a <control D> or a return on a line by itself. next host to add: sol1 next host to add: ^D The current list of yp servers looks like this: sol1 Is this correct? [y/n: y]

8. And now is time to check if everything works fine. There is in /etc/nisfiles/hosts record for host m1, but not in /etc/inet/hosts:
# getent hosts m1 10.0.1.51 m1 # ypcat hosts 127.0.0.1 localhost 10.0.1.10 sol1 loghost 10.0.1.53 m3 10.0.1.52 m2 10.0.1.51 m1

How to Install Glassfish on Solaris

logo-solarisHow to Install Glassfish on Solaris



Preamble


One of the tasks of UNIX/Linux administration is the installation of software. In this article we will discuss the installation of Glassfish - a Java application server from Sun Microsystems on the Solaris platform:-

Prerequisites


For the installation we will need Solaris OS installed and a JDK . For an example manual on how to install Solaris, see http://imagia.in/?p=457. In this example we will use JDBC connection to an Oracle database. For the Oracle client we could choose Instant Client or the full Installation, because, in our case, we will only need ojdbc14.jar to be in the Glassfish /lib directory. But I strictly recommend installing the full Oracle client, (Administrator), because there are a lot of helpful utilities such as sqlplus, tnsping which can help resolve oracle (and other) connectivity problems there. Also recommended is to install its own version of JDK (as described in the remarks here: http://imagia.in/?p=457. This will help you have a nonchangeable environment to run the application server. However it will add some system administration overhead. But it will increase the reliability of our environment.

Installation process



  1. Install Oracle client
    (below we assume the installation base is in /opt/oracle and the installation of the client is in the directory: /opt/oracle/product/10.2.0/client_1 and the version of Oracle client is 10.2)

  2. Create a user to run our application server:
    useradd -d /opt/Glassfish -k /etc/skel -m Glassfish
    Of course it is possible to run Glassfish as root, but for security reasons, the separation of duties and privileges is strictly recommended to run software under its own user. On the above command ignore the error, related to the length of the user name.

  3. Download and extract JDK for example in /etc/Glassfish/java

  4. Download Glassfish software and put the archive in /opt
    Do not forget to change ownership of the file and to remove it after installation

  5. Set the environment variables for Glassfish user:
    JAVA_HOME=/opt/Glassfish/java
    ORACLE_BASE=/opt/oracle
    ORACLE_HOME=${ORACLE_BASE}/product/10.2.0/client_1
    ORACLE_SID=ORCL
    LD_LIBRARY_PATH=${ORACLE_HOME}/lib:/lib:/usr/lib
    CLASSPATH=${ORACLE_HOME}/jre:${ORACLE_HOME}/jlib:${ORACLE_HOME}/rdbms/jlib
    ANT_HOME=/opt/Glassfish/lib/ant
    PATH=${JAVA_HOME}/bin:${ANT_HOME}/bin:$PATH
    export JAVA_HOME ORACLE_BASE ORACLE_HOME LD_LIBRARY_PATH CLASSPATH ANT_HOME PATH

  6. switch to Glassfish user

  7. run installation of Glassfish
    java -Xmx256m -jar Glassfish-installer-v2-b58g.jar
    (the name of Glassfish installation file is just an example, yours may vary)

  8. go to Glassfish home directory

  9. add executable mode to ant
    chmod -R +x lib/ant/bin

  10. run ant to accomplish configuration of Glassfish
    lib/ant/bin/ant -f setup.xml
    (if server will be in cluster instead of setup.xml use setup-cluster.xml)

  11. Voila! You have installed the Glassfish Java application server

How to Install Glassfish on Solaris

logo-solarisHow to Install Glassfish on Solaris



Preamble


One of the tasks of UNIX/Linux administration is the installation of software. In this article we will discuss the installation of Glassfish - a Java application server from Sun Microsystems on the Solaris platform:-

Prerequisites


For the installation we will need Solaris OS installed and a JDK . For an example manual on how to install Solaris, see http://imagia.in/?p=457. In this example we will use JDBC connection to an Oracle database. For the Oracle client we could choose Instant Client or the full Installation, because, in our case, we will only need ojdbc14.jar to be in the Glassfish /lib directory. But I strictly recommend installing the full Oracle client, (Administrator), because there are a lot of helpful utilities such as sqlplus, tnsping which can help resolve oracle (and other) connectivity problems there. Also recommended is to install its own version of JDK (as described in the remarks here: http://imagia.in/?p=457. This will help you have a nonchangeable environment to run the application server. However it will add some system administration overhead. But it will increase the reliability of our environment.

Installation process



  1. Install Oracle client
    (below we assume the installation base is in /opt/oracle and the installation of the client is in the directory: /opt/oracle/product/10.2.0/client_1 and the version of Oracle client is 10.2)

  2. Create a user to run our application server:
    useradd -d /opt/Glassfish -k /etc/skel -m Glassfish
    Of course it is possible to run Glassfish as root, but for security reasons, the separation of duties and privileges is strictly recommended to run software under its own user. On the above command ignore the error, related to the length of the user name.

  3. Download and extract JDK for example in /etc/Glassfish/java

  4. Download Glassfish software and put the archive in /opt
    Do not forget to change ownership of the file and to remove it after installation

  5. Set the environment variables for Glassfish user:
    JAVA_HOME=/opt/Glassfish/java
    ORACLE_BASE=/opt/oracle
    ORACLE_HOME=${ORACLE_BASE}/product/10.2.0/client_1
    ORACLE_SID=ORCL
    LD_LIBRARY_PATH=${ORACLE_HOME}/lib:/lib:/usr/lib
    CLASSPATH=${ORACLE_HOME}/jre:${ORACLE_HOME}/jlib:${ORACLE_HOME}/rdbms/jlib
    ANT_HOME=/opt/Glassfish/lib/ant
    PATH=${JAVA_HOME}/bin:${ANT_HOME}/bin:$PATH
    export JAVA_HOME ORACLE_BASE ORACLE_HOME LD_LIBRARY_PATH CLASSPATH ANT_HOME PATH

  6. switch to Glassfish user

  7. run installation of Glassfish
    java -Xmx256m -jar Glassfish-installer-v2-b58g.jar
    (the name of Glassfish installation file is just an example, yours may vary)

  8. go to Glassfish home directory

  9. add executable mode to ant
    chmod -R +x lib/ant/bin

  10. run ant to accomplish configuration of Glassfish
    lib/ant/bin/ant -f setup.xml
    (if server will be in cluster instead of setup.xml use setup-cluster.xml)

  11. Voila! You have installed the Glassfish Java application server

Suggestions and ideas about filesystem sizing on Solaris

logo-solarisSuggestions and ideas about filesystem sizing on Solaris



Preambule


This document is intended to give some ideas and suggestions how to size the filesystems (and slices) in Solaris OS. Use it with cautious and do not forget to consult with official SUN documentation and your company documents, related to the subject.

Sugestions



  1. For / (root) filesystem normally you do not need so much disk space. Most of the time you can allocate 256 MB or ever less, but 512 MB is one very good value. Do not attempt to allocate big amount of space and put all directories as /, usr, var, opt, export/home in one filesystem. This may look very sample, but can put you in trouble after some time.

  2. For /usr filesystem you need average 2048 MB. On time of installation, installer will show you how much you need. Don't put much more space ever if you think to install big amount of software in /usr/local. If this happen, just create separate filesystem.

  3. For virtual memory i suggest to use this schema:

    • < 1 GB – RAMx2.5

    • <2 GB – RAMx2

    • <4 GB – RAMx1,5

    • >4 GB – RAMx1

    • Here you should get above just as starting point, because many applications have own requirements. For example Oracle+SAP need swap to be four times RAM, almost independently of size of real memory, but Oracle itself (if it's alone) “prefer to live” in RAM.



  4. For /var filesystem you can allocate as minimum 512 MB, but if you expect big log files – from system, applications, etc, you should allocate more. The same is true if you expect long life and many updates on your system. Do not forget log rotate utilities, they can help you save some disk space. If your server will be used for jobs, generating big amount of data in /var as mail server or print server you can allocate more disk space, but because most of the print and mail software use /var/spool you can create dedicated filesystem for this purpose.

  5. Normaly /tmp filesystem is “part” of swap, but for some products as Oracle you can set dedicated filesystem. Normally 512 megabytes are enough.

  6. For /opt filesystem you should decide the size by self, because in this filesystem normally in Solaris are located installations of external software. 256 MB should be enough for many purposes, but some software (Oracle by example) can fill up to 1.5 GB (or more) only for executable files.

  7. And last but not least /export/home. Do not set this filesystem very big. Later if it's need you can move home directories and files to new filesystem or create new one like /export/home2 for new users


Ideas



  1. Do not allocated entire disk even if you use some volume manager because later when you need diskspace for new filesystem or extend existing one can be hard to get new harddisk

  2. Get indeep knowledge about the applications will run on this machine for better filesystems sizing

  3. Do not oversize your filesystems and do not set them as little as possible. 20-30% over from the requirements is OK as general rule

Suggestions and ideas about filesystem sizing on Solaris

logo-solarisSuggestions and ideas about filesystem sizing on Solaris



Preambule


This document is intended to give some ideas and suggestions how to size the filesystems (and slices) in Solaris OS. Use it with cautious and do not forget to consult with official SUN documentation and your company documents, related to the subject.

Sugestions



  1. For / (root) filesystem normally you do not need so much disk space. Most of the time you can allocate 256 MB or ever less, but 512 MB is one very good value. Do not attempt to allocate big amount of space and put all directories as /, usr, var, opt, export/home in one filesystem. This may look very sample, but can put you in trouble after some time.

  2. For /usr filesystem you need average 2048 MB. On time of installation, installer will show you how much you need. Don't put much more space ever if you think to install big amount of software in /usr/local. If this happen, just create separate filesystem.

  3. For virtual memory i suggest to use this schema:

    • < 1 GB – RAMx2.5

    • <2 GB – RAMx2

    • <4 GB – RAMx1,5

    • >4 GB – RAMx1

    • Here you should get above just as starting point, because many applications have own requirements. For example Oracle+SAP need swap to be four times RAM, almost independently of size of real memory, but Oracle itself (if it's alone) “prefer to live” in RAM.



  4. For /var filesystem you can allocate as minimum 512 MB, but if you expect big log files – from system, applications, etc, you should allocate more. The same is true if you expect long life and many updates on your system. Do not forget log rotate utilities, they can help you save some disk space. If your server will be used for jobs, generating big amount of data in /var as mail server or print server you can allocate more disk space, but because most of the print and mail software use /var/spool you can create dedicated filesystem for this purpose.

  5. Normaly /tmp filesystem is “part” of swap, but for some products as Oracle you can set dedicated filesystem. Normally 512 megabytes are enough.

  6. For /opt filesystem you should decide the size by self, because in this filesystem normally in Solaris are located installations of external software. 256 MB should be enough for many purposes, but some software (Oracle by example) can fill up to 1.5 GB (or more) only for executable files.

  7. And last but not least /export/home. Do not set this filesystem very big. Later if it's need you can move home directories and files to new filesystem or create new one like /export/home2 for new users


Ideas



  1. Do not allocated entire disk even if you use some volume manager because later when you need diskspace for new filesystem or extend existing one can be hard to get new harddisk

  2. Get indeep knowledge about the applications will run on this machine for better filesystems sizing

  3. Do not oversize your filesystems and do not set them as little as possible. 20-30% over from the requirements is OK as general rule

Practical guide for minimalistic Solaris installation

logo-solarisPractical guide for minimalistic Solaris installation






Contents


  • 1 Preamble

  • 2 Installation

  • 3 Install additional packages (SUNWCssh, SUNWladm, SUNWxcu6)

  • 4 Generate ssh server keys

  • 5 install additional packages

  • 6 install java SDK packages

  • 7 Final notes

  • 8 Remarks





Preamble


When you install Solaris (and any other UNIX/Linux) in generally there are 2 ways: make full install of all packages from media and install as little as possible. Each of the ways have pros and cons, but discussion about this is outside the theme of this text. This article is directed to create custom, minimalistic installation of Solaris 10. For security resons we will use ssh as “communication” way, for support of international charsets we will install en_US.UTF-8 codepage, but for compatibility will set the default language to C

Installation


We will start core installation and after this add the packages and clusters: SUNWCssh, SUNWladm, SUNWxcu6. Of course is possible to add the packages and clusters on time of the installation and get ssh key generation done on the time of first boot. But for demonstration we will do this work on “hard” way i.e. install packages and generate keys by hand. Do not forget to edit your /etc/ssh/sshd_config file to enable root logins via ssh. I know this can is security problem, but for tests is OK. As Software Group choose Core Group. Set disk map as follow
/ - 2048 /opt – 2048 swap - =RAM /home – 64

The above disk layout is just example, for your installation follow rules, defined in your company or by policies from product you want to install later (for filesystems sizing take a look here:

http://imagia.in/?p=459


 

Install additional packages (SUNWCssh, SUNWladm, SUNWxcu6)


Mount CDROM (DVDROM) and install package. Be aware the order is important.
mount –o ro –F hsfs /dev/dsk/c1t0d0s0 /mnt cd /mnt/Solaris_10/Products pkgadd –d . SUNWsshcu SUNWsshr SUNWsshu SUNWsshdr SUNWsshdu pkgadd –d . SUNWxcu4 SUNWxcu6 pkgadd –d . SUNWladm

Generate ssh server keys


cd /etc/ssh ssh-keygen –t rsa –f ssh_host_rsa_key ssh-keygen –t dsa –f ssh_host_dsa_key svcadm enable ssh

In process of generation when ask for password just press enter. The length of the keys is 768 bits. Change it in case of need.

install additional packages


pkgadd -d . SUNWctpls pkgadd -d . SUNWmfrun pkgadd -d . SUNWxwrtl pkgadd -d . SUNWxwice pkgadd -d . SUNWxwfnt pkgadd -d . SUNWxwplr pkgadd -d . SUNWxwplt pkgadd -d . SUNWbtool pkgadd -d . SUNWarc pkgadd -d . SUNWhea pkgadd -d . SUNWtoo pkgadd -d . SUNWlibmr pkgadd -d . SUNWlibm pkgadd -d . SUNWlibms pkgadd -d . SUNWsprot pkgadd -d . SUNWi1of pkgadd -d . SUNWi1cs pkgadd -d . SUNWeurf pkgadd -d . SUNWi15rf pkgadd -d . SUNWi15cs pkgadd -d . SUNWxwfnt pkgadd -d . SUNWadmfr pkgadd -d . SUNWadmc pkgadd -d . SUNWadmfw pkgadd -d . SUNWadmr pkgadd -d . SUNWadmap

Part of the packages are need for i18n support, part are need for installing and running java, the rest are need for proper Oracle (database server/client) installation. Of course you can decide for self, but most of them are need for installation and running almost every additional software. Again be aware the order is important.

install java SDK packages


When you need java (JRE/JDK) you can install it on 2 different ways: from standard packages and download and install from SUN site. If you need to track changes and patch it the simplest way is to use java, bundled in installation. But if you need to run some specific version for some software you can download it from SUN site (see remark #1), copy it on special place (even under directory tree of the product and set JAVA_HOME and PATH variables.
pkgadd -d . SUNWj5rt pkgadd -d . SUNWj5man pkgadd -d . SUNWj5cfg pkgadd -d . SUNWj5dev

Final notes


This article give you just start point. For your product maybe you will need additional packages. The advantage of this type of installation is you have less packages to care (change, patch) about, you get only 500 MB disk space of installation, you get only 30 processes (may vary) started and only 150 MB memory occupied (may vary too).

Remarks


1. On the SUN Java site you can see two kind of packages: jdk-6u4-solaris-i586.sh and jdk-6u4-solaris-i586.tar.Z (names are just examples). Difference between them is the first archive (.sh) after agree with license create directory with java files you can move (directory) wherever you want (see listing).
# ls -l drwxrwxr-x 10 root root 687 Dec 14 15:08 jdk1.6.0_04

The second archive (tar.Z) create few directories, containing packages you can install with pkgadd program (see listing).
# ls -l -r--r--r-- 1 10 143 4140 Dec 14 17:15 COPYRIGHT -r--r--r-- 1 10 143 14097 Dec 14 17:15 LICENSE -r--r--r-- 1 10 143 28599 Dec 14 17:15 README.html drwxr-xr-x 4 10 143 226 Dec 14 17:14 SUNWj6cfg drwxr-xr-x 4 10 143 226 Dec 14 17:14 SUNWj6dev drwxr-xr-x 4 10 143 226 Dec 14 17:14 SUNWj6dmo drwxr-xr-x 4 10 143 226 Dec 14 17:14 SUNWj6jmp drwxr-xr-x 4 10 143 226 Dec 14 17:14 SUNWj6man drwxr-xr-x 4 10 143 226 Dec 14 17:14 SUNWj6rt drwxrwxr-x 4 10 143 226 Dec 14 17:14 SUNWjavadb-client drwxrwxr-x 4 10 143 226 Dec 14 17:14 SUNWjavadb-common drwxrwxr-x 4 10 143 226 Dec 14 17:14 SUNWjavadb-core drwxrwxr-x 4 10 143 226 Dec 14 17:14 SUNWjavadb-demo drwxrwxr-x 4 10 143 226 Dec 14 17:14 SUNWjavadb-docs drwxrwxr-x 4 10 143 226 Dec 14 17:14 SUNWjavadb-javadoc


Practical guide for minimalistic Solaris installation

logo-solarisPractical guide for minimalistic Solaris installation






Contents


  • 1 Preamble

  • 2 Installation

  • 3 Install additional packages (SUNWCssh, SUNWladm, SUNWxcu6)

  • 4 Generate ssh server keys

  • 5 install additional packages

  • 6 install java SDK packages

  • 7 Final notes

  • 8 Remarks





Preamble


When you install Solaris (and any other UNIX/Linux) in generally there are 2 ways: make full install of all packages from media and install as little as possible. Each of the ways have pros and cons, but discussion about this is outside the theme of this text. This article is directed to create custom, minimalistic installation of Solaris 10. For security resons we will use ssh as “communication” way, for support of international charsets we will install en_US.UTF-8 codepage, but for compatibility will set the default language to C

Installation


We will start core installation and after this add the packages and clusters: SUNWCssh, SUNWladm, SUNWxcu6. Of course is possible to add the packages and clusters on time of the installation and get ssh key generation done on the time of first boot. But for demonstration we will do this work on “hard” way i.e. install packages and generate keys by hand. Do not forget to edit your /etc/ssh/sshd_config file to enable root logins via ssh. I know this can is security problem, but for tests is OK. As Software Group choose Core Group. Set disk map as follow
/ - 2048 /opt – 2048 swap - =RAM /home – 64

The above disk layout is just example, for your installation follow rules, defined in your company or by policies from product you want to install later (for filesystems sizing take a look here:

http://imagia.in/?p=459


 

Install additional packages (SUNWCssh, SUNWladm, SUNWxcu6)


Mount CDROM (DVDROM) and install package. Be aware the order is important.
mount –o ro –F hsfs /dev/dsk/c1t0d0s0 /mnt cd /mnt/Solaris_10/Products pkgadd –d . SUNWsshcu SUNWsshr SUNWsshu SUNWsshdr SUNWsshdu pkgadd –d . SUNWxcu4 SUNWxcu6 pkgadd –d . SUNWladm

Generate ssh server keys


cd /etc/ssh ssh-keygen –t rsa –f ssh_host_rsa_key ssh-keygen –t dsa –f ssh_host_dsa_key svcadm enable ssh

In process of generation when ask for password just press enter. The length of the keys is 768 bits. Change it in case of need.

install additional packages


pkgadd -d . SUNWctpls pkgadd -d . SUNWmfrun pkgadd -d . SUNWxwrtl pkgadd -d . SUNWxwice pkgadd -d . SUNWxwfnt pkgadd -d . SUNWxwplr pkgadd -d . SUNWxwplt pkgadd -d . SUNWbtool pkgadd -d . SUNWarc pkgadd -d . SUNWhea pkgadd -d . SUNWtoo pkgadd -d . SUNWlibmr pkgadd -d . SUNWlibm pkgadd -d . SUNWlibms pkgadd -d . SUNWsprot pkgadd -d . SUNWi1of pkgadd -d . SUNWi1cs pkgadd -d . SUNWeurf pkgadd -d . SUNWi15rf pkgadd -d . SUNWi15cs pkgadd -d . SUNWxwfnt pkgadd -d . SUNWadmfr pkgadd -d . SUNWadmc pkgadd -d . SUNWadmfw pkgadd -d . SUNWadmr pkgadd -d . SUNWadmap

Part of the packages are need for i18n support, part are need for installing and running java, the rest are need for proper Oracle (database server/client) installation. Of course you can decide for self, but most of them are need for installation and running almost every additional software. Again be aware the order is important.

install java SDK packages


When you need java (JRE/JDK) you can install it on 2 different ways: from standard packages and download and install from SUN site. If you need to track changes and patch it the simplest way is to use java, bundled in installation. But if you need to run some specific version for some software you can download it from SUN site (see remark #1), copy it on special place (even under directory tree of the product and set JAVA_HOME and PATH variables.
pkgadd -d . SUNWj5rt pkgadd -d . SUNWj5man pkgadd -d . SUNWj5cfg pkgadd -d . SUNWj5dev

Final notes


This article give you just start point. For your product maybe you will need additional packages. The advantage of this type of installation is you have less packages to care (change, patch) about, you get only 500 MB disk space of installation, you get only 30 processes (may vary) started and only 150 MB memory occupied (may vary too).

Remarks


1. On the SUN Java site you can see two kind of packages: jdk-6u4-solaris-i586.sh and jdk-6u4-solaris-i586.tar.Z (names are just examples). Difference between them is the first archive (.sh) after agree with license create directory with java files you can move (directory) wherever you want (see listing).
# ls -l drwxrwxr-x 10 root root 687 Dec 14 15:08 jdk1.6.0_04

The second archive (tar.Z) create few directories, containing packages you can install with pkgadd program (see listing).
# ls -l -r--r--r-- 1 10 143 4140 Dec 14 17:15 COPYRIGHT -r--r--r-- 1 10 143 14097 Dec 14 17:15 LICENSE -r--r--r-- 1 10 143 28599 Dec 14 17:15 README.html drwxr-xr-x 4 10 143 226 Dec 14 17:14 SUNWj6cfg drwxr-xr-x 4 10 143 226 Dec 14 17:14 SUNWj6dev drwxr-xr-x 4 10 143 226 Dec 14 17:14 SUNWj6dmo drwxr-xr-x 4 10 143 226 Dec 14 17:14 SUNWj6jmp drwxr-xr-x 4 10 143 226 Dec 14 17:14 SUNWj6man drwxr-xr-x 4 10 143 226 Dec 14 17:14 SUNWj6rt drwxrwxr-x 4 10 143 226 Dec 14 17:14 SUNWjavadb-client drwxrwxr-x 4 10 143 226 Dec 14 17:14 SUNWjavadb-common drwxrwxr-x 4 10 143 226 Dec 14 17:14 SUNWjavadb-core drwxrwxr-x 4 10 143 226 Dec 14 17:14 SUNWjavadb-demo drwxrwxr-x 4 10 143 226 Dec 14 17:14 SUNWjavadb-docs drwxrwxr-x 4 10 143 226 Dec 14 17:14 SUNWjavadb-javadoc