Connect to WPA Wifi AP in Solaris 11

Very few network cards are supported, in this case i have an Ateros chipset card i plugged off from an acer aspire one

root@solaris01:~# dladm show-phys
LINK MEDIA STATE SPEED DUPLEX DEVICE
net0 Ethernet unknown 100 full bfe0
net1 WiFi up 54 unknown arn0

Create the ip address object

root@solaris01:~# ipadm create-ip net1

Verify the nic has been created as an ipadm object

root@solaris01:~# ipadm show-if
IFNAME CLASS STATE ACTIVE OVER
lo0 loopback ok yes --
net0 ip ok yes --
net1 ip ok yes --

Scan wifi networks

root@solaris01:~# dladm scan-wifi
LINK ESSID BSSID SEC STRENGTH MODE SPEED
net1 DunderMifflin 4:95:e6:de:d6:f1 wpa excellent n 54Mb

Create the encrypted object to store the wpa key

root@solaris01:~# dladm create-secobj -c wpa mykey
provide value for mykey:
confirm value for mkey:

Connect to the network

root@solaris01:~# dladm connect-wifi -e DunderMifflin -k mykey
root@solaris01:~# ipadm create-addr -T dhcp net1

Enable root SSH Login in Oracle Solaris 11

1. Change the file /etc/ssh/sshd_config PermitRootLogin yes with PermitRootLogin no and save file.

    vi /etc/ssh/sshd_config  

  PermitRootLogin yes

2. Comment out the “CONSOLE=/dev/console” line in /etc/default/login.

    vi /etc/default/login

  #CONSOLE=/dev/console

3.Remove “;type=role” from the root entry in /etc/user_attr or use the below command.

 rolemod -K type=normal root

4. Restart the Services.

#svcadm restart svc:/network/ssh:default

Create Solaris 11 Zone

zpool create zone1pool /dev/dsk/c3d0s4
zfs create zone1pool/zone1
zfs set mountpoint=none zone1pool
zfs set mountpoint=/zone01 zone1pool/zone1


zonecfg -z zone01
Use ‘create’ to begin configuring a new zone.
zonecfg:zone01> create -b
create: Using system default template ‘SYSdefault’
zonecfg:zone01> set zonepath=/zone01
zonecfg:zone01> set autoboot=true
zonecfg:zone01> set bootargs=”-m verbose”
zonecfg:zone01> verify
zonecfg:zone01> commit
zonecfg:zone01> exit


zoneadm list -icv
zoneadm -z zone01 install
zoneadm list -icv
zfs list | grep -i zone
zoneadm -z zone01 boot
zlogin -C zone01

Create an IPS repo in Solaris 11

Create the zpool to hold the repos

root@solaris01:/sol_11_repo# zpool create sol_11_repo c3d0s2
root@solaris01:/sol_11_repo# zfs set atime=off sol_11_repo
root@solaris01:/sol_11_repo# zfs set compression=zstd sol_11_repo
root@solaris01:/sol_11_repo# zfs set compression=lz4 sol_11_repo

Copy the 5 zip files to the directory you will use and unzip them

root@solaris01:/sol_11_repo# ls *zip
sol-11_4-repo_1of5.zip sol-11_4-repo_2of5.zip sol-11_4-repo_3of5.zip sol-11_4-repo_4of5.zip sol-11_4-repo_5of5.zip
root@solaris01:/sol_11_repo# ls *zip | while read f;do unzip -oq $f; done

Create the repo and refresh it

root@solaris01:/sol_11_repo# pkgrepo create /sol_11_repo
root@solaris01:/sol_11_repo# pkgrepo -s /sol_11_repo refresh
root@solaris01:/sol_11_repo# pkgrepo -s /sol_11_repo/ info
root@solaris01:/sol_11_repo# zfs set sharenfs=on sol_11_repo
root@solaris01:/sol_11_repo# svccfg -s application/pkg/server setprop pkg/inst_root=/sol_11_repo
root@solaris01:/sol_11_repo# svccfg -s application/pkg/server setprop pkg/readonly=true
root@solaris01:/sol_11_repo# svcprop -p pkg/inst_root application/pkg/server
root@solaris01:/sol_11_repo# svcadm refresh application/pkg/server
root@solaris01:/sol_11_repo# pkgrepo refresh -s /sol_11_repo
Initiating repository refresh.

Make sure it is running in port 80

root@solaris01:~# svccfg -s application/pkg/server listprop | grep -i port
pkg/port count 80
root@solaris01:~# svcadm refresh application/pkg/server
root@solaris01:~# svcadm enable application/pkg/server
root@solaris01:~# svcs | grep -i pkg/server
online 9:53:25 svc:/application/pkg/server:default

Get all the new packages from Oracle

root@solaris01:/sol_11_repo# export PKG_SRC=http://pkg.oracle.com/solaris/release/
root@solaris01:/sol_11_repo# export PKG_DEST=/sol_11_repo
root@solaris01:/sol_11_repo# pkgrecv ‘*’

Receive all packages that do not already exist and all changed content
from the repository located at http://pkg.oracle.com/solaris/release/
to the repository located at /export/repoSolaris11.

root@solaris01:/sol_11_repo# pkgrecv -s http://pkg.oracle.com/solaris/release/ -d /sol_11_repo -m all-timestamps '*'

Setup a client to use our repo, and remove Oracle’s

# pkg set -G ‘*’ -g http://192.168.5.17/ solaris

