Welcome to Linux Support and Sun Help
Search Sun Help

Solaris Administration

These notes are primarily aimed at Solaris 10 system administrators and comprise our hints and tips to generally make life easier.

Contents
Potential problems with a minimal Solaris 10 install
Registering your copy of Solaris
Changing the default shell
Customising the bash prompt
Editing the default PATH
Editing the default system colours
Downloading coreutils (such as gnu ls etc)
Installing VIM
Fixing cursor key movement in vi
Setting the default editor (for things line crontab -e)
Adding new users
Monitoring running processes
Sendmail
Links to third-party websites

The Shell

The default shell is generally the Bourne shell (/bin/sh) which can cause irritation, especially if you've come from a Linux background. I generally set the default shell to Bash (/bin/bash) which is also supplied with Solaris 10, but not widely noted in the various books available.

To change the shell for existing users, edit the /etc/passwd file and change the occurrences of /bin/sh to /bin/bash for the users you wish to edit.

N.B. Despite some books listing it, Solaris 10 doesn't allow the default shell to be changed via the useradd -D -s /bin/bash command, so if you want to permanently edit the default shell for new users you need to manually edit the /usr/sadm/defadduser file and change the defshell=... entry to the value you require.

The Bash Shell prompt

The default shell prompt is pretty boring, so I generally change it to the following:

PS1="[\u@\h \W]\\$ "

which will set the prompt to the user at the hostname of the machine and the current directory.

The default PATH

Solaris has a fairly restrictive default PATH variable so I find it useful to extend it in order to pick up some of the other binaries installed with Solaris 10. There are two main ways of achieving this, and both depend upon which shell you're using.

You can either enter a PATH= line in the main /etc/.login file and subsequently expand it in each users .XXXrc file (where XXX depends upon the shell in use) or just put the required path in the relevant user .XXXrc file.

If you're using bash, I'd recommend setting the PATH=.:/usr/local/bin:/usr/bin:/usr/sbin:/usr/sfw/bin:/usr/ccs/bin

To alter the default preferences for each new user, edit the system default 'skeleton' files in /etc/skel/

Setting system wide colours

According to a handy page at Tille's Site, colours can be set system wide by creating a DIR_COLORS file inside /etc. A sample file is provided here.

Don't forget to set an alias for the ls command if you've installed coreutils (see below):

alias ls='ls --color'
Downloading 'Core Utilities'

Coreutils will add a number of basic utilities and improvements to the standard Solaris shell (such as the gnu ls, allowing coloured directory listings etc). You can download this from www.sunfreeware.com/programlistsparc10.html and it's approx. 2.6MB long.

cd /root
wget ftp://ftp.sunfreeware.com/pub/freeware/sparc/10/coreutils-6.4-sol10-sparc-local.gz
gunzip coreutils-6.4-sol10-sparc-local.gz
pkgadd -d coreutils-6.4-sol10-sparc-local

Follow any onscreen instructions when installing the package, as /usr/local/bin will probably need to be created.

Once you've installed the coreutils package you'll probably want to amend the PATH so that /usr/local/bin is scanned before the regular /usr/bin directory. (See above, such that you now have something like PATH=.:/usr/local/bin:/usr/bin:/usr/sbin:/usr/sfw/bin:/usr/ccs/bin)

Installing VIM

Vim is a replacement text editor and I recommend installing this to replace the default vi supplied with Solaris. You can download the latest version from www.vim.org/

wget ftp://ftp.vim.org/pub/vim/unix/vim-7.1.tar.bz2
bunzip2 vim-7.1.tar.bz2
tar -xvf vim-7.1.tar
cd vim-7.1/src
make
make install

After installing, I generally create an alias for vi such as alias vi='vim'

Fixing cursor key movement whilst in 'insert' mode in VI/VIM

You may find that pressing the cursor keys when inserting text in your editor produces the letters A,B,C and D instead of moving around the document. This can be irritating and also quite tricky to fix if you don't know what you're doing.

You need to add some modified key definitions to your default editor profile. This is normally stored within the home directory for your user; ~/.exrc (for vi) or ~/.vimrc (for vim) - the default profile can vary depending upon which editor you're using.

Add the following lines to the file:

set t_ku=^[OA
set t_kd=^[OB
set t_kr=^[OC
set t_kl=^[OD

The ^[ should be an escape code, obtained by pressing CTRL-V followed by ESCAPE.

Setting the default editor
Adding users

There are several ways to create a new user, but I find a simple, default command is:

useradd -d /export/home/user -m -c "Full Name" user

where user is the username required.

Monitoring Running Processes

Solaris doesn't have the top command per se, but a close equivalent is prstat which will display an interactive list of running processes.

Sendmail

To check that sendmail can correctly identify your hostname:

/usr/lib/mail/sh/check-hostname

Useful third-party links
Valid HTML 4.01! Valid CSS!
/td>