Wednesday 1 October 2008

How to jumpstart Solaris 10 (Part 2)

Adding Client
Step to adding a Client
1. Create Client profile
2. Create pre- and post-install script
3. Update /export/Config/rules
4. Run check script
5. Add ethers and hosts information
6. Run add_install_client script
7. Reboot client machine

Step 1: The Client Profile
Edit file profile1 in /export/Config
# cd /export/Config
# vi profile1
# install_type MUST be first
install_type initial_install

# start with the minimal required number of packages
cluster SUNWCXall
package SUNWaccr add

# format the entire disk for Solaris WARNING: This line for X86 only
fdisk all solaris all

#define how the disk is partitioned
partitioning explicit
filesys rootdisk.s0 free /
filesys rootdisk.s1 4096 swap

# install systems as server
system_type server

Step 2: Pre- and Post-install script (optional)
Careful! New system's disks are mounted on /a during jumpstart
begin1 script example:
# vi begin1
#!/bin/sh
echo "Begin Script for JumpStart RFATEST178..."
finish1 script example:
# vi finish1
#!/bin/sh
echo "Finish Script for JumpStart RFATEST178..."
echo "Get rid if the nfs prompt during the initial boot"
touch /a/etc/.NFS4inst_state.domain

Step 3: The rules file
Format of entries are:
[match rule] [pre-install] [profile] [post-install]

Sample file:
# vi rules
hostname RFATEST178 begin1 profile1 finish1

note : profile1 from step 1 ,begin1 and finish1 from step 2
use : hostname RFATEST178 - profile1 -,If you skip step 2

Step 4:Run check script
Run this script each time that rules file is updated.It will check the syntax of profile and verifies that script exist.After that It will create rules.ok file for jumpstart process.
# ./check

--Now you should have files in /export/Config follow this:
# ls -l
-rwxr-xr-x 1 root root 59701 Jan 8 10:16 check
-rw-r--r-- 1 root root 232 Jan 8 10:14 profile1
-rw-r--r-- 1 root root 32 Jan 8 10:15 rules
-rw-r--r-- 1 root root 57 Jan 8 10:16 rules.ok
-rw-r--r-- 1 root root 278 Jan 8 09:33 sysidcfg
Note : begin1 and finish1 is option

Step 5: Update hosts info
Update file /etc/ethers that should contain the MAC address of the client.Make sure the jumpstart server can resolve the name of the client.
# cd /etc
# vi ethers
0a:3b:ba:f5:d1:e6 [client hostname]

# vi hosts
[ip.address.for.client] [client hostname]

Step 6: add_install_client
you run the following commands from your installation image, not from the CD.
# cd /export/Install/Solaris_10/Tools
# ./add_install_client \
-e 0a:3b:ba:f5:d1:e6 \
-s :/export/Install \
-c :/export/Config \
-p :/export/Config [client hostname] sun4u

PS. -e specifies the MAC address of the client.
-s specifies the location of the server's installation files.
-c specifies the Solaris JumpStart configuration location.
-p specifies the sysidcfg file's location.
sun4u specifies the architecture of the client.

Step 7:Reboot Client
Boot up the client and have it find the server.
On the client, be at the OpenBoot OK prompt and run the following command:
ok> boot net - install
or
# reboot -- 'net - install'
the client connected to server, downloaded the OS, and commenced installing it.

NOTE : Ensure that nsswitch.conf which hosts ,ether and bootparams has 'files' is the first parameter.

reference : http://www.sun.com/bigadmin/content/submitted/jumpstart_zfs.jsp

Friday 4 July 2008

How to jumpstart Solaris 10 (Part 1)

Server Configuration
1. Create install and configuration directory.
2. Copy OS media to install directory.
3. Copy scripts to configuration directory.
4. Create "sysidcfg" file in install directory.
5. Create /tftpboot.
6. Start system daemon.
step 1-2 : to config install server
step 3-4 : to config configure server
step 5-6 : to config boot server

Step 1 : Create Create install and configuration directory
# mkdir -m 755 /export/Config /export/Install
# chown root:root /export/Config /export/Install
# cat >> /etc/dfs/dfstab
share -F nfs -o ro,anon=0 /export/Config
share -F nfs -o ro,anon=0 /export/Install
^D
# shareall

