Sun Solaris 10 – Post Installation – Basic Configurations

0
4

This tutorial will go over all the basic settings and how to make changes. After you have mastered how to edit the basic settings of Sun Solaris 10 you can read my other articles on how to setup services such as apache, mysql, dns, and others.

THE TERMINAL
Let’s first launch the terminal. If you are using the JAVA GUI, click on the Launch button then navigate to Application -> Utilities -> Terminal. Or simply right click on the desktop area and select the option to launch the terminal from the pop up window. The terminal window should open and you should now be able to run commands. If you are new to Linux/Unix this is the most important tool in your arsenal. It allows you to pretty much do anything, it’s the Terminal. I usually use all of my Linux and Unix servers through an SSH client and always in terminal/command mode.

When you launch the terminal as root, you are probably presented with a # sign at the beginning of the line your cursor is blinking on. This is the Bourne shell. I prefer to work in the bash shell, so I will type bash at the command line like so, and press the enter key:
# bash

Then you should have a new line with your blinking cursor like so:
bash – 3.00#
If you wish to switch back to the Bourne shell, simply type sh at the prompt and hit enter.

SOME BASIC BASH TERMINAL COMMANDS AND SOFTWARE
You should know some basic ways to use the terminal and commands that you can use. I will briefly go over a few, so please feel free to experiment and play around with these.
man – the man pages are your best friend. They will tell you pretty much everything about the software or command you wish to know. Try it out, type man vi, or man echo. Use the spacebar to scroll down in a man page and type q to quit out of the man page.

vi – This is the default text editor on all Unix and Linux machines. It has an extremely difficult learning curve, so you will notice in most of my articles I will have the emacs text editor installed and used in my tutorials. It’s easier for beginners and much similar to other text editors in the Windows environment. However I do encourage to use vi as it is a powerful tool.

Ctrl-Z – This keyboard command will pause the current software or process running in your shell by putting it in the background. It will exit you out to the shell and put you back at the command prompt.
fg – foreground. This command returns you back to the software that you previously paused and put in the background.
Ctrl-C – EXITS a currently running process. It’s like halt command that forces the process to stop without the option to resume it.
pwd – This command will output your current working directory (the directory you are currently in)
cd – change directory
tail – deliver the last part of a file
head – deliver the first part of a file
ls – list the contents of the directory. There are several options you can add to this command to display more detailed information. For example ls -l.
which – Shows where in your path this file is. So if you type which vi, it will show you the path to the vi executable.
whoami – display who you are in case you forgot?:+) This is useful if you want to know whether or not you are currently root or your own user.
rm -R (filename) – Deletes a file on your system
rm -Rf – deletes a folder on your system even if it has subfolders or files
mkdir – Makes a directory on your file system.
alias – Used to create aliases on your system to save you time typing out the full command. For example: alias e=emacs, then I can just type e when I want to launch emacs.
mv – moves a folder or file from one location to another, can also be used to rename folders and files.
chmod – To change the permissions on files.
chown – To change the owner and group properties of a file or folder.
ps – displays all processes your user is currently running. Type ps -e to display ALL PROCESSES on the SYSTEM currently running. To have even more detail try ps -ef
kill – use to kill a process. Usually used by typing
killall- NOT supported on Sun Solaris 10. Try using a creative way such as find or grep with the kill command.
# kill -9 (processID) ProcessID is gotten by using ps to display all currently running processes.

I could write this section for days and with pages and pages of text. So I will stop there. As you go through my tutorials I will use other commands that I have not mentioned, but I believe you will be able to learn what these commands are doing and will be able to start using them on your own. So let’s continue.

USERADD
Let’s first create ourselves a user. We can do this manually by adding the important details in the /etc/passwd file and others, or we can just use the useradd command. We can simply type

bash – 3.00#useradd josh
This will auto create Josh’s home directory and the entry in the appropriate system files. We could even specify more details in this command such as the location of the folder:

bash – 3.00# useradd -d /export/home/josh -m -s /usr/bin/bash josh

This sets the user Josh’s home directory in /export/home/josh and his default shell to the bash shell.

You can check the /etc/passwd file by typing

bash – 3.00#vi /etc/passwd

If you had just typed useradd josh at the terminal, you would have the last line of your /etc/passwd file look something like this:
josh:x:100:1::/home/josh:/bin/sh

This means Josh’s default shell would be the bourne shell. Since we are using bash shell for most of our examples, you should edit this line to look like this:

josh:x:100:1::/export/home/josh:/bin/bash

then you will want to create the users directory:
# mkdir /export/home/josh
# chown josh:other /export/home/josh

We have now setup the directory that the user josh will use as his home directory.
PASSWD

Let’s give our new user a password.
bash – 3.00#passwd josh

Enter the password twice to confirm and then it will be set. No, if you wish to be this new user, just type the terminal command “su” to switch user followed by the username.

bash – 3.00#su josh

WHOAMI

Check to see if you have successfully switched to user josh.

bash – 3.00#whoami

