UNIX in a nutshell


An operating system (or “OS”) is a set of programs that controls a computer. It controls both the hardware (things you can touch – keyboards, displays and disk drives) and the sotfware (application program that you run, such as a word processor).
Some computers have a single-user OS, which means only one person can use the computer at a time. Many older OSes (like DOS) can also do only one job at a time. But almost any computer can do a lot more if it has a multiuser, multitasking operating system like UNIX. These powerful OSes let many people use the computer at the same time and let each user run several jobs at once.Unix operating systems are widely used in both servers and workstations. The Unix environment and the client-server program model were essential elements in the development of the Internet and the reshaping of computing as centered in networks rather than in individual computers

As mentioned above, Unix was designed to be portable, multi-tasking and multi-user in a time-sharing configuration. Unix systems are characterized by various concepts: the use of plain text for storing data; a hierarchical file system; treating devices and certain types of inter-process communication (IPC) as files; and the use of a large number of software tools, small programs that can be strung together through a command line interpreter using pipes, as opposed to using a single monolithic program that includes all of the same functionality. These concepts are known as the Unix philosophy.

There are many different versions of UNIX . Until few years ago, there were just two main versions: the line of UNIX releases that started at the AT&T, and the other line from the University of California at Berkeley. Some other major commercial versions include SunOS, Solaris, AIX, HP/UX and ULTRIX. Some of the freely available versions include LINUX and FreeBSD.
Read more... »»

Basic UNIX Command (part I)

UNIX is an operating system developed by AT&T Bell LABS in 1969. Today the term Unix is used to describe any operating system that conforms to Unix standards, meaning the core operating system operates the same as the original Unix operating system. During the late 1970s and early 1980s, the influence of Unix in academic circles led to large-scale adoption of Unix (particularly of the BSD variant, originating from the University of California, Berkeley) by commercial startups, the most notable of which are Solaris, HP-UX and AIX.

And I think, in order to mastering the SUN Solaris OS, we definitely need to know some of the very basic UNIX commands :D

First thing to remember: UNIX is case-sensitive.
COMMAND and command are not the same

FILES













































































ls lists your files
ls -l lists your files in 'long format', which contains lots of useful information, e.g. the exact size of the file, who owns the file and who has the right to look at it, and when it was last modified
ls -a lists all files, including the ones whose filenames begin in a dot, which you do not always want to see
more filename shows the first part of a file, just as much as will fit on one screen
emacs filename is an editor that lets you create and edit a file
mv filename1 filename2 moves a file
cp filename1 filename2 copies a file
rm filename removes a file. It is wise to use the option rm -i, which will ask you for confirmation
diff filename1 filename2 compares files, and shows where they differ
wc filename tells you how many lines, words, and characters there are in a file
chmod options filename change the read, write, and execute permissions on your files
gzip filename compresses files
gunzip filename uncompresses files compressed by gzip
gzcat filename lets you look at a gzipped file without actually having to gunzip it
lpr filename print
lpq check out the printer queue
lprm jobnumber remove something from the printer queue
genscript converts plain text files into postscript for printing
dvips filename print .dvi files


For further explanation check the manual page.

root@ult10 # man command

...to be continued
Read more... »»

WEBMIN

Webmin is a web-based system configuration and administration tool for any Operating System, such as OpenSolaris, Linux and other *NIX-flavor systems, even now, Webmin can be installed and run on Microsoft Windows. You can configure many operating system internals, such as users, disk quotas, services, configuration files etc., as well as modify and control many open source apps, such as the Apache HTTP Server, PHP, MySQL, DNS, file sharing and much more.
Webmin removes the need to manually edit Unix configuration files like /etc/passwd, /etc/inet.d.conf, and lets you manage a system from the console or remotely