Step 2 : Copy OS media to install directory
Put the first CD of Solaris 10 in the CD-ROM drive
Install OS:(1st Disk)
# cd /cdrom/cdrom0/s0/Solaris_10/Tools
# ./setup_install_server /export/Install
Install OS:(another Disk)
# cd /cdrom/cdrom0/Solaris_10/Tools
# ./add_to_install_server /export/install
Note : Interested directory
/export/Install/Solaris_10
- Misc/jumpstart_sample contain sample configs and scripts
- Tools contain script for adding clients
- Tool/Boot is boot image for client
- Product contain Solaris package which will be installed
- Patches contain patches to install during jumstart
- MU contain maintenance update patch(may be)

Step 3 : Copy Script to Config directory
# cd /export/Install/Solaris_10
# cd Misc/jumpstart_sample
# mkdir -p -m 755 /export/Config/bin
# cp check /export/Config/bin
# chmod 755 /export/Config/bin/check
# chown -R root:root /export/Config/bin

Step 4 : The sysidcfg File
# cd /export/Config
# vi sysidcfg
system_locale=en_US
timezone=US/Central
timeserver=localhost
terminal=vt100
name_service=NONE
security_policy=NONE
root_password=
network_interface=PRIMARY {hostname=
netmask=
protocol_ipv6=no
default_route=}

:wq


Step 5 : Create /tftpboot
# mkdir -m 711 /tftpboot
# chown root:root /tftpboot
Uncomment the below line in /etc/inet/inetd.conf
tftp ..... /usr/sbin/in/tftpd in.tftpd -s /tftpboot
On Solaris 10 execute command :
# inetconv

Step 6 : Start System Daemon
- NFS daemon
FMRI : svc:/network/nfs/server
Script : /usr/lib/nfs/nfsd
- in.rarpd
FMRI : svc:/network/rarp
Script : /usr/sbin/in/rarpd
- rpc.bootparamd
FMRI : svc:/network/rpc/bootparams
Script : /usr/sbin/rpc.bootparamd
- inetd
FMRI : svc:/network/inetd
Script : /usr/lib/inet/inetd

Continue in part 2...

Tuesday 29 April 2008

How to reconfigure devices (Solaris)

Performing a reconfiguration boot
Create /reconfigure file
# touch /reconfigure
Use init 5 command to shutdown the system,add or remove device.(If the device is already attached to system,can use init 0 command to shutdown)
If the /reconfigure file was not created.
On SPARC
ok> boot -r
On x86/64 system
add option -r when edit kernel on grub
note : use reboot -- -r will send option -r to ok prompt(X86/64 can use this command)

Using the devfsadm command
devfsadm will load every driver in the system and attach all possible device instances.
# devfsadm
to proof all devices
note : option -c to identify class name Ex. devfsadm -c disk.option -C to clear driver.This command won't cover usb drive.

note : reboot -- cdrom will pass cdrom to command boot in ok prompt and boot system by cdrom

Monday 21 April 2008

How to perform system shutdown (Solaris)

The commands avaliable to the root user for dogin system shutdown procedures include:
- /sbin/init (using run level S,0,1,5 or 6)
- /usr/sbin/shutdown (using run level S,0,1,5 or 6)
on both command will execute the rc0 kill srcipts.
# init S
Shut down the system to single-user mode (either run level S or 1)
# init 0
Shutdown the system.On SPARC display the ok prompt,On X86/64 display "Press any key to reboot"
# init 5
Shut down the system and turn it power off.
# init 6
Shut down the system and then reboot to multi-user mode.
note : halt,poweroff and reboot command don't execute the rc0 kill script.

In oder to boot the system to a specific milestone
SPARC platform
ok> boot -m milestone=[mile_stone]
X86/64 platform
edit system boot menu multiboot
grub edit> kernel /platform/i86pc/multiboot -m milestone=[mile_stone]

Recovery /etc/system file
If boot process fail because of an unusable /etc/system file.
SPARC platform
ok> boot -a
x86/64 platform
grub edit> kernal /platform/i86pc/multiboot -a
Both platform on menu "Name of system file [/etc/system] : " use your backup /etc/system or /dev/null

Clear boot-archive
If your system shutdown not properly such as power off system without shutdown solaris.
clear boot-archive
# svcadm clear system/boot-archive
# init 6

Solaris Troubleshooting : http://www.princeton.edu/~unix/Solaris/troubleshoot/index.html , http://www.sun.drydog.com/faq/7.html

How to create and maintain ufs file system(Solaris)