swap in Solaris 11

  • -s To view the summary of the current swap space allocation:# swap -s total: 106256k bytes allocated + 8512k reserved = 114768k used, 587512k available
  • -l  To list details of the system’s virtual swap space:

    # swap -l
    swapfile dev swaplo blocks free
    /dev/dsk/c0t0d0s1 136,1 16 1206736 1084736
    /export/data/swapfile -16 40944 40944
     
  • -d To delete a swap slice or swap slice from the current swap configuration.# swap -d /dev/dsk/c1t0d0s3
     To prevent the swap slice from being configured as part of the swap configuration during a reboot or change of run level, edit the /etc/vfstab file, and remove the swap slice entry from the file.Operations on swap file are similar to operation on swap slice:
    • Delete a swap file from the current swap configuration.
      # swap -d /export/data/swapfile
       
    • Remove the file to free the disk space that it is occupying.# rm /export/data/swapfile
    • To prevent the swap file from being configured as part of the swap  configuration during a reboot or change of run level, edit the /etc/vfstab file, and remove the swap file entry.

      Note – The output of the df -h /export/data/swapfile command shows the space in use until you remove the swap file.
  • -a To add additional swap area
    • To add a swap slice Edit the /etc/vfstab file to add information describing the swap slice.  # vi /etc/vfstab #device device mount FS fsck mount mount #to mount to fsck point type pass at boot optAdd the following line to create the swap slice./dev/dsk/c1t0d0s3 --swap -no -Use the swap -a command to add additional swap area.# swap -a /dev/dsk/c1t0d0s3Note – When the system is subsequently rebooted, the new swap slice /dev/dsk/c1t0d0s3 will be automatically included as part of the swap space as a result of adding the entry to the /etc/vfstab file.  
    • Adding Swap Files. Swap files can be used when you need to add swap space and do not have a free partition to use. To add a swap file, complete the following steps:
      1. Create a 1G swap file named swapfile in the partition that have enough free space, for example /export/data directory.# mkfile 1000m /export/data/swapfile
      2. Add the swap file to the system’s swap space.# swap -a /export/data/swapfile
      3. List the details of the modified system swap space with swap -l
      4. List a summary of the modified system swap space with swap -s
      5. To use a swap file when the system is subsequently rebooted, add an entry for the swap file in the /etc/vfstab file.# vi /etc/vfstab
        #device device mount FS fsck mount mount
        #to mount to fsck point type pass at boot opt
        /export/data/swapfile –swap -no –

Mount USB disk in solaris 11

$ rmformat
Looking for devices...
1. Logical Node: /dev/rdsk/c3t0d0p0
Physical Node: /pci@0,0/pci108e,534a@2,1/storage@3/disk@0,0
Connected Device: SanDisk  Cruzer Micro     0.3
Device Type: Removable
Bus: USB
Size: 245.0 MB
Label: <None>
Access permissions: Medium is not write protected.

You can use the rmmount command with device nicknames, mount points, or device paths, similar to the following:

$ rmmount rmdisk0
$ rmmount NONAME
$ rmmount /dev/dsk/c3t0d0p0:1

The following example unmounts c2t0d0p0 whose mount point is NONAME.

$ rmumount NONAME
NONAME /dev/dsk/c2t0d0p0 unmounted

Solaris 11 package management (IPS) cheatsheet

Install a package called diagnostic/wireshark:
pkg install diagnostic/wireshark
Uninstall a package called diagnostic/wireshark using a short form of the package
name:
pkg uninstall wireshark
Update all possible packages to the newest version, including all Oracle Solaris zones:
pkg update
Do a dry run of an update of all possible packages to the newest version:
pkg update -nv
Update all system packages to the newest version and require a new BE:
pkg update --be-name fix-nfs-issue

List packages currently installed on a system:
pkg list
Show information about an installed package called wireshark:
pkg info wireshark
Show information about an uninstalled package called xchat:
pkg info -r xchat
Show the contents of an installed package called wireshark:
pkg contents wireshark
Show all PNG files of an installed package called wireshark:
pkg contents -o path -a path=*.png wireshark
Search all locally installed packages for the match gcc:
pkg search -l gcc
Search all packages in the configured repositories that contain dev header
gcrypt-module.h:
pkg search 'gcrypt-module.h'
Search for all packages in the configured repositories that have the
classification Web Services/Application and Web Servers:
pkg search -o pkg.name 'set:info.classification:*Application
and Web Servers’
Search for all packages installed locally that have a dependency on
library/libxml2:
pkg search –l -o pkg.name 'depend::library/libxml2'

Browse package command history (includes graphical Package Manager client):
pkg history
Purge package command history:
pkg purge-history
Verify the integrity of the current system image:
pkg verify
Verify the integrity of installed package called wireshark:
pkg verify wireshark
Fix any errors reported by pkg verify on an installed package called wireshark:
pkg fix wireshark
Freeze a package called wireshark to prevent any accidental future updates:
pkg freeze wireshark

List currently associated publishers:
pkg publisher
Add a publisher at a specified repository URI:
pkg set-publisher -p http://www.example.com/solaris11
Add a publisher:
pkg set-publisher -g http://www.example.com/solaris11 siteapps
Remove a publisher:
pkg unset-publisher siteapps
Query a repository URI for publisher names and package counts:
pkgrepo -s http://pkg.oracle.com/solaris/release info
Change to the Oracle Solaris support repository with pre-downloaded certificates
and keys from the Oracle Solaris release repository:
pkg set-publisher -G http://pkg.oracle.com/solaris/release \
-g http://pkg.oracle.com/solaris/support -k /path/to/ssl_key \
-c /path/to/ssl_cert solaris