Webmin is based on Perl, running as its own process and web server. It defaults to TCP port 10000 for communicating, and can be configured to use SSL if OpenSSL is installed with additional required Perl Modules.
It is built around modules, which have an interface to the configuration files and the Webmin server. This makes it easy to add new functionality without much work. Due to Webmin's modular design, it would be possible for anyone who is interested to write plugins for desktop configuration.
Webmin also allows for controlling many machines through a single interface, or seamless login on other webmin hosts on the same subnet or LAN.
Webmin is primarily coded by Australian Jamie Cameron and released under the BSD license

I'll show you how to install and use the tool. First, you should have the installer package, You can download the latest version here
I'm running the Webmin-tool inside SUN Ultra10 with Solaris 10 11/06

After you get the package, unzip it.

root@ult10 # cd package/
root@ult10 # ls
CSKamp_1.3.1_sparc.pkg CSKruntime_1.3.1_sparc.pkg webmin-1.490.pkg.gz
root@ult10 # gunzip webmin-1.490.pkg.gz
root@ult10 # ls
CSKamp_1.3.1_sparc.pkg CSKruntime_1.3.1_sparc.pkg webmin-1.490.pkg


Add the package and follow the next instruction until the package is installed completely.

root@ult10 # pkgadd -d webmin-1.490.pkg

The following packages are available:
1 WSwebmin Webmin - Web-based system administration
(all) 1.490

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

Processing package instance from

Webmin - Web-based system administration(all) 1.490
Webmin Software

The selected base directory must exist before
installation is attempted.

Do you want this directory created now [y,n,?,q] y
Using as the package base directory.
## Processing package information.
## Processing system information.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.
## Checking for setuid/setgid programs.

This package contains scripts which will be executed with super-user
permission during the process of installing this package.

Do you want to continue with the installation of [y,n,?] y

Installing Webmin - Web-based system administration as

## Installing part 1 of 1.
/etc/init.d/webmin
/opt/webmin/LICENCE
/opt/webmin/LICENCE.ja
/opt/webmin/README
/opt/webmin/Webmin/All.pm
/opt/webmin/Webmin/Button.pm
/opt/webmin/Webmin/Checkbox.pm
/opt/webmin/Webmin/Checkboxes.pm
/opt/webmin/Webmin/Columns.pm
/opt/webmin/Webmin/ConfirmPage.pm
.
.
.
(output truncated)

Running postinstall scripts ..
sh: syslog-ng: not found
..done

Attempting to start Webmin mini web server..
Starting Webmin server in /opt/webmin
Pre-loaded WebminCore
..done

***********************************************************************
Webmin has been installed and started successfully. Use your web
browser to go to

http://ult10:10000/

and login with the name and password you entered previously.


Installation of was successful.
root@ult10 #


After that, point your browser to http://webmin-installed-box:10000



Login as root


Read more... »»

Configuring Apache, PHP and MySql in SOlaris 10

I spent my whole week trying how to use file-sharing application such as Oliver webshare, PHP file mahager and bfExplorer. Those application are based on PHP (and MySql on bfExplorer) My box has apache2 in it. At the first time i thought Apache2 is enough to run those applications. But then I realized, THOSE APPLICATIONS ARE BASED ON PHP :D
Not just Apache, but also I need to install PHP on it (MySQL is just a bonus :D) Lots of tutorial on how-to configure PHP on Solaris, but these time I'm gonna use a package called coolstack http://cooltools.sunsource.net/coolstack/index.html or you can get it here

First, login into your Solaris box as root
1. Connecting to 192.168.1.150:23...
Connection established.
Escape character is '^@]'.
login: root
Password:
Last login: Wed Nov 4 12:35:45 from 192.168.1.192
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
You have mail.
Sourcing //.profile-EIS.....
root@u10 #


2. Install the Coolstack package. CSKruntime first.
root@u10 # bunzip CSKruntime_1.3.1_i386.pkg.bz2
root@u10 # pkgadd -d CSKruntime_1.3.1_i386.pkg


3. Install the CSKamp package.
root@u10 # bunzip CSKamp_1.3.1_i386.pkg.bz2
root@u10 # pkgadd -d CSKamp_1.3.1_i386.pkg