If this gives you an answer of bash: whoami: command not found. This is because whoami is not listed in your path. I will explain PATH next. So for now let’s just create a symbolic link in the directory that your current PATH variable has in it. So type echo $PATH. You might get an answer like this: /usr/bin. This means when you run a command at the terminal, it only looks in this folder for executables. So let’s add a symbolic link to the whoami executable in the /usr/bin folder. I will use the find command to located the whoami executable. I will explain how to use find later. You will need to be root to do this. So first su to root.

It worked, the whoami executable now has a symbolic link in the /usr/bin folder and this path is in the user josh’s path so I am able to call it from the command line.

PATH
You may realize a problem when you try to ping Google in our next test. It might say
-bash: ping: command not found.

This is because the path to the executable ping is not in any of the paths listed in your PATH variable. Type echo $PATH at the command prompt to see what your PATH variable contains. It will probably be /usr/bin

Now if you want you can add paths to your $PATH variable, do this:
export PATH=$PATH:/path/your/want
Path goes from left to right when it analyzes the folder locations in the path variable. So be aware of this, as it might run a different executable if that executable is in one of the paths earlier in the list.
If you just export your $PATH variable it will be lost when you create a new terminal session or logoff and logon. You need to edit or create a.profile file in your user’s home directory and add a line so that the path is created each time you login.

Let’s su to root. So type su root at the prompt to become root again. Then type which ping, this will tell you the location to where ping’s executable is located. It should give you an answer of /usr/sbin/ping. So let’s add this path to our PATH variable in our.profile file.
# cd ~
# vi.profile

cd ~ takes you to your home directory. Then vi.profile either opens the file if it exists or creates a new one. Now you want to add a line to that file that looks like below:

export PATH=$PATH:/usr/sbin;

Save the.profile file, logout and login. Then type echo $PATH to see if your path variable is now displaying:
/usr/bin:/usr/sbin

If so, you have successfully added the path to your PATH variable.
IFCONFIG
Let’s first figure out what our IP address is and to make sure we are live on the internet. First try a simple ping test to google.

bash – 3.00# ping google.com

You should get a response of “google.com is alive”. This means you are live and able to access the internet. Let’s take a look at how are Ethernet card is configured.

To check ethernet card device or IP address type:
ifconfig -a
This command is nice if you have no idea what your device name is and it’s the first time you installed your new network card. You should have some result, usually a standard network card would get the card name of bge0, but this all depends on your hardware and how it was installed. In my case its pcn0. So now if I want to check the status of this device I can type

# ifconfig pcn0

There are several other things you can do with ifconfig, such as set a static IP address and turn off the device, and many others. Since we have internet, let’s proceed to the next section.

SUN SOLARIS pkgadd, pkgrm, pkginfo
Solaris’s package manager, very similar to Redhat’s RPM software. You can use these in the following way:

#pkgadd packagename
This will install package on your system, if its in the form of a Sun Solaris package.
#pkgadd -d . com
This will install a package directly from the internet
#pkgrm packagename
This will remove a package from your system
#pkginfo
This will list all packages currently installed. If you are checking for a specific package, try:
#pkginfo | grep packagename
You can also list packages based on the type of package, try:
#pkginfo -c application
Find out detailed information about the package installed by typing this:
# pkginfo packagename

PKG-GET
Let’s first install and configure

pkg-get software. This software is very simply to Redhat’s Yum package manager and Debian’s apt-get software. You can use this software in very much the same manner. We will use Sun Solaris’ builtin pkgadd to directly download and install the package from blastwave’s website. The days of Unix and Linux downloading source and compiling are almost over. Of course if you wish to download the source and compile yourself you are more than welcome to with all the examples in my guides. There are some situations where we will download the source and compile, so you can learn how to do this later.

<xmphttp://blastwave.org</xmp’s current pkg-get link
## Downloading…
…………..25%…………..50%…………..75%…………..100%
## Download Complete
The following packages are available:

1 CSWpkgget pkg_get – CSW version of automated package download tool

(all) 3.8.4

Select package(s) you wish to process (or ‘all’ to process
all packages). (default: all) [?,??,q]:

Type “all” and hit enter to continue and then input y for all preceding questions. After you answer “y” to all the questions it should finish installing and give you an answer of “Installation of was successful.”

Now you can start using the pkg-get software to install your packages. Now edit the config file and change unstable to stable so we only download stable releases.
There are two pkg-get.conf files, which can lead to confusion. The locations are: /opt/csw/etc/pkg-get.conf and /etc/pkg-get.conf. The one that is being used by pkg-get is more than likely /etc/pkg-get.conf, so let’s edit this file.
# vi /etc/pkg-get.conf
Look for this line:

url=ftp://ftp.sunfreeware.com/pub/freeware
You should comment out this line and uncomment the line:
url=http://ibiblio.org/pub/packages/solaris/csw/unstable/

and change the above line to:
url=http://blastwave.network.com/csw/unstable/

Ways to use pkg-get

