Tuesday, 21 April 2015

How to Update Oracle Solaris 11 Systems From Oracle Support Repositories

Download key and certificate files from oracle support from below link

https://pkg-register.oracle.com/register/certificate/

-rw-r--r--   1 root     root         920 Apr 20 19:33 pkg.oracle.com.certificate.pem
-rw-r--r--   1 root     root        1675 Apr 20 19:33 pkg.oracle.com.key.pem

copy two file into /var/pkg/ssl location

root@IPS# cp -p *.pem /var/pkg/ssl

update package repository

root@IPS# pkg set-publisher  -k /var/pkg/ssl/pkg.oracle.com.key.pem -c /var/pkg/ssl/pkg.oracle.com.certificate.pem -O https://pkg.oracle.com/solaris/support solaris



Friday, 17 April 2015

How to migrate live solaris 8 and 9 to branded non-global zone

Create flar file on live solaris 8 server using flar command

Solaris8@root# flarcreate -n solaris8 -R /  /mnt/oscopy/sol8bz.flar

Software Requirements for branded zone
1. Make sure the release of Solaris 10 Global zone is equal to or higher than Solaris 10_U6.

On solaris 10 servers first install below patch before creating branded zone
V24150-01.zip
Solaris10@root#cd /var/tmp/solarislegacycontainers/1.0/Product/1.0.1
Solaris10@root# pkgadd –d . <install both packages >
Solaris10@root#

Creating the branded zone


Solaris10@root#zonecfg –z sol8bz
zonecfg: sol8bz> create –t SUNWsolaris8
Zonecfg: sol8bz>set zonepath=/u01/sol8bz
Zonecfg: sol8bz>set  autoboot=true
Zonecfg: sol8bz>add net
Zonecfg: sol8bz:net>set  address=192.168.162.5
Zonecfg: sol8bz:net>add physical=vnet0
Zonecfg: sol8bz:net>end
Zonecfg: sol8bz>verify
Zonecfg: sol8bz>commit

Copy flar file into solaris 10 server

Solaris10@root#scp solaris8: /mnt/oscopy/sol8bz.flar  /u01

Solaris10@root#zoneadm –z sol8bz install –u –a /u01/sol8bz.flar
Solaris10@root# zoneadm -z sol8bz boot



Thursday, 16 April 2015

Unable to winscp in solaris 11

Add below lines in /etc/ssh/sshd_config and restart the services

Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour128,arcfour256,arcfour,3des-cbc

svcadm restart ssh

Wednesday, 15 April 2015

How to create local repository server

Oracle Solaris 11 software is distributed in Image Packaging System (IPS) packages. IPS packages are stored in IPS package repositories, which are populated by IPS publishers.

How to create local repository server


Create zfs filesystem

zpool create -f  newpool c8t0d0s1 c8t0d0s2

zfs set canmount=off newpool

zfs create newpool/repo

Create local repostory

svccfg -s application/pkg/server setprop pkg/inst_root=/newpool/repo/repo

svccfg -s application/pkg/server setprop pkg/readonly=true

svcadm refresh application/pkg/server

svcadm enable application/pkg/server

svccfg -s application/pkg/server setprop pkg/port=10000

svcadm refresh application/pkg/server

pkg set-publisher -G "*" -g /newpool/repo/repo solaris


On client side

root@test2:~# pkg set-publisher -G "*" -g http://10.66.10.156:10000 solaris


root@test2:~# pkg publisher
PUBLISHER                   TYPE     STATUS P LOCATION

solaris                     origin   online F http://10.66.10.156:10000/

Update your local repository

Make sure your repository server is running the same or a newer version of the Oracle Solaris 11 OS as the version for which the packages you plan to copy are built. For example, if the server is running Oracle Solaris 11 and you want to update your repository to the Oracle Solaris 11 Update 1 repository, update the server to Oracle Solaris 11 Update 1 before you update your repository.
Whether you used the pkgrecv command or .iso files to create your local IPS package repository

root@test2:~# pkgrecv -s http://pkg.oracle.com/solaris/release/ -d /newpool/repo/repo '*'

root@test2:~# pkgrepo -s /newpool/repo/repo refresh




beadm in solaris 11

If you want to create a backup of an existing boot environment, for example, prior to modifying the original boot environment, you can use the beadm command to create and mount a new boot environment that is a clone of your active boot environment.

Create the boot environment.

root@solaris:/etc/security# beadm create mybe

List the available  boot environments

root@solaris:/etc/security# beadm list
BE               Active Mountpoint Space  Policy Created
--               ------ ---------- -----  ------ -------
mybe             -      -          86.0K  static 2013-07-22 19:04
solaris          NR     /          8.36G  static 2013-07-18 12:08
solaris-backup-1 -      -          251.0K static 2013-07-19 19:19
solaris-backup-2 -      -          248.0K static 2013-07-19 19:25

Activate the boot environment.

root@solaris:/etc/security# beadm activate mybe
root@solaris:/etc/security# beadm list
BE               Active Mountpoint Space  Policy Created
--               ------ ---------- -----  ------ -------
mybe             R      -          8.36G  static 2013-07-22 19:04
solaris          N      /          595.0K static 2013-07-18 12:08
solaris-backup-1 -      -          251.0K static 2013-07-19 19:19
solaris-backup-2 -      -          248.0K static 2013-07-19 19:25

Use the beadm mount command to mount the new boot environment.

root@solaris:/etc/security# beadm mount mybe /a

Boot the server using boot environments from ok prompt

ok boot -L

To boot a specified entry, type the number of the entry and press Return:
Select environment to boot: [1 - 2]:

boot -Z rpool/ROOT/mybe

To display the boot path for the active BE, type:

prtconf -vp | grep bootpath


Monday, 13 April 2015

Append a line using sed

Below command append ":x" after first field
ypcat -k passwd|grep -i testuser|cut -d':' -f2-9|sed 's/^..//'|sed 's/:/:x:/1'

How to change screen resolutions and pixels of VNC

su - test1234 -c "/usr/local/bin/vncserver :7 -geometry 1280x1024 -pixelformat rgb565 -depth 8 -cc 3 2>/dev/null"

How to move files from source to destination with directory structure

#!/bin/bash

folder=<source>
cd $folder
find . -mtime +365 -type f -print |sed 's|./||'| while read file
do
echo $file
echo $( dirname $file )
dirname1=$( dirname $file )
#dirname2=`sed 's/^.//1' $dirname1`
echo $dirname1
echo "####################################################################"
#echo $dirname2
echo "=========================================="
#echo $( dirname1 $file )
# echo mkdir -p <destination>$( dirname1 $file )
mkdir -p <destination>/$dirname1
#    echo  <destination>/$dirname1
mv $file<destination>/$dirname1
done

Some useful vi editor commands

1) How to delete every last char on each line in vi ?
:%s/.$//g

2) How to change capital to small characters using vi ?

%s/.*/\L&/  

3) How to remove empty lines ?


:g/^\s*$/d