4. Once the installation is completed, we can start to configure.
Let's begin with the APACHE

> The root document is located at /opt/coolstack/apache2/htdocs
> The configuration file, binary, lib and so on are located at /opt/coolstack/apache2
> At first, there is no file such httpd.conf, what exists is httpd.conf-example
> Rename the file to http.conf
> You can customize the configuration file at /etc/coolstack/apache2/conf/httpd.conf
> Start it

root@u10 # svcadm enable apache22

> Check the service

root@u10 # svcs | grep apache22
online 10:34:47 svc:/network/http:apache22-csk


> Open your browser, go to http://your-solaris-box

Now, configuring MySql
> Export the PATH

root@u10 # export PATH=/opt/coolstack/mysql_32bit/bin:$PATH

> Install the database and create the user and the group

root@u10 # /opt/coolstack/mysql_32bit/bin/mysql_install_db

root@u10 # groupadd mysql

root@u10 # useradd -c “MySQL Server” -g mysql mysql


> Change the owner of the directory

root@u10 # chown -R mysql:mysql /opt/coolstack/mysql_32bit

root@u10 # cp /opt/coolstack/mysql_32bit/share/mysql/my-large.cnf /etc/my.cnf


> Run it

root@u10 # /opt/coolstack/mysql_32bit/bin/mysqld_safe &

> Check the service

root@u10 # ps -ef | grep mysql
root 8530 15420 0 13:23:53 pts/2 0:00 grep mysql

mysql 7341 7270 1 13:23:10 pts/3 0:01 /opt/coolstack/mysql_32bit/bin/mysqld --basedir=/opt/coolstack/mysql_32bit --da

root 7270 23464 0 13:23:09 pts/3 0:00 /bin/sh /opt/coolstack/mysql_32bit/bin/mysqld_safe


> Set the root password for MySql

root@u10 # /opt/coolstack/mysql_32bit
/bin/mysqladmin -u root password ‘yourpassword’


> Try to login into the MySql

root@u10 # /opt/coolstack/mysql_32bit/bin/mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.25-rc-standard-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>


> Try to create a database

mysql> create database mydata;
Query OK, 1 row affected (0.12 sec)

mysql> quit
Bye


Finally, the PHP5

> PHP5 automatically installed by the CSKampx.x.x
> the directory is located at /opt/coolstack/php5
Read more... »»

Implementing Quota in Solaris 10

In Solaris, system administrator can control the size of the UFS file system by limiting the amount of disk space using quota. For this reason, quotas are especially useful on the file systems where user home directories reside. As a rule, public and /tmp file systems usually do not benefit as much from the establishment of quotas.

Take a look at my example..

root@fileserver # df -h
Filesystem size used avail capacity Mounted on
/dev/dsk/c1t0d0s0 53G 667M 52G 2% /
/devices 0K 0K 0K 0% /devices
ctfs 0K 0K 0K 0% /system/contract
proc 0K 0K 0K 0% /proc
mnttab 0K 0K 0K 0% /etc/mnttab
swap 3.2G 1.6M 3.2G 1% /etc/svc/volatile
objfs 0K 0K 0K 0% /system/object
sharefs 0K 0K 0K 0% /etc/dfs/sharetab
/dev/dsk/c1t0d0s4 4.8G 3.5G 1.2G 75% /usr
/platform/sun4u-us3/lib/libc_psr/libc_psr_hwcap1.so.1
53G 667M 52G 2% /platform/sun4u-us3/lib/libc_psr.so.1
/platform/sun4u-us3/lib/sparcv9/libc_psr/libc_psr_hwcap1.so.1
53G 667M 52G 2% /platform/sun4u-us3/lib/sparcv9/libc_psr.so.1
fd 0K 0K 0K 0% /dev/fd
swap 3.2G 0K 3.2G 0% /tmp
swap 3.2G 48K 3.2G 1% /var/run
/dev/dsk/c1t0d0s5 4.8G 435M 4.3G 9% /opt
/dev/dsk/c1t0d0s6 4.8G 4.9M 4.8G 1% /export/home
/dev/md/dsk/d10 202G 64M 200G 1% /data