pkg-get -l
This will list all currently installed software by pkg-get.

pkg-get -a
This will list all available software to install

pkg-get -U
this updates the internal catalog which stores the list of available software to install.

pkg-get -u
Not to be confused with -U, the lowercase u upgrades already installed packages if possible.

man pkg-get to find out more.

FIND

Use the unix find command to find your file or directory
You will use the software in the following way:
# find. -name file_name
the “.” implies to search in the current directory, you could do something like this to search for all files within the root directory
# find / -name file_name

Try always using file_name* so that it matches words that are file_name_something_else. The find function is very literal and only looks for exact matches. This function will come in handle when you are trying to locate executables and other files.

USING PKG-GET

Before we can start using pkg-get we need to locate the executable on your system. You will notice if you type pkg-get at your command prompt, you will get a command not found message. So let’s find it.

# find / -name pkg-get

This can take quite some time as it will search through all files on your server. You can always cancel this action with a Ctrl-C key interrupt. The results you should get from the above command are something like this:

# find / -name pkg-get
/var/pkg-get
/opt/csw/bin/pkg-get

The /opt/csw/bin/pkg-get is the file we want. Do you remember how to create a symbolic link?

# ln -s /opt/csw/bin/pkg-get /usr/bin/pkg-get
Now you can call this function from your command line. Let’s update our pkg-get contents and then install wget
# pkg-get -U
# pkg-get -i wget

Now the executable for wget will be installed in /opt/csw/bin/. Since we will be using the pkg-get from blastwave to install a lot of our packages, most of the executables will be installed in the /opt/csw/bin/ folder, so we should probably add this to our.profile file.
#vi /export/home/josh/.profile
Make your export PATH line look like this:
export PATH=$PATH:/usr/sbin:/opt/csw/bin/;
Save and exit vi.

EMACS
Now that we have a working package installer by using blastware’s online directory. We can go ahead and install some additional software tools to use.
#pkg-get -i emacs
Let this install all the needed files and dependencies. Just select y to install all needed software, this install might take some time as it requires a lot of other libraries, but it’s okay, because most of these libraries will be required by other packages we are going to install.
Now emacs should finish installing and you can go ahead and run emacs. Let’s go over some basic functions of emacs.

# emacs testfile

This will launch the editor. The first thing you will notice is that you don’t have multiple modes like in vi. So you can just move around your document with the arrow keys and just start typing when you want to. There are many key combinations you can use like in vi, but I will just go over a few.
Ctrl-kk – This deletes the line you are currently on.
Ctrl-x u – This means hold down the control key and press x, then release the control key and press u. This will undo the last change you made.
Ctrl-x-s – Saves your document
Ctrl-x-c – Quits emacs
Ctrl-s – Searches your document. Just type in a word or phrase after hitting Ctrl-s and then hit enter to search your document.

That should help you get started. Enjoy emacs, and once you become more comfortable with Unix/Linux try learning vi or vim.

GNU TAR
Most of us are probably more familiar with GNUTAR than Unix Tar. By default Sun Solaris has the Unix version of Tar installed. Let’s go ahead and install GNUtar on our system.

# pkg-get -I gtar

Now you will have gtar installed and you can use it just like you would use it with your Linux systems.

Let’s say we want to compress the directory /export/home/josh/. You will do the following:
# gtar czvf backup.tar.gz /export/home/josh
Let’s say we want to extract this folder.
# gtar xzvf backup.tar.gz

There is a really easy way to remember which four letters you need to use. The V stands for verbose (output the results to the screen while it compresses, you could leave out the v so its in silent mode). The C stands for compress whereas the X stands for eXtract. The f stands for force and the Z tells tar to Gzip the archive as well. Pretty simple when you understand what each letter means, now you should not have an excuse for forgetting these 5 letters and when to use them.

Before we conclude this tutorial, there is one last thing I would like to go over. We have been using the terminal for pretty much everything up till now. While writing this guide I was using mostly my windows SSH client to connect to my Solaris Server to make sure all the above functions were working as they should be. But you are probably using the terminal in your nice JAVA GUI. When you initially installed Sun Solaris in my first tutorial you probably just installed the default configuration. So there might be a lot of software that you don’t need or want installed. Sun Solaris 10 has a nice graphical add/remove program software called Solaris Product Registry. To launch it type the following in your terminal:
# prodreg &

The ampersand signs forces the job to be put in the background so it will run and return the user to the terminal prompt so he/she can continue working via the terminal.

The Product Registry program will look something like below:

The unclassified software group will usually contain the software we install with blastwave’s pkg-get software. Everything under Solaris 10 System Software folder is software installed during the initial setup or packages made and offered by Sun. You can easily remove software from this application by just selecting the software you don’t need and clicking the Uninstall…. Button. That’s it. And that concludes this intro guide to Sun Solaris 10. I hope you enjoyed. Please check my other tutorials for more advanced settings post Solaris install.

LEAVE A REPLY

Please enter your comment!
Please enter your name here