Skip to main content

Oracle Solaris 11 Cheat Sheet


Create an install service from a downloaded ISO file, specifying x86 based DHCP client starting at address 192.168.1.210 with a total count of 10 addresses:

# installadm create-service -n s11x86 -i 192.168.1.210 -c 10 –s /path/to/solaris-11-1111-ai-x86.iso

List all enabled services:

# installadm list

List any installation manifests associated with the install services:

# installadm list -m

Export the default installation manifest associated with the  s11x86 service:

# installadm export -n s11x86 -m orig_default > manifest.xml

Import a manifest to be associated with the s11x86 service:

# installadm update-manifest -n s11x86 -m orig_default -f manifest.xml

List any system configuration profiles associated with the install services:

# installadm list -p

Create a system configuration profile interactively, saving the contents to a file:

# sysconfig create-profile -o profile.xml

Validate a system configuration profile against the default x86 install service:

# installadm validate -n default-i386 -P profile.xml

Associate a system configuration profile with the deafult x86 install service and give it a name sc-profile:

# installadm create-profile -n default-i386 -f profile.xml -p sc-profile

Apply a criteria that all clients must have 4096MB memory or greater to the manifest s11manifest of s11x86 service:

# installadm set-criteria -m s11manifest -n s11x86 -a MEM="4096-unbounded"


Configuring nodename:

# svccfg –s svc:/system/identity:node setprop config/nodename = “myhost”

# svcadm refresh svc:/system/identity:node

# svcadm restart svc:/system/identity:node

Configuring console keyboard layout:

# svccfg –s keymap:default setprop keymap/layout = UK-English

# svcadm refresh keymap

# svcadm restart keymap

 

Configuring system locale:

# svccfg –s timezone:default setprop timezone/localtime = astring: US/Mountain

# svcadm refresh timezone:default

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

Create a boot environment:

# beadm create solaris-05032012

Activate a boot environment:

# beadm activate solaris-05032012

Delete a boot environment:

#beadm destroy solaris-05032012

Show boot environments from SPARC boot PROM:

ok boot -L

Boot into a boot environment from SPARC boot PROM:

ok boot -Z rpool/ROOT/solaris-05032012

Install a package called diagnostic/wireshark:

# pkg install diagnostic/wireshark

Install a group package to provide a desktop environment:

# pkg install solaris-desktop

Update all possible packages to the newest version, including any zones:

# pkg update

Do a dry run of a system update to understand what packages may 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

List all running zones verbosely:

# zoneadm list -v

List all configured zones:

# zoneadm list -c

List all installed zones:

# zoneadm list -i

Install a zone:

#zoneadm -z testzone install

Boot a zone:

#zoneadm -z testzone boot

List configuration about a zone:

#zoneadm -z testzone list

Login to a zone:

# zlogin -C testzone

Halt a zone

# zoneadm -z testzone halt

Shutdown a zone

# zoneadm -z testzone shutdown


Monitor a zone for CPU, memory and network utilization every 10 seconds:

# zonestat -z testzone 10

List processes associated with the network/netcfg service:

# svcs -p network/netcfg

Show why services that are enabled but are not running, or preventing other services from running:

# svcs -xv

Enable a service called network/dns/client:

# svcadm enable network/dns/client

Restart a service called network/nfs/server using an abbreviated FMRI:

# svcadm restart nfs/server

Disable a service called network/ssh:

# svcadm disable network/ssh

Display all properties and values in the SMF configuration repository for the service network/ssh:

# svcprop network/ssh

Interactively display the general/enabled property within the SMF configuration repository for the service network/ssh:

# svccfg

svc:> select ssh:default

svc:/network/ssh:default> listprop general/enabled

svc:/network/ssh:default> exit

Set the port number of the application/pkg/server service to 10000:

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

# svcadm refresh application/pkg/server

Configure email notifications for all services that drop from online to maintenance state

# svccfg setnotify -g from-online,to-maintenance \

mailto:admin@myhost.org

List all configuration changes that have been made in the SMF configuration

repository to the

name-service/switch service:

# svccfg -s name-service/switch listcust -L

File systems – Basic ZFS Administration

Oracle Solaris ZFS is the default root file system on Oracle Solaris 11. ZFS has integrated

volume management, preserves the highest levels of data integrity and includes a wide

variety of data services such as data deduplication, RAID and data encryption.

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


Share a filesystem via NFS:

# zfs create zpool/fs1

# zfs set share=name=fs1,path=/rpool/fs1,prot=nfs rpool/fs1

# zfs set sharenfs=on rpool/fs1

Share a filesystem via CIFS:

# pkg install service/filesystem/smb
# svcadm enable -r smb/server
# echo "other password required pam_smb_passwd.so.1 nowarn" >> /etc/pam.conf
# smbadm enable-user joerg
# zfs set share=name=sh1,path=/rpool/fs1,prot=smb rpool/fs1
# zfs set sharesmb=on rpool/fs1

Use shadow migration: pkg install shadow-migration

# svcadm enable shadowd

 

# zfs set readonly=on path/to/data

 

# zfs create -o shadoow=file:///path/to/data \


target/new/path/to/data



Disk Devices

Show all disks on a system:

# cfgadm -s "select=type(disk)"

 

Configure a disk to be used via iSCSI

# svcadm enable svc:/network/iscsi/initiator

# iscsiadm modify initiator-node -A myclient

# iscsiadm add discovery-address 10.211.55.200

# iscsiadm discovery -t enable

# devfsadm -c iscsi

Replace a faulty disk

c1t1d0 from ZFS pool testpool:

# zpool offline testpool c1t1d0

# cfgadm -c unconfigure c1::dsk/c1t1d0

# cfgadm -c configure c1::dsk/c1t1d0

# zpool replace testpool c1t1d0

# zpool online testpool c1t1d0




Mirror existing boot disk c3t0d0s0 with disk c3t2d0s0

 

# fdisk -B c3t2d0s0

# prvtoc /dev/rdsk/c3t0d0s0 | fmthard -s - /dev/rdsk/c3t2d0s0

On x86 systems:

# installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c3t2d0s0

On SPARC systems:
#installboot -F zfs \

/usr/platform/`uname -i`/lib/fs/zfs/bootblk/dev/rdsk/c3t2d0s0


Networking

– Manual Administration

Switch to manual network configuration:

# netadm enable –p ncp defaultfixed

Show physical network interfaces:

# dladm show-phys

Create interface with static IPv4 configuration:

# ipadm create-ip net0
# ipadm create-addr –T static –a local=10.9.8.7/24 net0/addr
# ipadm show-addr

Create interface with DHCP configuration:

# ipadm create-ip net0
# ipadm create-addr –T dhcp net0/addr

Create interface with auto-generated IPv6 configuration:

 
# ipadm create-ip net0
# ipadm create-addr –T addrconf net0/addr

Configure default route:

 

# route –p add default 192.168.1.1




Activate DNS configuration:
 

# svccfg –s dns/client setprop config/nameserver = net_address: 192.168.1.1
# svccfg –s dns/client setprop config/domain = astring: “myhost.org”
#vccfg –s name-service/switch setprop config/host = astring: \“files dns\”
# svcadm refresh name-service/switch
# svcadm refresh dns/client