There are 30 users will be using the /data directory. Each of the them will have 5GB disk space. To implement the quota on /data slice, first you need to make a file called qoutas under /data directory

1. Change directory to /data
root@fileserver # cd /data

2. Create file called quotas
root@fileserver # touch quotas

3. Edit the /etc/vfstab file and add rq to the mount options field for each UFS file system that will have quotas.
root@fileserver # vi /etc/vfstab
/dev/md/dsk/d10 /dev/md/rdsk/d10/data ufs 3 yes rq

4. Change permissions to read/write for root access only on quotas
root@fileserver # chmod 600 quotas

5. Set quotas for a user
root@fileserver # edquota kks

You'll see a file containing a description about the quotas allocation.
fs /files blocks (soft = 0, hard = 0) inodes (soft = 0, hard = 0)

I'm gonna set the quotas for each user around 5GB each.
fs /files blocks (soft = 4500000, hard = 5000000) inodes (soft = 0, hard = 0)
We call that user kks as a prototype to make another quotas for the rest of the users.

6. root@fileserver # edquota -p kks trs ppa djk bsk ksn opr usk ren umm sdm umn wem tek usy int mar lpn kmp spi kpi jal huk kpn jdi cmo kpd dlk pku drk

7. Check the quotas
root@fileserver # quotacheck -va
*** Checking quotas for /dev/md/rdsk/d10 (/data)
/dev/md/rdsk/d10: trs fixed: files 0 -> 5 blocks 0 -> 10
/dev/md/rdsk/d10: ppa fixed: files 0 -> 5 blocks 0 -> 10
/dev/md/rdsk/d10: djk fixed: files 0 -> 5 blocks 0 -> 10
/dev/md/rdsk/d10: bsk fixed: files 0 -> 5 blocks 0 -> 10
/dev/md/rdsk/d10: ksn fixed: files 0 -> 5 blocks 0 -> 10
/dev/md/rdsk/d10: opr fixed: files 0 -> 5 blocks 0 -> 10
/dev/md/rdsk/d10: usk fixed: files 0 -> 5 blocks 0 -> 10
/dev/md/rdsk/d10: ren fixed: files 0 -> 5 blocks 0 -> 10
/dev/md/rdsk/d10: umm fixed: files 0 -> 5 blocks 0 -> 10
/dev/md/rdsk/d10: sdm fixed: files 0 -> 5 blocks 0 -> 10
/dev/md/rdsk/d10: umn fixed: files 0 -> 5 blocks 0 -> 10
/dev/md/rdsk/d10: wem fixed: files 0 -> 5 blocks 0 -> 10
/dev/md/rdsk/d10: tek fixed: files 0 -> 5 blocks 0 -> 10
/dev/md/rdsk/d10: usy fixed: files 0 -> 5 blocks 0 -> 10
/dev/md/rdsk/d10: int fixed: files 0 -> 5 blocks 0 -> 10
/dev/md/rdsk/d10: mar fixed: files 0 -> 5 blocks 0 -> 10
/dev/md/rdsk/d10: lpn fixed: files 0 -> 5 blocks 0 -> 10
/dev/md/rdsk/d10: kmp fixed: files 0 -> 5 blocks 0 -> 10
/dev/md/rdsk/d10: spi fixed: files 0 -> 5 blocks 0 -> 10
/dev/md/rdsk/d10: kpi fixed: files 0 -> 5 blocks 0 -> 10
/dev/md/rdsk/d10: jal fixed: files 0 -> 5 blocks 0 -> 10
/dev/md/rdsk/d10: huk fixed: files 0 -> 5 blocks 0 -> 10
/dev/md/rdsk/d10: kpn fixed: files 0 -> 5 blocks 0 -> 10
/dev/md/rdsk/d10: jdi fixed: files 0 -> 5 blocks 0 -> 10
/dev/md/rdsk/d10: cmo fixed: files 0 -> 5 blocks 0 -> 10
/dev/md/rdsk/d10: kpd fixed: files 0 -> 5 blocks 0 -> 10
/dev/md/rdsk/d10: dlk fixed: files 0 -> 5 blocks 0 -> 10
/dev/md/rdsk/d10: pku fixed: files 0 -> 5 blocks 0 -> 10
/dev/md/rdsk/d10: drk fixed: files 0 -> 5 blocks 0 -> 10


