Tuesday, 18 September 2018

solaris 11 command

Configure nodename
# hostname myhost
Configure nameserver via SMF
# svccfg -s dns/client \
setprop config/nameserver = net_address: 192.168.1.1
# svccfg -s dns/client \
setprop config/domain = astring: \"myhost.org\"
# svccfg -s name-service/switch \
setprop config/host = astring: \"files dns\"
# svcadm restart name-service/switch
# svcadm restart dns/client
Configure nameserver via SMF when you can’t remember the correct properties to edit.
# svccfg -s dns/client editprop
# svccfg -s name-service/switch editprop
Configure nameserver (alternate approach by editing /etc/resolv.conf and
/etc/nsswitch.conf and then importing these modifications into SMF.)
# nscfg import -f svc:/system/name-service/switch:default
# nscfg import -f svc:/network/dns/client:default
nscfg is a transition tool and not meant for daily use, not matter how useful it is. Please learn the
regular way with the methods described above.
Unconfigure a system and start an interactive configuration tool on reboot
# sysconfig configure -s
Create a system configuration profile
# sysconfig create-profile -o sc-profile.xml
Configure a system according to a system configuration profile
# sysconfig configure -c sc-profile.xml


Users and Roles
The traditional root account has been changed to a ’root’ role on all Oracle Solaris 11
installations as part of the Role Based Access Control (RBAC) feature set. This change gives
improved auditability across the operating system, and the ability for administrators to delegate
various system tasks to others in a safe way.
Revert root to a normal user account
# rolemod -K type=normal root
Configure root as a role (default)
# usermod -K type=role root
Configure root role to use the user password instead of root password
# rolemod -K roleauth=user root
Add a new user and delegate the System Adminstrator profile to the user
# useradd -m -P "System Administrator" joerg
Add a new user with a ZFS file system as the user’s home directory and add an entry in
auto_home
# useradd -m -d localhost:/export/home/joerg2 joerg2
# grep "joerg2" /etc/passwd
joerg2:x:101:10::/home/joerg2:/usr/bin/bash
# cat /etc/auto_home
[...]
joerg2 localhost:/export/home/joerg2
+auto_home
# zfs list | grep joerg2
rpool/export/home/joerg 35K 201G 35K /export/home/joerg2
Add a new user on a second server using another NFS server for the user’s home
directory
# useradd -d nfsserver:/export/home/joerg2 joerg2
# grep "joerg2" /etc/passwd
joerg2:x:103:10::/home/joerg2:/usr/bin/bash
# tail -2 /etc/auto_home

Packaging

Install a package called diagnostic/wireshark:
# pkg install diagnostic/wireshark
Install a group package to provide a desktop environment
# pkg install solaris-desktop
Install package as if you were installing it on a freshly installed system
Warning! All packages that are not a dependency of this package will be removed while installing it.
This is what the command is meant for.
# pkg exact-install web/server/apache-22/module/apache-wsgi-26
Update all possible packages to the newest version, including any zones
# pkg update
List available packages
# pkg list -a
Do a dry run of a system update to identify what packages might change
# pkg update -nv
Uninstall a package called diagnostic/wireshark
# pkg uninstall wireshark
List all packages installed on a system:
# pkg list
Get more information about an installed package called diagnostic/wireshark
# pkg info wireshark
List the contents of an installed package called diagnostic/wireshark
# pkg contents wireshark
Search all packages in the configured repositories for a file called math.h
# pkg search math.h
Search for all packages installed on a system that have a dependency on
library/libxml2:
# pkg search -l -o pkg.name 'depend::library/libxml2'
List currently associated package publishers
# pkg publisher
Connect to the Oracle support repository and update the system
# pkg set-publisher -g https://pkg.oracle.com/solaris/support \
-G http://pkg.oracle.com/solaris/release -k /path/to/ssl_key \
-c /path/to/ssl_cert solaris
# pkg update

Local Package Repository

Download all the repository files from
http://www.oracle.com/technetwork/server-storage/solaris11/downloads/local-repository-2245081.html
into /export/home/<username>.
# zfs create rpool/export/repo
# zfs create rpool/export/repo/solaris
# cd /export/home/<username>
# ./install-repo.ksh -d /export/repo/solaris/
# zfs snapshot rpool/export/repo/solaris@initial
Setting up a depot server to enable other systems to update themself via HTTP
# svccfg -s application/pkg/server setprop
pkg/inst_root=/export/repo/solaris/
# svccfg -s application/pkg/server setprop pkg/readonly=true
# svccfg -s application/pkg/server setprop pkg/port=8081
# svcadm refresh application/pkg/server
# svcadm enable application/pkg/server


# cd /export/home/<username>/sru9
# unzip p20845983_1100_SOLARIS64.zip
# ./install-repo.ksh -d /export/repo/solaris
# svcadm restart application/pkg/server:default
# zfs snapshot rpool/export/repo/solaris@sru9