Creating a New ufs file system
To create a ufs file system,by using the newfs command.
# newfs /dev/rdsk/c1t0d0s0
newfs will ask for comfirmation.To proceed,type y,to terminate,type n.
note : newfs with option -T on smaller file systems that will contain many small files.
warning : newfs with boot slices(s0) or entry slice(s2) may be cause system fail.please use this command carefully.

Checking the File system
fsck , checks the data consistency of a file system and attempts to correct or repair any consistencies or damage found.
# fsck /dev/rdsk/c1t0d0s0
note : option -y to response "yes" every time.

Recovery SuperBlocks
If the fsck command fail because of a corrupted superblock, you can see a message "BAD SUPERBLOCK AT BLOCK #: MAGIC NUMBER WRONG"
you can recovery superblock by using backup superblocks.
# fsck -o b=32 /dev/rdsk/c1t0d0s0
for find another backup superblocks
# newfs -N /dev/rdsk/c1t0d0s0
note : use newfs -N -T,It you use newfs -T to create ufs file system

Monitoring File System Use
df command - Displays the number of free disk blocks
du command - Summarizes disk use
quot command - Summarizes file system ownership

Saturday 19 April 2008

How to define slices on a SPARC and x86/64 system (Solaris)

x86/64 systems require the additional steps to create a Solaris fdisk partition before you can create slices within that partition.SPARC systems don't use fdisk partition.
This is short note.you can see more detail on solaris website.