8. Turning on the quotas
root@fileserver # quotaon -v /dev/md/dsk/d10
/data: quotas turned on

9. Check for exceeded quotas
root@fileserver # quota -v trs
Disk quotas for trs (uid 101):
Filesystem usage quota limit timeleft files quota limit timeleft
/data 5 4500000 5000000 5 0 0
root@fileserver # quota -v ppa
Disk quotas for ppa (uid 102):
Filesystem usage quota limit timeleft files quota limit timeleft
/data 5 4500000 5000000 5 0 0
root@fileserver # quota -v djk
Disk quotas for djk (uid 103):
Filesystem usage quota limit timeleft files quota limit timeleft
/data 5 4500000 5000000 5 0 0
root@fileserver # quota -v bsk
Disk quotas for bsk (uid 104):
Filesystem usage quota limit timeleft files quota limit timeleft
/data 5 4500000 5000000 5 0 0
root@fileserver # quota -v ksn
Disk quotas for ksn (uid 105):
Filesystem usage quota limit timeleft files quota limit timeleft
/data 5 4500000 5000000 5 0 0
root@fileserver # quota -v opr
Disk quotas for opr (uid 106):
Filesystem usage quota limit timeleft files quota limit timeleft
/data 5 4500000 5000000 5 0 0
root@fileserver # quota -v usk
Disk quotas for usk (uid 107):
Filesystem usage quota limit timeleft files quota limit timeleft
/data 5 4500000 5000000 5 0 0
root@fileserver # quota -v ren
Disk quotas for ren (uid 108):
Filesystem usage quota limit timeleft files quota limit timeleft
/data 5 4500000 5000000 5 0 0
root@fileserver # quota -v umm
Disk quotas for umm (uid 109):
Filesystem usage quota limit timeleft files quota limit timeleft
/data 5 4500000 5000000 5 0 0
root@fileserver # quota -v sdm
Disk quotas for sdm (uid 110):
Filesystem usage quota limit timeleft files quota limit timeleft
/data 5 4500000 5000000 5 0 0
root@fileserver # quota -v umn
Disk quotas for umn (uid 111):
Filesystem usage quota limit timeleft files quota limit timeleft
/data 5 4500000 5000000 5 0 0
root@fileserver # quota -v wem
Disk quotas for wem (uid 112):
Filesystem usage quota limit timeleft files quota limit timeleft
/data 5 4500000 5000000 5 0 0
root@fileserver # quota -v tek
Disk quotas for tek (uid 113):
Filesystem usage quota limit timeleft files quota limit timeleft
/data 5 4500000 5000000 5 0 0
root@fileserver # quota -v usy
Disk quotas for usy (uid 114):
Filesystem usage quota limit timeleft files quota limit timeleft
/data 5 4500000 5000000 5 0 0
root@fileserver # quota -v int
Disk quotas for int (uid 115):
Filesystem usage quota limit timeleft files quota limit timeleft
/data 5 4500000 5000000 5 0 0
root@fileserver # quota -v mar
Disk quotas for mar (uid 116):
Filesystem usage quota limit timeleft files quota limit timeleft
/data 5 4500000 5000000 5 0 0
root@fileserver # quota -v lpn
Disk quotas for lpn (uid 117):
Filesystem usage quota limit timeleft files quota limit timeleft
/data 5 4500000 5000000 5 0 0
root@fileserver # quota -v kmp
Disk quotas for kmp (uid 118):
Filesystem usage quota limit timeleft files quota limit timeleft
/data 5 4500000 5000000 5 0 0
root@fileserver # quota -v spi
Disk quotas for spi (uid 119):
Filesystem usage quota limit timeleft files quota limit timeleft
/data 5 4500000 5000000 5 0 0
root@fileserver # quota -v kpi
Disk quotas for kpi (uid 120):
Filesystem usage quota limit timeleft files quota limit timeleft
/data 5 4500000 5000000 5 0 0
root@fileserver # quota -v jal
Disk quotas for jal (uid 121):
Filesystem usage quota limit timeleft files quota limit timeleft
/data 5 4500000 5000000 5 0 0
root@fileserver # quota -v huk
Disk quotas for huk (uid 122):
Filesystem usage quota limit timeleft files quota limit timeleft
/data 5 4500000 5000000 5 0 0
root@fileserver # quota -v kpn
Disk quotas for kpn (uid 123):
Filesystem usage quota limit timeleft files quota limit timeleft
/data 5 4500000 5000000 5 0 0
root@fileserver # quota -v jdi
Disk quotas for jdi (uid 124):
Filesystem usage quota limit timeleft files quota limit timeleft
/data 5 4500000 5000000 5 0 0
root@fileserver # quota -v cmo
Disk quotas for cmo (uid 125):
Filesystem usage quota limit timeleft files quota limit timeleft
/data 5 4500000 5000000 5 0 0
root@fileserver # quota -v kpd
Disk quotas for kpd (uid 126):
Filesystem usage quota limit timeleft files quota limit timeleft
/data 5 4500000 5000000 5 0 0
root@fileserver # quota -v dlk
Disk quotas for dlk (uid 127):
Filesystem usage quota limit timeleft files quota limit timeleft
/data 5 4500000 5000000 5 0 0
root@fileserver # quota -v pku
Disk quotas for pku (uid 128):
Filesystem usage quota limit timeleft files quota limit timeleft
/data 5 4500000 5000000 5 0 0
root@fileserver # quota -v drk
Disk quotas for drk (uid 129):
Filesystem usage quota limit timeleft files quota limit timeleft
/data 5 4500000 5000000 5 0 0


