garbage collection
Moazam Raja








 

Newbie SysAdmin Guide to Solaris

Basic Commands

/usr/bin/uname displays current OS name, version, architecture, example

uname -a

/usr/bin/uptimedisplays how long system has been up, and the average number of jobs in the queue, for the last 1, 5 and 15 minutes.
/usr/sbin/prtconf displays out detailed hardware information such as memory, cards, and architecture.
/usr/bin/prstat displays active process statistics, with the top process taking the most resources
/usr/platform/sun4u/sbin/prtdiag displays very detailed hardware information, such as speed of CPUs, CPU cache, and which slots memory chips are installed. This command is platform specific.
/usr/bin/showrevdisplays machine and software revision info. You can get the hostid of the system with this. You can see which patches are installed by running showrev -p. showrev [command] will give detailed revision information about the command in question.
/usr/bin/w displays info on currently logged in users. Also displays uptime information.
/usr/bin/who displays who is currently logged in. Not as verbose as w.


VI

Open a file vi [filename]
Go into edit mode press ESC and type I
Go into command modepress ESC
Save a file press ESC and type :w [filename]
Save a file and quit press ESC and type :wq
Jump to a line press ESC and type the line number
Search for a stringPress ESC and type /string
Quit vi Press ESC and type :q


Users
  • Adding Users

    There are two major ways to add users in Solaris. One is admintool, and the other is useradd. /usr/bin/admintool is a graphical utility which is self-explanatory. Click Edit-->Add and fill out the form.



    On the command line, you can user the /usr/sbin/useradd command. To create a user named "joey" with the directory /export/home/joey, assign the user the Korn shell, and automaticall create the users home directory, the following works:

    useradd -d /export/home/joey -m -s /bin/ksh joey

    note: the -m option is what tells 'useradd' to automatically create the home directory

  • User directories and where to put them


    It is common convention to store user directories in the /export/home area. Do not store user directories in /home as this directory is used by the Solaris automounter. The automounter gives users the ability to login to many different machines and automatically have their home directory mounted on that machine in the /home area. This requires automounting to be setup. I'll write about that later sometime, not important now.


  • Deleting Users

    User the /usr/bin/userdel command. For example, userdel -r joey would delete the user joey and also the users home directory (-r).



    Networking

  • Configuring networking

    Configuring networking is a multi-step process. Will you be using DNS? Do you know the DNS server names/IPs? Do you have a IP address,etc. In this case, lets say we are going to use DNS on this system.

    Set the name of the machine
    You need to put the name of the machine in the /etc/nodename file.

    Tell Solaris that we're going to use DNS

    By default, Solaris is not setup to use DNS. To make the change, we have to edit the /etc/nsswitch.conf

    file.

    Open this file and look for the line which starts with "hosts:".
    Add "dns" to the end of this line.

    You can also add the "dns" entry to the beginning of the line, which changes the order in which Solaris will do name lookups. For example, if you have "nis" before "dns", Solaris will first look in the NIS database. If you have "files" before "dns", Solaris will look at the /etc/hosts file before it looks at DNS.



    Tell Solaris about your DNS servers
    Edit the /etc/resolv.conf file. This file may not exist already, but you can just create it with a text editor.

    Here is an example /etc/resolv.conf file (from devnull.unixville.com)

    search unixville.com
    domain unixville.com
    nameserver 216.242.178.2
    nameserver 216.242.178.3
    nameserver 204.235.100.130
    nameserver 24.1.0.33
    nameserver 198.6.1.202



    The first line tells the OS to search first in the "unixville.com" domain. The second line simply tells the OS what domain we are currently in (I think). The lines after that are listings of the DNS servers to use for lookup. They are used in the order they are in, so if the first DNS server does not respond, the OS knows to go to the second one and so forth.

    Add the machines info to the /etc/hosts file
    You will need to edit the /etc/hosts file and enter the name of the machine and its IP address. For example, for devnull.unixville.com, I just entered the following line in the /etc/hosts file:

    216.242.17.87 devnull


    You can leave all the rest of the data in /etc/hosts file as is.

    Also edit the following files:

    /etc/net/ticlts/hosts
    /etc/net/ticots/hosts
    /etc/net/ticotsord/hosts

    Edit the interfaces hostname file.
    Since Sun systems can have multiple network cards, and each of those cards may answer to a different hostname, you need to also edit a file to assign the hostname to the main network card. This is usefull because you may want a single server to respond to many different names, each on a different network card.



    The main network interface is usually hme0. Most Sun 10/100 cards are known as hme cards, due to the internal codename during development, happy meal. Other cards, such as the 10/100 Quad card, show up in Solaris as qfe, and since this card has 4 ethernet controllers built in, they are accessed as qfe0,qfe1,qfe2 and qfe3.

    To edit the name of the interface, simply edit the /etc/hostname.[interface] file.

    For example, for the built in hme0 card, you would edit the /etc/hostname.hme0 file. For the second ethernet interface on a Quad card (if you have one), you would edit the /etc/hostname.qfe1 file. The reason it's 1 is because the computer counts from 0, but it can get confusing when dealing with multiple qfe cards, so keep it in mind.



    If you are changing netmask
    Edit the following file with your netmask and network number:

    /etc/inet/netmasks

  • Using network commands

    Show network routing table information
    Use /usr/bin/netstat. For example: netstat -rn

    Show network interface information
    Use /usr/sbin/ifconfig. For example: ifconfig -a



    More to come soon...


  • Click here to visit the Radio UserLand website.
    Click to see the XML version of this web page.
    Click here to send an email to the editor of this weblog.
    © Copyright 2004 Moazam Raja.
    Last update: 6/20/2004; 4:51:41 PM.