1. Use format utility
# format
Identify the correct disk.
2. use fdisk menu in the format utility to create the fdisk partitions(SPARC system don't use fdisk partition)
3. use partition menu in the format utility to divide the disk or Solaris fdisk partition into slices.
4. Label the disk or Solaris fdisk partition with new slice information

Viewing the VTOC
- Use verify command in the format utility
- prtvtoc command from command line.

Replacing VTOC on disk
prtvtoc to save VTOC to file
# prtvtoc /dev/rdsk/c1t1d0s2 > /var/tmp/c1t1d0s2.vtoc
fmthard command to replace the VTOC to recover
# fmthard -s /var/tmp/c1t1d0s2.vtoc /dev/rdsk/c1t1d0s2
nort : use /dev/null instead backup vtoc file to initialize the VTOC of a disk

Viewing the fdisk partition table

This procedure only pertains to x86/64 systems.
# fdisk -W - /dev/rdsk/c1t1d0s2
option - to print to console

Replacing fdisk partition table
Write fdisk table to file
# fdisk -W /var/tmp/c1t1d0s2.fdisk /dev/rdsk/c1t1d0s2
Load fdisk table from file to disk
# fdisk -F /var/tmp/c1t1d0s2.fdisk /dev/rdsk/c1t1d0s2

more information
Device and file system : http://docs.sun.com/app/docs/doc/817-5093?l=en
format utility : http://docs.sun.com/app/docs/doc/817-5093/disksformat-15833?l=en&a=view
prtvtoc command : http://docs.sun.com/app/docs/doc/816-5166/6mbb1kqcj?l=en&a=view
fmthard command : http://docs.sun.com/app/docs/doc/817-5440/6mkt7md5m?l=en&a=view

Thursday 17 April 2008

How to mount and un-mount file system (Solaris)

Identifying Mounted File Systems
The mount command : show content of /etc/mnttab file (Don't be edited)

Mounting File System
The /usr/sbin/mount command
Format : mount [dev_name] [mount_point]
ex. mount /dev/dsk/c0t0d0s7 /export/home
note : /mnt is default mount point that create by system

Automatic Mounting of File Systems
On Solaris add the file system(s) to the /etc/vfstab file(On RHEL use /etc/fstab file).The file format includes seven fields per line entry, each field is separated by a TAB.A - (dash) character and empty field.

Un-mount File System
The /usr/sbin/umount command
Format : umount [mount_point]
note : umount -f mount_point is force option with umount.The file system is unmounted even if there are open files.

Step to mount file system from Remote host

Step 1 configure domain name.
# domainname DOMAIN

Step 2 Add host of server to /etc/hosts.
# vi /etc/hosts
Add this list to file:
#ip_address hostname
192.168.1.1 NFS_SERVER

Step 3 Add line to /etc/vfstab.
# vi /etc/vfstab
Add this list to file:
NFS_SERVER:/export/home - /export/home nfs - yes rw,soft,bg
note : RHEL use /etc/fstab
NFS_SERVER:/export/home /export/home nfs auto 0 0

Step 4 Create directory /export/home (mount_point).
# mkdir -p /export/home

Step 5 Mount directory for NFS.
# mount /export/home

Step 6 Check mount.
# df –k

Step 7 Reboot.
# init 6

Step 8 Check mount again.

Wednesday 16 April 2008

How to Change the IPv4 Address and Other Network Configuration Parameters (Solaris)

Modifying the IPv4 Address and Other Network Parameters to Persist Across Reboots

This example shows how to change the following network parameters of a system that is moved to another subnet:
IP address for the primary network interface eri0 changes from 192.168.7.11 to 192.168.8.12
Host name changes from RFATEST11 to RFATEST12
Netmask changes from 255.255.255192 to 255.255.255.0
Default router address changes to 192.168.8.254

Check the system's current status:

# hostname
RFATEST11
# ifconfig -a
lo0: flags=1000849 mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
eri0: flags=1000843 mtu 1500 index 2
inet 192.168.7.11 netmask ffffffc0 broadcast 192.168.7.63
ether 8:0:20:c1:8b:c3

Next, change the system's host name and the IP address of eri0 in the appropriate files:

# vi /etc/nodename
RFATEST12

In Solaris 10 11/06 and earlier Solaris 10 releases

# vi /etc/inet/ipnodes
192.168.8.12 RFATEST12 #moved system to 192.168.8 net
# vi /etc/inet/hosts
#
# Internet host table
#
127.0.0.1 localhost
192.168.8.12 RFATEST12 loghost
# vi /etc/hostname.eri0
192.168.8.12netmask + 255.255.255.0

Finally, change the netmask and the IP address of the default router.

# vi /etc/netmasks.
.
.
192.168.8.0 255.255.255.0
# vi /etc/defaultrouter
192.168.8.254 #moved system to 192.168.8 net#

After making these changes, reboot the system.

# reboot -- -r
V
erify that the configuration you just set is maintained after the reboot:

# hostname
RFATEST12
# ifconfig -a

lo0: flags=1000849 mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
eri0: flags=1000843 mtu 1500 index 2
inet 192.168.8.12 netmask ffffff00 broadcast 192.168.8.255
ether 8:0:20:c1:8b:c3

reference : http://docs.sun.com/app/docs/doc/816-4554/gbwxb?a=view
script : http://www.sun.com/bigadmin/jsp/descFile.jsp?url=descAll/change_iphostname&cid=e5595

How to config dhcp client on Linux

By Editing configure file
Configure file /etc/sysconfig/network
Edit line : NETWORKING=yes
Configure file /etc/sysconfig/network-scripts/ifcfg-eth0 should contain the following lines:
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes

By use Configuration Tools
Use command setup
# setup
Choose menu Network configuration
Choose your Device
Mark on menu Use DHCP
OK and exit Tools

Linux renew ip command
The -r flag explicitly releases the current lease, and once the lease has been released, the client exits. For example, open terminal and type the command:
$ sudo dhclient -r
Now obtain fresh IP:
$ sudo dhclient
There is no need to restart network service. Above command should work with any Linux such as RHEL, Fedora, CentOS, Ubuntu and others. On a related note you can also try out the following commands:
# ifdown eth0
# ifup eth0
# /etc/init.d/network restart

How to change the hostname of a Linux system

Change the hostname on a running
On any Linux system you can change its hostname with the command ‘hostname‘

#hostname NEW_NAME

will set the hostname of the system to NEW_NAME. This is active right away and will remain like that until the system will be rebooted (because at system boot it will set this from some particular file configurations - see bellow how to set this permanently). You will most probably need to exit the current shell in order to see the change in your shell prompt.

Permanent hostname change on Debian based systems
Debian based systems use the file /etc/hostname to read the hostname of the system at boot time and set it up using the init script /etc/init.d/hostname.sh

#vi /etc/hostname
NEW_NAME

So on a Debian based system we can edit the file /etc/hostname and change the name of the system and then run:

#/etc/init.d/hostname.sh start

to make the change active. The hostname saved in this file (/etc/hostname) will be preserved on system reboot (and will be set using the same script we used hostname.sh).

Permanent hostname change on RedHat based systems
RedHat based system use the file /etc/sysconfig/network to read the saved hostname at system boot. This is set using the init script /etc/rc.d/rc.sysinit

#vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=”NEW_NAME”
GATEWAY=”192.168.0.1″
GATEWAYDEV=”eth0″
FORWARD_IPV4=”yes”

So in order to preserve your change on system reboot edit this file and enter the appropriate name using the HOSTNAME variable.

reference : http://www.ducea.com/2006/08/07/how-to-change-the-hostname-of-a-linux-system/