Thursday, June 25, 2009

Redhat Linux Essentials RH033 - Part1


Basics
Login: root
Password: Redhat

Login can be in 2 ways
1. Text (Console)
2. Graphics
• Gnome (GNU Network Object Model Environment)
• KDE (K desktop Environment)
• Fail safe terminal (Graphical text based console)

Run levels



• Level 0 – Halt
• Level 1 – Single user mode, mainly for trouble shooting and no authentication is
required.
• Level 2 – Multi user environment with out NFS and NIS support.
• Level 3 – Multi user environment with all the network and services support.
• Level 4 – Unused (Not configured by REDHAT).
• Level 5 – GUI mode
• Level 6 – Reboot

# init <0..6> //to switch between the run levels//
# startx //to enter into GUI mode from run level 3//
# runlevel //to display the present and previous runlevels//
# tty //to display the present terminal//

Ctrl+Alt+(F1<->F6) //to switch between the terminals//

# cat /etc/issue //Message for before login//
# cat /etc/motd // Message for after login//

Note: - man page of “finger” and “w’ will give more information.


Commands and getting help

1. # date
syntax: # command

# date +%a /only day/


# date +%A /full form of day//

B /full form of month/
b //month form/
y and Y //year format//
many options are available when we visit the man page of date command.
# date 021010102009 //to change the date//

2. # cal //calendar of present month//
# cal -1 //default calendar output//
# cal -1 //present and previous calendar output//
# cal -j 2009 //inform of 365 days, j - Julian calendar//
# cal 09 1752 //no dates available between 3rd to 13th//

- Because September 3rd 1952 Gregorian Reformation was
taken place to match universal calendar

Help Levels

1. # whatis //single line description of any command//
2. # --help //to know how to use the command and options//
3. # man //manual pages for commands//

We have total 8 sections under manual pages
1. User Commands
2. System Calls
3. Library Functions
4. Special Files
5. File Formats
6. Games
7. Conventions and miscellany
8. Administration and privileged commands

# man (1 to 8) intro //man pages for all 8 sections//

Example: # man date
Output = date(1) //1 means first section//
: - passwd is a command and /etc/passwd is a password file, manual entries for these are follows.
# man passwd //information from section 1//
# man 5 passwd //information from section 5 for passwd file//
also # man –a // if we forget the section number, this will give
all sections related to that command and use ‘q’ to switch between the sections//

Tip: # init q //to update ‘inittab’ file//
# telinit //link file to init command//
# man fork


4. # info //for the detailed description of the command//
Ex: - # info date


Node(*) //* indicates a link to some more information//
Press ‘tab’ to switch to another node and press ‘enter’ into particular node
information and press ‘u’ to come out from that.
Press ‘n’ to go to the next node information from where you entered already
by hitting ‘enter’ from node(*) and press ‘p’ for previous node.
Check ‘/usr/share/doc’ directory for more information

 In GUI mode go to system/documentation/deployment guide for documentation

File Systems

File: - Collection of information
Filesystem: - Systematic arrangement of file on any storage media

Types of file

1. Regular file
2. Directory file
3. Special file //(/dev)//
# file //to know what type of file is this//

Features of filesystem

1. ‘/’ is the parent directory
2. File system is inverted tree structured
3. File names can be of 255 characters length and except ‘/’ we can use anything as file name
4. # cd .. // .. represents parent directory//
5. File names are case sensitive

Journaling

For example: -
# vi file1 //open a new file//
Then this information stores in journal space and if there is any improper shut down due to power down, in the next reboot, it will check or scan only the journal space instead of checking the whole hard disk.
EXT3 file system is having the journal and EXT2 does not.

Tip: - # blkid //to know the attributes//

Explanation of directories

• / - root directory

Under root directory


• /bin – contains the commands, which can be executed by both the root and normal user.
• /sbin – contains commands which can be executed only by root user
• /root – home directory for root user
• /home – home directory for normal user
• /boot – where boot related files are stored
• /lib – contains library files, where the commands have links to these library files
• /var – variable length information (data varies as per time), for example: - user login details
• /tmp – stores temporary data like cache. For example: - cookies (by default, it keeps the data for 10 days and deletes, if not accessing)
• /dev – stores device files. For example: - information about hardware.
• /opt – for configuration of third party software, the information stores under this directory.
• /etc – stores all the configuration files
• /mnt and /media – mount points, where we use to mount cd, dvd and usb.
• /usr – contains storable resources like UNIX system resource