File Systems - Basic ZFS Administration 

Create a ZFS pool with a single disk
# zpool create testpool c3t2d0
Create a ZFS pool with 3 disks in RAID0 configuration
# zpool create testpool c3t2d0 c3t3d0 c3t4d0
Create a ZFS pool with 3 disks in RAID1 configuration
# zpool create testpool mirror c3t2d0 c3t3d0 c3t4d0
Create a ZFS pool with 3 disks in a RAIDZ configuration (single parity)
# zpool create testpool raidz c2t2d0 c3t3d0 c3t4d0
Create a ZFS pool with 1 disk and 1 disk as seperate ZIL (ZFS Intent Log)
# zpool create testpool c3t2d0 log c3t3d0
Create a ZFS pool with 1 disk and 1 disk as L2ARC (Level 2 Storage Cache)
# zpool create testpool c3t2d0 cache c3t3d0
Create a ZFS file system and share it via NFS:
# zfs create rpool/export/nfstest
# zfs set share.nfs=on rpool/export/nfstest
Share a files system via CIFS
# svcadm enable -r smb/server
# echo "other password required pam_smb_passwd.so.1 nowarn" \
>> /etc/pam.d/other
# passwd <username>
# zfs create -o nbmand=on rpool/export/smbservertest
# zfs share -o share.smb=on rpool/export/smbservertest%smb_st
# mkdir /export/smbservertest/archiv
# chown junior2 /export/smbservertest/archiv
Now you can access the share via smb://junior2:password@192.168.1.200/smb_st . You
have to set a new password for each user that wants to access a SMB share after adding the PAM
module
Use shadow migration
# pkg install shadow-migration
# svcadm enable shadowd
# zfs set readonly=on rpool/export/shadowmigtest
# zfs create \
-o shadow=file:///export/shadowmigtest rpool/export/shadowmigtestnew
Create an encrypted zfs dataset
# zfs create -o encryption=on rpool/export/secretproject
Change the wrapping key
# zfs key -c rpool/export/secretproject
Change the encryption key of a dataset
Please keep in mind that you can't set the encryption key to a user-defined value, you just can
initiate the generation of a new encryption key. The wrapping key encrypting the encrytion key can
be set to a user definable value.
# zfs key -K rpool/export/secretproject
How to limit the ZFS ARC cache (up to Oracle Solaris 11.1)
# echo "set zfs:zfs_arc_max=0x40000000" >> /etc/system
# reboot
How to limit the ZFS ARC cache (since Oracle Solaris 11.2)
# echo "set user_reserve_hint_pct=80" > /etc/system.d/arclimit
# reboot
The user_reserve_hint_pct parameter works differently than the old zfs_arc_max
parameter. This parameter doesn’t set a hard limit for the arc cache.This parameter defines
how much memory is reserved for application use. It therefore limits how much memory can
be used by the ZFS ARC cache.
This value is dynamic. So you can change this parameter while the system is running.
However it’s a best practice to change it to it in small steps to it’s intended final value. There is
a script doing it this way available with the MOS note 1663862.1.
You can get the current value of the parameter by using:

Disk Devices

Show all disks on a system
# cfgadm -s "select=type(disk)"
Replace a faulty disk c1t1d0 from ZFS pool testpool
# zpool offline testpool c1t3d0
# cfgadm | grep c1t3d0
sata0/3::dsk/c1t3d0 disk connected configured ok
# cfgadm -c unconfigure sata0/3
# echo "Now replace the failed disk"
# cfgadm -c configure sata0/3
# zpool replace tank c1t3d0
# zpool online tank c1t3d0

Replace a faulty disk of a ZFS rool pool (SPARC or x86/VTOC)
You have to ensure that your new disk contain a fdisk partition (on x86), a SMI label and a slice 0.
# zpool offline rpool c1t0d0s0
# cfgadm -c unconfigure c1::dsk/c1t0d0
# echo "now replace the disk"
# cfgadm -c configure c1::dsk/c1t0d0
# zpool replace rpool c1t0d0s0
# zpool online rpool c1t0d0s0
# zpool status rpool
# bootadm install-bootloader
Replace a faulty disk of a ZFS root pool (SPARC or x86/EFI (GPT))
# zpool offline rpool c1t0d0
# cfgadm -c unconfigure c1::dsk/c1t0d0
# echo "now replace the disk"
# cfgadm -c configure c1::dsk/c1t0d0
# zpool online rpool c1t0d0
# zpool replace rpool c1t0d0
# zpool status rpool
# bootadm install-bootloader
Checking the logical blocksize of a disk device
# devprop -vn /dev/dsk/c3t0d0 device-blksize
Checking the physical blocksize of a disk device
# devprop -vn /dev/dsk/c3t0d0 device-pblksize

zpool expand:

#  zpool set autoexpand=on BARMAN

No comments:

Post a Comment