Activate DNS configuration (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


# svcadm refresh dns/client


Create a network configuration profile:

 

# netcfg create ncp datacenter

 

# netcfg
netcfg> select ncp datacenter
netcfg:ncp:datacenter> create ncu phys net0
Created ncu ‘net0’. Walking properties ...
ip-version (ipv4,ipv6) [ipv4|ipv6]> ipv4
ipv4-addsrc (dhcp) [dhcp|static]> static
ipv4-addr> 192.168.1.27
ipv4-default-route> 192.168.1.1
netcfg:ncp:datacenter:ncu:net0> end
Committed changes
netcfg:ncp:datacenter> exit




Create a network location profile:
 

# netcfg
netcfg> create loc datacenter
Created loc 'datacenter'. Walking properties ...
activation-mode (manual) [manual|conditional-any|conditionalall]>
conditional-any
conditions> ip-address is 192.168.1.27
nameservices (dns) [dns|files|nis|ldap] dns
nameservices-config-file ("/etc/nsswitch.dns")>
dns-nameservice-configsrc (dhcp) [manual|dhcp]> manual
dns-nameservice-domain> datacenter.myhost.org
dns-nameservice-servers> 192.168.1.1
dns-nameservice-search>
dns-nameservice-sortlist>
dns-nameservice-options>
nfsv4-domain>
ipfilter-config-file>
ipfilter-v6-config-file>
ipnat-config-file>
ippool-config-file>
ike-config-file>
ipsecpolicy-config-file>
netcfg:loc:datacenter>
netcfg:loc:datacenter> exit
Committed changes

Activate a network configuration profile:

# netadm enable -p ncp datacenter

Create a virtual network interface over existing physical interface net0 with address 192.168.0.80:

# dladm create-vnic -l net0 vnic0

# ipadm create-ip vnic0

# ipadm create-addr -T static -a 192.168.0.80 vnic0/v4

Create two virtual network interfaces over a virtual switch (without a physical network interface):

# dladm create-etherstub stub0

# dladm create-vnic -l stub0 vnic0

# dladm create-vnic -l stub0 vnic1

Reduce the bandwidth of the virtual network interface vnic0 to 100Mbps:

# dladm set-linkprop -p maxbw=100 vnic0

Restrict the bandwidth going to IP address 192.168.0.30 by creating a flow on virtual

 

network interface

vnic0, then restrict its bandwidth to 50Mbps:

# flowadm add-flow -l vnic0 -a remote_ip=192.168.0.30 flow0

# flowadm set-flowprop -p maxbw=50 flow0

Restrict network traffic to TCP for a local port 443 for network interface net0:

# flowadm add-flow -l net0 -a transport=TCP,local_port=433 flow0

Activating Jumbo Frames (ethernet packets greater than 1500 bytes):

# dladm set-linkprop -p mtu=9000 net0

Configure Link Aggregation:

# dladm create-aggr -l net0 -l net1 aggr0

# ipadm create-ip aggr0

# ipadm create-addr -T static -a 10.1.1.2/24 aggr0/v4

Configure VLANS:

# dladm create-vlan -l net0 -v 100 administration1

# dladm create-vlan -l net0 -v 2 production1

# ipadm create-ip administration1

# ipadm create-ip production1

# ipadm create-addr -T static -a 192.168.2.2/24 administration1/v4static
 
# ipadm create-addr -T static -a 192.168.1.2/24production1/v4static


Configure an IPMP group:

# ipadm create-ip net0

# ipadm create-ip net1

# ipadm create-ip net2

# ipadm create-ipmp ipmp0

#ipadm add-ipmp -i net0 -i net1 -i net2 ipmp0

# ipadm create-addr -T static -a 192.168.1.27/24 ipmp0/v4

# ipadm create-addr -T static -a 192.168.1.50/24 net0/test

# ipadm create-addr -T static -a 192.168.1.51/24 net1/test

# ipadm create-addr -T static -a 192.168.1.52/24 net2/test

 

Comments

Last Week Topics

How to break a bonded network interface red hat

1.- Bonding device called bond0 which aggregated by eth0 and eth1 # ifconfig bond0     Link encap:Ethernet  HWaddr 44:a8:42:5d:6d:5d           inet addr:192.168.1.51  Bcast:192.168.1.255  Mask:255.255.255.0           inet6 addr: fe80::5054:ff:fe4d:9004/64 Scope:Link           UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1 eth0      Link encap:Ethernet  HWaddr 44:a8:42:5d:6d:5d           UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1 eth2      Link encap:Ethernet  HWaddr 44:a8:42:5d:76:29           UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1           RX packets:6 errors:0 dropped:0 overruns:0 frame:0 # cat /proc/net/bonding/bond0 Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009) Bonding Mode: fault-tolerance (active-backup) Primary Slave: em1 (primary_reselect always) Currently Active Slave: em1 MII Status: up MII Polling Interval (ms): 50 Up Delay (ms): 0 Down Delay (ms): 0 Slave Interface: eth0 MII Status: up Speed: 10000

HOW TO ADD A LINE WITH ANSIBLE WITH TAB SPACE IN A FILE

-bash-4.2# vi add_line_syslog.yml --- - name: script in order to add in the server list below with TAB spaces a Line in the SYSLOG CONF   hosts: oraking   tasks:     - name: Add a Line  in /etc/syslog.conf in order to delivery that information to another server       lineinfile:         path: /etc/syslog.conf         line: " *.err;auth.notice;auth.info;local0.info \t\t @10.10.10.200 "         insertbefore: ' \*.alert;kern.err;daemon.err '     - name: Restart system-log       command: /usr/sbin/svcadm restart svc:/system/system-log:default

How to configure publisher and install packages in Oracle Solaris 11

Connect to Oracle Support and Download the certificates Set proxy if you have one  #export https_proxy=https://usuario:password@191.118.2.110:8080  #export http_proxy=http://usuario:password@191.118.2.110:8080 You can add in the profile this information in order to have them configured in the login 1.-Download the ssl certicates in order to install them in the server 2.-Create a directory /var/pkg/ssl. #mkdir -p 755  /var/pkg/ssl 3.-Copy or Move the cerrtificates  # cd /var/pkg/ssl/  # ls -ltr total 53 -rw-r--r--   1 root     root        1679 Mar 27 13:36 Oracle_Solaris_11_Support.key.pem -rw-r--r--   1 root     root         932 Mar 27 13:36 Oracle_Solaris_11_Support.certificate.pem 4.- # pkg set-publisher \  -k /var/pkg/ssl/Oracle_Solaris_11_Support.key.pem \ -c /var/pkg/ssl/Oracle_Solaris_11_Support.certificate.pem \ -g https://pkg.oracle.com/solaris/support/ \ -G http://pkg.oracle.com/solaris/release/ solaris   5.-Verify the new publisher  # pkg publ

HOW TO SHARE WITH ZFS A FILE SYSTEM IN SOLARIS 11

As root execute the following Create the pool #zpool create ztemp c0d0 Create ZFS  #zfs create ztemp/temp Mount ZFS  #zfs set mountpoint=/temp ztemp/temp Share ZFS with the option "sharenfs=on" #zfs set sharenfs=on ztemp/temp Share and Select the PATH and SERVERS that you need that mount the ZFS from the NFS Server in our case the servers are oracle1,oracle2 and oracle3 with Read and Write Options #zfs set share=name=temp,path=/temporario,prot=nfs,anon=0,rw=oracle1:oracle2:oracle3 ztemp/temp

How to install Explorer Data Collector 8.11 Solaris 11

1.-Download from Oracle Support MOS the patch 22783063 and unzip and run the command below p22783063_8111638_SOLARIS64.zip #./install_stb.sh -verbose Extracting the STB payload ... Determining the check sums ... Sourcing STB library file ... List of Services Tool Bundle Components:    Oracle Explorer Data Collector 8.11    Oracle Serial Number in EEPROM (SNEEP) 8.11    Service Tag (ST) packages    Oracle Autonomous Crashdump Tool 8.17 (ACT) Would you like to (I)nstall, (X)tract, or (E)xit ? (I by default) X  <-----Select Extract (X) Extracting components for Solaris 11/sparc ...  Extracting IPS repository  Extracting SVR4 packages for Service Tag (ST) packages  - Package 5.11_sparc/SUNWsthwreg.sparc.5.10.pkg extracted Extraction to /var/tmp/stb/extract done Removing STB installation area ...   2.- Now you have in the directory "/var/tmp/stb/extract" de ipsrepo  # cd /var/tmp/stb/extract rwxr-xr-x   3 102      staff          4 Mar  8 11:28 ipsrepo -rw-r--r-- 

Updating Solaris 11.X to 11.3 and SRU to 11.3.2.4.0

Updating Solaris 11.X to 11.3 Download Repository Certificate s accessing with MOS user https://pkg-register.oracle.com/register/certificate/ Upload them to the server and rename as below pkg.oracle.com.certificate.perm pkg.oracle.com.key.perm root@:~# pkg unset-publisher This option below delete the currently repository and add the new one root@:~# pkg set-publisher -k  /root/pkg.oracle.com.key.pem -c /root/pkg.oracle.com.certificate.pem -G "*" -g https://pkg.oracle.com/solaris/support/ solaris root@:~# pkg publisher PUBLISHER                   TYPE     STATUS P LOCATION solaris                     origin   online F http://pkg.oracle.com/solaris/support/ root@# pkg update Validate previous boot environment root@:~# beadm list BE      Flags Mountpoint Space  Policy Created --      ----- ---------- -----  ------ ------- solaris NR    /          12.58G static 2016-03-15 07:11 root@:~# root@:~# PHASE             

How to see all spfile parameters

SET LINESIZE 300 COLUMN name  FORMAT A30 COLUMN value FORMAT A60 COLUMN displayvalue FORMAT A60 SELECT sp.sid,        sp.name,        sp.value,        sp.display_value FROM   v$spparameter sp ORDER BY sp.name, sp.sid;

What is PaaS, IaaS and SaaS?

  Infrastructure Platform as a Service (iPaaS) Integration Platform as a Service (iPaaS) is a suite of cloud services enabling the development, execution, and governance of integration flows connecting any combination of on-premises and cloud-based processes, services, applications, and data within individuals or across multiple organizations.   Ease of use Comprehensive integration of toolsets   Level of support   Readiness to support protocols Flexibility Ability to process, clean, and transform data in formats like XML and JSON; Performance when handling large-scale data operations and concurrent executions; Support for real-time processing and batch data integration; Monitoring for failures, latency, resource utilization, and workflow performance;   Security mechanisms for access control, data encryption, and single sign-on integrations   Infrastructure as a Service (IaaS)     I s a business model that delivers IT infrastructure like computing, storage, and network resources on a p

How to Reset the Root Password of RHEL-7 / systemd

1) Boot your system and wait until the GRUB2 menu appears. 2) In the boot loader menu, highlight any entry and press e . 3) Find the line beginning with linux. At the end of this line, append the following: init=/bin/sh Or if you face a panic, instead of "ro" change to "rw" to sysroot as example below: rw init=/sysroot/bin/sh 4) Press F10 or Ctrl+X to boot the system using the options you just edited. Once the system boots, you will be presented with a shell prompt without having to enter any user name or password: sh-4.2# 5) Load the installed SELinux policy: sh-4.2# /usr/sbin/load_policy -i 6) Execute the following command to remount your root partition: sh4.2# mount -o remount,rw / 7) Reset the root password: Raw sh4.2# passwd root 9) Reboot the system. From now on, you will be able to log in as the root user using the new password set up during this procedure.