Types of path

1. Absolute path – path starting with ‘/’. For example: - # cd /usr/share/doc.
2. Relative path – path starting with out ‘/’. For example: - # cd share/doc.


# cat –n //to number the line in the file//
# cat >

Ctrl+d //to create a file//


# touch //to create an empty file//


# touch file1 file2 file3 //to create multiple files at a time//


# touch –t 01021210 file1 //to change the time stamp of a file in format of

mmddtime//


# uname //for system information//


# mkdir //to create empty directory//


options are
• i – interactive
• r – recursive • v – verbose
• f – forceful

# cp –r dir1 dir2 //to copy dir1 to dir2//
# mv file1 file2 //to rename file1 as file2//


/root is required to mention the path while copying

# rmdir //to remove only the empty directory//
# rm //to remove a directory//
# rm –r

//recursive removal//
# rm –rf
//force remove//
# ls –F //to list while differentiating the directories with the symbol ‘/’ and executable files w
ith ‘*’//




Tuesday, June 23, 2009

Software Release

Types of Software

1. Proprietary – We have to purchase with money
2. Freeware – Freely available on Internet
3. Shareware – Trail and buy version
4. Open source – We can view the source code.

Source code is having 4 different freedom levels

1. View source code
2. Run source code
3. Modify source code
4. Redistribution of source code


Redistribution must be done under GPL (GPL – General Public Licence)

Linux version releases as follows

• 1991 – Linux 0.1
• 1992 – 0.2
1993 – 0.3
• 1994 – 1.0
• 1996 – 2.0

For RHEL 5.1, the kernel version is 2.6.18.EL and the recent released is 2.6.29.EL

Distributions of Linux

1. Slake ware
2. Redhat – RHEL (Supported) and Fedora(Un supported)
3. Suse
4. Ubuntu
5. Mandrake
6. Debain
7. Knoppix


Recommendations

If you don't know what you're doing, don't choose distributions that require a lot of legwork to configure basic services or install extra software. If you are new to GNU/Linux and want a great desktop experience, I recommend trying these distros (listed in no specific order):

  •   Linspire
  •   Xandros
  •  SUSE Linux
  •  Mandriva
All of these distros will cost you something -- usually under US $100. A lot of experienced GNU/Linux enthusiasts will recommend non-commercial distributions like Ubuntu, Fedora Core, or Debian. These are good distros and are available free of charge, but require that you add proprietary video drivers and Web browser plugins by hand, and don't have the same kind of automatic hardware management that the four distros I listed above have. That means that you could end up rather frustrated by your GNU/Linux experience. Also stay away from the open source edition of SUSE Linux -- that is also missing many of the proprietary extras that you're used to in Windows or OS X (the commercial version of SUSE does have plugins for Java, Flash, and PDF). It's not tough to add them if you follow this guide, but many people are not prepared to get that technical with their software.

If you're looking for a distro that is more suited to server use, try these:

  • Red Hat Enterprise Linux
  • SUSE Linux Enterprise Server
  • Mandriva Corporate Server
Again, people will argue that other distros or Unix-like OSes are better, but the above-mentioned distributions are easy to install, configure, and manage, and come with extensive documentation and commercial support. You will have a much easier time with them, and you're better off going with one of these if you're new to GNU/Linux or Unix-like operating systems in general. You can make virtually any GNU/Linux distribution into a server of any kind; it's just a matter of how much work you have to do to prepare and maintain it. If you don't want to do a lot of work, choose one of the above distros.

Non-commercial desktop distributions of note include:

  • Ubuntu
  • SUSE Linux OSS
  • Fedora Core
If you would prefer more of a challenge, as either a server or a desktop OS, try these distros:

  • Gentoo
  • Debian
  • Slackware
  • Arch
Lastly, if you would like to see what a GNU/Linux desktop can look like, you can download Knoppix, a distro that runs entirely from a CD. You write the ISO file to a blank CD-R disc, then restart your computer with the disc in the CD drive. You'll run a whole distribution right from the CD. When you're done playing around, just select the Shutdown menu option, remove the CD from the drive, and restart -- nothing will be written to your hard drive.


Features of Linux
1. Multi user and Multi tasking
2. Clone of UNIX
3. Secured
4. Portable

History of Linux

