10/24/2011

Differences in Solaris compared to Linux

Differences in Solaris 10/11 compared to Linux


Summary

Oracle has a good listing of system administration tools for Solaris 10 and RHEL 5 side-by-side:
https://wikis.oracle.com/pages/viewpage.action?pageId=22609926

//cdrom/volume used as an automatic mount point instead of /media or /run/user/
/etc/shells - Man page exists in Solaris, but file is missing.

To install VirtualBox Guest Additions use: pkgadd -d /cdrom/vbox-guest-additions-cdrom/VboxSolarisAdditions.pkg. This installs the package SUNWvboxguest.

ping -I 1 sol10 64 5 - ping at one second intervals host sol10 with 64 byte packets 5 times

catman - Command to build the man page indexes (windex) instead of makewhatis.

Software Management
Another blogger made a great summary at http://sol10pkgmgmt.blogspot.com/


pkgadd -d virtualboxguestadditions.pkg to install a software package.
pkgadd -d . SUNWbash to install from a filesystem directory.
pkginfo -  view installed package information
pkginfo -d /cdrom/cdrom0/Solaris_10/Product/ -  view package information from a directory (cdrom)


sys-unconfig Unconfigures a system, removing it's name and IP address information. Upon the next boot, the system will prompt for the new configuration.  Starting with Solaris 11, the command has been replaced with sysconfig.

touch /reconfigure - have system re-detect devices such as additional hard drives
Then use the format command to make the fdisk partition, the partition slices, and the disk label.  Use the following commands from the format prompt to carry out these actions:
  • fdisk
  • partition
  • label

useradd -m username If you don't use the -m option with Solaris, then it won't create the user's home directory.
find The find command is aware of the file time stamps in days: -atime, -mtime and -ctime, but not in minutes: -amin, -mmin, and -cmin.

Networking

The default gateway or router entry is placed in /etc/defaultrouter in Solaris 10.
The hosts table is maintained in /etc/inet/hosts file in Solaris, instead of /etc/hosts in Linux.
Combined with the /etc/inet/netmasks file in Solaris, this determines the interface configuration.
The /etc/resolv.conf file is used for DNS resolution, but it does not exist by default.
The /etc/nsswitch.conf file is used to determine order of hosts name resolution.
By default, the hosts entry is:
hosts: files
To use the nameserver entries in the /etc/resolv.conf, update /etc/nsswitch.conf  to:
hosts: dns files
Use ifconfig -a to view all interfaces.
ifconfig e1000g0 down to bring down that interface
ifconfig e1000g0 plumb up to bring up an interface
rup - will ping all hosts in the /etc/inet/hosts file

Network Routing

The following illustrates viewing, deleting, and adding the default gateway. In this scenario, the default was 10.0.2.1, and was changed to 10.0.0.1.

route -p show

route get default

route -p delete default 10.0.2.1

route -f -p

echo 10.0.0.1 > /etc/defaultrouter
route -p add default 10.0.0.1
route -p show
route get default
route get 0.0.0.0


This Pocket Survival Guide to Solaris is very helpful for typical system administration tasks: http://www2.fiu.edu/~tho01/psg/sol.html


Listing services
svcs

Starting a service 


# svcadm enable svc:/network/login:rlogin

Usage: svcadm [-v] [cmd [args ... ]]

        svcadm enable [-rst] ...      - enable and online service(s)
        svcadm disable [-st] ...      - disable and offline service(s)
        svcadm restart ...            - restart specified service(s)
        svcadm refresh ...            - re-read service configuration
        svcadm mark [-It] ... - set maintenance state
        svcadm clear ...              - clear maintenance state
        svcadm milestone [-d]       - advance to a service milestone

        Services can be specified using an FMRI, abbreviation, or fnmatch(5)
        pattern, as shown in these examples for svc:/network/smtp:sendmail

        svcadm svc:/network/smtp:sendmail
        svcadm network/smtp:sendmail
        svcadm network/*mail
        svcadm network/smtp
        svcadm smtp:sendmail
        svcadm smtp
        svcadm sendmail


Shutting Down Solaris 10 

init 5 - to power off the system in Solaris. This would put most Linux distros into a graphical mode.
init 0 - to put the system in a state where it is safe to power off (PROM prompt on SPARC)



Sections of the Manual are Different



1
Basic user commands
1M
System Admin commands
2
OS Calls
3
Library functions
4
Configuration files
5
Miscellaneous topics
6
Games and demos
7
Hardware and device driver files
9
DDI (Device Driver Interface) and DKI (Driver/Kernel Interface)
To view a manual section, you use the -s option in Solaris
man -s 4 passwd
Instead of the Linux method
man 5 passwd

Disk Management

du -k - show in kilobytes instead of 512byte sectors.  There is also a -h option.
df -k - show in kilobytes instead of 512byte sectors.  There is also a -h option.
quot -a - show all users usage of the filesystem

fdisk /dev/rdsk/c0t3d0p0 - create an initial partition before being able to use as a volume
metadb -a -f c0t3d0s2 - force creating a replica database
metainit d21 1 1 c0t3d0s2 - create a RAID 0 device
fdisk /dev/rdsk/c0t4d0p0 - create an initial partition before being able to use as a volume
metadb -a -f c0t4d0s2 - force creating a replica database
metainit d22 1 1 c0t4d0s2 - create a RAID 0 device
metainit d25 -m d21 - create a RAID1 device
metattach d25 d22 - attach the second mirror
newfs /dev/md/rdsk/d25 - create the file system
mount /dev/md/dsk/d25 /testing - mount the new file system

newfs /dev/md/dsk/d25

Single User Mode

In Linux, you can get to single user mode on an init-based system by appending an "S" to the kernel line in the bootloader.  If the Linux system uses systemd instead of init, then you can append the kernel line with "systemd.unit=rescue.target".

In Solaris, you can get to single user mode by appending "-s" to the kernel line in the bootloader.

     The following command restricts the running services to sin-
     gle user mode:

       # svcadm milestone milestone/single-user

     The following command restores the running services:

       # svcadm milestone all

Stop-A
On a standard keyboard use CTRL+PAUSE+A

No comments:

About Me - WrightRocket

My photo

I've worked with computers for over 30 years, programming, administering, using and building them from scratch.

I'm an instructor for technical computer courses, an editor and developer of training manuals, and an Android developer.