10. Check quotas on the filesystem
root@fileserver # repquota -va
/dev/md/dsk/d10 (/data):
Block limits File limits
User used soft hard timeleft used soft hard timeleft
kks -- 5 4500000 5000000 5 0 0
trs -- 5 4500000 5000000 5 0 0
ppa -- 5 4500000 5000000 5 0 0
djk -- 5 4500000 5000000 5 0 0
bsk -- 5 4500000 5000000 5 0 0
ksn -- 5 4500000 5000000 5 0 0
opr -- 5 4500000 5000000 5 0 0
usk -- 5 4500000 5000000 5 0 0
ren -- 5 4500000 5000000 5 0 0
umm -- 5 4500000 5000000 5 0 0
sdm -- 5 4500000 5000000 5 0 0
umn -- 5 4500000 5000000 5 0 0
wem -- 5 4500000 5000000 5 0 0
tek -- 5 4500000 5000000 5 0 0
usy -- 5 4500000 5000000 5 0 0
int -- 5 4500000 5000000 5 0 0
mar -- 5 4500000 5000000 5 0 0
lpn -- 5 4500000 5000000 5 0 0
kmp -- 5 4500000 5000000 5 0 0
spi -- 5 4500000 5000000 5 0 0
kpi -- 5 4500000 5000000 5 0 0
jal -- 5 4500000 5000000 5 0 0
huk -- 5 4500000 5000000 5 0 0
kpn -- 5 4500000 5000000 5 0 0
jdi -- 5 4500000 5000000 5 0 0
cmo -- 5 4500000 5000000 5 0 0
kpd -- 5 4500000 5000000 5 0 0
dlk -- 5 4500000 5000000 5 0 0
pku -- 5 4500000 5000000 5 0 0
drk -- 5 4500000 5000000 5 0 0

Read more... »»