Linux is an operating system that was initially created as a hobby by a young student, Linus Torvalds, at the University of Helsinki in Finland. Linus had an interest in Minix, a small UNIX system, and decided to develop a system that exceeded the Minix standards. He began his work in 1991 when he released version 0.02 and worked steadily until 1994 when version 1.0 of the Linux Kernel was released. The kernel, at the heart of all Linux systems, is developed and released under the GNU General Public License and its source code is freely available to everyone. It is this kernel that forms the base around which a Linux operating system is developed. There are now literally hundreds of companies and organizations and an equal number of individuals that have released their own versions of operating systems based on the Linux kernel. More information on the kernel can be found at our sister site, LinuxHQ and at the official Linux Kernel Archives. The current full-featured version is 2.6 (released December 2003) and development continues.


Apart from the fact that it's freely distributed, Linux's functionality, adaptability and robustness, has made it the main alternative for proprietary Unix and Microsoft operating systems. IBM, Hewlett-Packard and other giants of the computing world have embraced Linux and support its ongoing development. Well into its second decade of existence, Linux has been adopted worldwide primarily as a server platform. Its use as a home and office desktop operating system is also on the rise. The operating system can also be incorporated directly into microchips in a process called "embedding" and is increasingly being used this way in appliances and devices.

Throughout most of the 1990's, tech pundits, largely unaware of Linux's potential, dismissed it as a computer hobbyist project, unsuitable for the general public's computing needs. Through the efforts of developers of desktop management systems such as KDE and GNOME, office suite project OpenOffice.org and the Mozilla web browser project, to name only a few, there are now a wide range of applications that run on Linux and it can be used by anyone regardless of his/her knowledge of computers. Those curious to see the capabilities of Linux can download a live CD version called Knoppix . It comes with everything you might need to carry out day-to-day tasks on the computer and it needs no installation. It will run from a CD in a computer capable of booting from the CD drive. Those choosing to continue using Linux can find a variety of versions or "distributions" of Linux that are easy to install, configure and use.

Below are the step by step details that how Linux was established.


• In 1962- MIT-Mach Institute of technology introduced multi user and multi tasking concepts.

• In 1964 MIT collaborated with BELL Laboratories and General Electronics together started a new project “MULTICS” (Multiplexed Information and Computing Service)

• MULTICS introduced 3 concepts

1. Multi User
2. Multi Tasking
3. Networking

with the aim to implement the above concepts for 1000 users but reached only 3-4 users.

• In 1968 BELL Labs came out of MULTICS project because MIT and GE not showed much
interest.

• In 1969 BELL Labs started a new project UNICS (Uniplexed Information and Computing
Service).

• UNICS was written in ‘B’ language (like assembly language) and this was not portable and not
compatible with some hardware architectures.

• In 1972 Dennis Richie developed C Language.

• In 1973 the whole UNICS source code was rewritten in c language as UNIX

• In 1975 HP, IBM, SUN MICROSYSTEMS taken UNIX source code for USD 15.

• In 1976 and 1977 Ken Thompson, who is a visiting professor for University Of California which
is in Berkeley, started a group called BSD (Berkeley Software Distribution) to develop some
utilities like VI editor.

• In 1979 BSD released BSD UNIX, in 1982 SUN released UNIX series, in 1983 HP released
HP UX and in 1986 IBM released AIX

• In 1984 Richard Stallman started a foundation called FSF (Free Software Foundation).
FSF is not in terms of price but in terms of freedom levels.

• After that Richard Stallman started GNU – GNU’S NOT UNIX ( GNU – Recursive).

• GNU was licensed under GPL.

• In 1989 Andrew S. Tanenbaum created MINIX, which is having minimum features of UNIX.

• In 1991 Linus Torwalds, a student in University of Helsinki which is in Finland.
While he is doing academic project he took MINIX source code and modified entire source code
from the scratch and released it as ‘Linux’.

Preface

Hi Viewers,

I am Sasikanth certified in Redhat Linux - RHEL 4 and Sun Solaris 10. May be you are wondering about this Sasikanth's Linux notes. This notes will take you into the depth of Linux.
As you know Linux is a marvelous subject where you can explore your career. This notes has a recipe of professional experience in Linux domain, extensively in India and abroad. You can feel free to drop your suggestions and comments.

Best regards,
Sasikanth

Sasikanth's Linux Notes