Вы находитесь на странице: 1из 45

CHAPTER 2

OPEN SOURCE OPERATING SYSTEM

Linux is based on the Multiuser OS UNIX, and it can be distributed freely. It is the brainchild of
Mr, Linus Torvalds. Typically all underlying source code can be freely modified and used. Linux
Kernel was first released for public use in 1991. The biggest achievement for Linux is that it is a
multiuser OS and the Security and stability is better than Windows.

2.1 Components of Linux System

Linux Operating System has primarily three components

Kernel - Kernel is the core part of Linux. It is responsible for all major activities of this
operating system. It is consists of various modules and it interacts directly with the
underlying hardware. Kernel provides the required abstraction to hide low level hardware
details to system or application programs.

System Library - System libraries are special functions or programs using which
application programs or system utilities accesses Kernel's features. These libraries
implements most of the functionalities of the operating system and do not requires kernel
module's code access rights.

System Utility - System Utility programs are responsible to do specialized, individual


level tasks.
2.2 Kernel Mode Vs User Mode

Kernel component code executes in a special privileged mode called kernel mode with full
access to all resources of the computer. This code represents a single process, executes in single
address space and do not require any context switch and hence is very efficient and fast. Kernel
runs each process and provides system services to processes, provides protected access to
hardware to processes.

Support code which is not required to run in kernel mode is in System Library. User programs
and other system programs works in User Mode which has no access to system hardware and
kernel code. User programs/ utilities use System libraries to access Kernel functions to get
system's low level tasks.

2.3 Basic Features

Following are some of the important features of Linux Operating System.

Portable - Portability means software can work on different types of hardware in same
way. Linux kernel and application programs support their installation on any kind of
hardware platform.

Open Source - Linux source code is freely available and it is community based
development project. Multiple teams work in collaboration to enhance the capability of
Linux operating system and it is continuously evolving.

Multi-User - Linux is a multiuser system means multiple users can access system
resources like memory/ ram/ application programs at same time.

Multiprogramming - Linux is a multiprogramming system means multiple applications


can run at same time.

Hierarchical File System - Linux provides a standard file structure in which system
files/ user files are arranged.

Shell - Linux provides a special interpreter program which can be used to execute
commands of the operating system. It can be used to do various types of operations, call
application programs etc.

Security - Linux provides user security using authentication features like password
protection/ controlled access to specific files/ encryption of data.

2.4 Architecture

Linux System Architecture is consists of following layers


Hardware layer - Hardware consists of all peripheral devices (RAM/ HDD/ CPU etc).

Kernel - Core component of Operating System, interacts directly with hardware,


provides low level services to upper layer components.

Shell - An interface to kernel, hiding complexity of kernel's functions from users. Takes
commands from user and executes kernel's functions.

Utilities - Utility programs giving user most of the functionalities of an operating


systems.

2.5 Linux Vs Windows

Linux Windows

Linux is an example of Open Source Windows is the family of operating


What is it? software development and Free system (OS) from Microsoft, which is
Operating System (OS). the most famous OS in the world.

Cost Linux can be freely distributed, For desktop or home use, Windows can
Linux Windows

downloaded freely, distributed through be expensive. A single copy can cost


magazines, Books etc. There are priced around $50 to $ 450 depending on the
versions for Linux also, but they are version of Windows.
normally cheaper than Windows.

Everyone. From home users to Everyone. From home users to


User developers and computer enthusiasts developers and computer enthusiasts
alike. alike.

Linux kernel is developed by the Microsoft created the Windows


community. Linus Torvalds oversees operating system, but allows other
Manufacturer things. computer manufactures to distribute
their own computers with Windows
pre-installed.

Linux can be installed on a wide variety On PC's desktops, laptops, servers and
of computer hardware, ranging from some phones.
Usage mobile phones, tablet computers
and video game consoles, to mainframes
and supercomputers.

Linux is developed by Open Source Windows is developed and distributed


Development development i.e. through sharing and by Microsoft.
and collaboration of code and features
Distribution through forums etc and it is distributed
by various vendors.

Linux typically provides two GUIs, The Windows GUI is an integral


KDE and Gnome. But there are millions component of the OS and is not
GUI
of alternatives such as LXDE, Xfce, replaceable. This can be a con when it
Unity, Mate, twm, ect. comes to Windows 8's Metro.

File system Ext2, Ext3, Ext4, Jfs, ReiserFS, Xfs, FAT, FAT32, NTFS, exFAT
support Btrfs, FAT, FAT32, NTFS

Text mode BASH (Bourne Again SHell) is the Windows uses a command shell and
interface Linux default shell. It can support each version of Windows has a single
Linux Windows

multiple command interpreters. command interpreter with dos-like


commands, recently there is the
addition of the optional PowerShell that
uses more Unix-like commands.

Price Free but support is available for a price. $50-$450

Linux has had about 60-100 viruses According to Dr. Nic Peeling and Dr
listed till date. None of them actively Julian Satchell's Analysis of the
spreading nowadays. Impact of Open Source Software there
Security
have been more than 60,000 viruses in
Windows. Anti Virus cost about $20 to
$400

In case of Linux, threat detection and After detecting a major threat in


solution is very fast, as Linux is mainly Windows OS, Microsoft generally
Threat
community driven and whenever any releases a patch that can fix the
detection and
Linux user posts any kind of threat, problem and it can take more than 2/3
solution
several developers start working on it months. Sometimes sooner, Microsoft
from different parts of the world releases patches and updates weekly.

Processors Dozens of different kinds. Limited but most (80%)

Ubuntu, Fedora, Red Hat, Debian, Windows 8, 8.1, 7, Vista, XP


Examples
Archlinux, Android etc.

Very few games available natively. Some Almost all games are compatible with
games can be played through Wine, but Windows. Some CPU intensive and
Gaming
often not all features are available. graphics intensive games are exclusive
to Windows PC's.

Although there are many GUI Everything can be controlled through


applications, most of the work is done GUI and incompatibility problems are
User
through Terminal (a console window), rare.
experience
and if a problem arrises GUI is rarely
usable to fix them.
Linux Windows

Because hardware manufacturers, such Combined with newest DirectX


Graphics as NVidia, often does not provide versions and full graphics card support
performance documentation for linux developers, the performance is almost as good as it
drivers cannot use full card performance. can get.

Company / Linus Torvalds Microsoft


developer

Linux is a Unix-like and POSIX- Microsoft Windows is a series of


compliant computer operating system graphical interface operating systems
Introduction assembled under the model of free and developed, marketed, and sold by
(from open source software development and Microsoft. Microsoft introduced an
Wikipedia) distribution. The defining component of operating environment named Windows
Linux is the Linux kernel, an operating on November 20, 1985 as a graphical
system kernel first released operating system shell for MS-DOS.

Available Multilingual Multilingual


language(s)

License GNU/Free Proprietary

All PowerPC: versions 1.0 - NT 4.0; DEC


Alpha: versions 1.0 - NT 4.0; MIPS
Supported R4000: versions 1.0 - NT 4.0; IA-32:
platforms versions 1.0 - 8; IA-64: version XP;
x86-64: versions XP - 8; ARM: version
RT;

Default user Gnome or KDE (Depends on distro) Graphical (Windows Aero)


interface

Preceded by Basic Terminal (CLI) MS-DOS

Source model Open Source Closed / Shared source

Update method Many Windows Update

Terminal Multi Terminal Windows --


2.6 Dual-Booting Windows and Linux

A dual-boot computer is one that is capable of running two different operating systems (but not
at the same time). It's also possible to build computers than can boot three or more different
operating systems, which are called multi-boot computers.

When designing a dual-boot system, the most important considerations are to make sure that
there's enough hard drive space to accommodate both systems, and to make sure that all of the
hardware is compatible with both systems. In practice, this means making sure it's all Linux-
compatible, since practically any recent hardware will work with Windows.

Step-By-Step Instructions to Create a Dual-Boot System

I'm going to assume that you're using one big hard drive, which will be partitioned into three
sections: One for the Windows system, one for the Linux system, and one big partition for shared
data.

1. Use a big hard drive (at least 500 GB is recommended - 750GB or 1TB would be even
better) so each system will have plenty of room, and there will be plenty of room for
documents and data.

2. Windows will be installed on the first partition because that's where Windows wants to be
installed, and it gets cranky when it's installed elsewhere. (Linux, on the other hand, is
more laid-back and doesn't care very much where it's installed.)

3. Boot to your Windows installation CD with the drive unpartitioned. When you get to the
part where Windows wants to know where to install itself, create a single NTFS partition
at the beginning of the drive.

If you're going to be creating a separate data partition (which I recommend), then a


partition size of 100GB should be enough for Windows and its programs. But if you plan
to install a lot of games, desktop publishing, graphics design, or Web development
applications, you probably should make the Windows system partition a little bigger
because those type of apps tend to be big and to include a lot of graphics files in their
program directories.

4. Let the installer finish installing Windows on the single partition you just created.

5. After Windows installs and reboots, activate it, install any additional needed drivers, and
download all the available Windows updates. This may require quite some time and
several reboots. (You can wait until after the Linux system is installed before installing
the Windows updates, if you like; but then if Windows vomits on an update, it may be
harder to fix once the dual-boot configuration is in place.)
6. Once all the updates are installed, from within Windows, create a new partition on the
hard drive for the shared data and give it a name (like "My Stuff," for example).

Make this partition big. How big? Well, basically subtract the space you'll need for your
Linux installation from however much space is available on the drive, and create a
partition of that size. So if you have 400 GB of free space, and you want to give Linux
100 GB, then make the shared data partition 300 GB.

7. When the new partition has been created, map your libraries to the new partition. This
will establish the new partition as the place to store your stuff, if you do it correctly.

8. Reboot the machine into Windows and log into your Windows user account. Wait until
the machine hascompletely started, and then shut it down. This is to insure that the
changes you just made have been saved to the registry.

9. Boot into your Linux installation CD or DVD. There will be some obvious link or button
to click to install Linux. If you're pretty sure that all your hardware is supported in Linux,
then just click that button. If not, then look for a link or button that says "Try Linux,"
"Run Live CD," or some such thing. If available with your distro, this will boot Linux
without actually installing it. (This option is available with Ubuntu, Mepis, Knoppix,
Fedora, and many other Linux distributions, but not all of them.)

10. Once you have decided to install, start the Linux installer.

11. Early on in the installation process, the Linux installer will ask you where to install
Linux. You'll be offered several options, one of which should be to use the unused hard
drive space. That's the option you want.

12. You'll be asked what Linux partitions you want to create. Unless you're already familiar
with Linux partitioning, I suggest you create only two: "/" and "swap." The swap partition
should be at least 1.5 times the amount of installed RAM. The / partition should consume
the rest of the unused space.

Unless you're an experienced Linux user with a reason to want a particular file system, I
suggest that you use whatever default file system the distribution recommends for the /
partition.

13. You probably will be asked to create a "root" or "administrator" account and password,
and a user account and password. Make your user account name in Linux the same as you
chose in Windows, and you have a better chance of the installer finding your Windows
data partition.
14. If the installer recognizes the shared data partition you created under Windows, and offers
to make it available to you in Linux, say yes. If it doesn't, no big deal. You can link it
later from within Linux.

15. At some point you will be asked to configure a bootloader (usually LILO or GRUB) and
write it to the MBR. The most important thing to do here is to make sure that the
bootloader the installer is proposing has recognized and offered to boot both your
Windows and Linux systems. This almost always happens without a hitch, but make sure
anyway.

By default, the bootloader usually will include other options, such as booting into Linux
repair mode, or the CD or floppy drive. Leave those options in place, as well. They could
come in handy.

16. You also will be offered the option of which system should be the default operating
system. Most times, Linux will choose itself, but you can override it if you like. The
default operating system is the one that will boot if you turn on the computer and do
nothing else. (When you want to boot to the non-default operating system, you just have
to hit the up or down arrow button on your keyboard to highlight the OS you want, and
then hit enter.)

Finally, you'll most likely be offered the option of how long the system should wait
before booting the default OS. The time the installer will suggest may range from ten to
30 seconds. That's how much time the system will give you to decide whether to hit the
up or down arrow to override booting the default OS.

17. Once you're sure that the bootloader recognizes all of the systems and that the options are
what you want, click the button or link to "write," "save," or "commit" the bootloader to
the MBR.

18. Depending on your Linux distribution, there may be some other steps, which should be
quite self-explanatory. Once the installer announces that it is finished, remove the
installation media (if instructed) and boot into Linux. Log into your account and
download whatever updates for itself it finds, then reboot back into Linux to make sure
that any changes have been fully configured.

2.7 Hard Disk Partitioning

Although it is possible to get a perfectly functioning Linux system running on a single-partition


system, and, in fact, is a bit easier to configure this way, there are a number of benefits from
partitioning one or more of your storage devices into multiple partitions.
There are several advantages to partitioning your disk for at least the four main file systems
(root, usr, home, and swap). These include:

First, it may reduce the time required to perform file system checks (both upon bootup and when
doing a manual fsck), because these checks can be done in parallel.

Also, file system checks are a lot easier to do on a system with multiple partitions. For example,
if I knew my /home partition had problems, I could simply unmount it, perform a file system
check, and then remount the repaired file system (as opposed to booting my system with a rescue
diskette into single-user mode and doing the repairs).

Second, with multiple partitions, you can, if you wish, mount one or more of your partitions as
read-only. For example, if you decide that everything in /usr will not be touched even by root,
you can mount the /usr partition as read-only.

Finally, the most important benefit that partitioning provides is protection of your file systems. If
something should happen to a file system (either through user error or system failure), on a
partitioned system you would probably only lose files on a single file system. On a non-
partitioned system, you would probably lose them on all file systems.

the following approximation of space works pretty effectively for determining a partition size.

Given:

A given disk of X Mb/Gb (eg. 2 Gb)

(Or, more than one disk with a combined total of X Mb/Gb)

Calculate:

(swap) about double main RAM (eg. 64 Mb system gets 128 Mb swap)
/ (root) about 10% of available (eg. 200 Mb)
/home about 20% of available (eg. 400 Mb)
/usr any remaining space (eg. 1272 Mb)

/var (optional -- see below)


/boot (optional -- see below)
/archive (optional -- see below)
Here is a description of the various mount points and file system information, which may give
you a better idea of how to best define your partition sizes for your own needs:

/ (root) - used to store things like temporary files, the Linux kernel and boot image,
important binary files (things that are needed before Linux can mount the /usr partition),
and more importantly log files, spool areas for print jobs and outgoing e-mail, and user's
incoming e-mail. It is also used for temporary space when performing certain operations,
such as building RPM packages from source RPM files. Therefore, if you have a lot of
users with a lot of e-mail, or think you will need plenty of temporary space, you might
want more space available. The partition type should be left as the default of 83 (Linux
native). In addition, you'll probably toggle the bootable flag on this partition to allow
boot information to be stored here.

/usr/ - should be the largest partition, because most of the binary files required by Linux,
as well as any locally installed software, web pages, Squid proxy cache, Samba share
services, some locally-installed software log files, etc. are stored here. The partition type
should be left as the default of 83 (Linux native).

/home/ - typically if you aren't providing shell accounts to your users, you don't need to
make this partition very big. The exception is if you are providing user home pages (such
as school web pages), in which case you might benefit from making this partition larger.
Again, the partition type should be left as the default of 83 (Linux native).

(swap) - Linux provides something called "virtual memory" to make a larger amount of
memory available than the physical RAM installed in your system. The swap partition is
used with main RAM by Linux to accomplish this. As a rule of thumb, your swap
partition should be at least double the amount of physical RAM installed in your system.

If you have more than one physical hard drive in your system, you can create multiple swap
partitions. This can improve the performance of swapping by taking advantage of parallel disk
access. For example, on a 256 Mb system with four drives, I would probably create four 128 Mb
swap partitions, for a total of 256 Mb RAM, 512 Mb swap (for a combined total of 768 Mb
available as virtual memory). The partition type needs to be changed to 82 (Linux swap).

Note: Note: It is a common misconception that Linux has a 128 Mb swap size limit. This was
true in the past, but in modern Linux distributions, the size depends on your architecture (for
example, Intel systems can have swap sizes as large as 2 Gb). Type ``man mkswap'' for more
information.

/var/ (optional) - You may wish to consider splitting up your / (root) partition a bit further.
The /var directory is used for a great deal of runtime storage, including mail spools (both
ingoing and outgoing), print jobs, process locks, etc. Having this directory mounted under
/ (root) may be a bit dangerous because a large amount of incoming e-mail (for example),
may suddenly fill up the partition. Since bad things can happen (eg. system crash?) when
the / (root) partition fills up, having /var on its own partition may avoid such problems.
I've had success in taking whatever space I've allocated to / (root), perhaps doubling it,
and then creating separate partitions for / (root) and for /var. The partition type should be
left as the default of 83 (Linux native).
/boot/ (optional) - In some circumstances (such as a system set up in a software RAID
configuration) it may be necessary to have a separate partition from which to boot the
Linux system. This partition would allow booting and then loading of whatever drivers
are required to read the other file systems. The size of this partition can be as small as a
couple Mb; I recommend approximately 10 Mb (which should give you plenty of room to
store the kernel, initial RAMdisk image, and perhaps a backup kernel or two). The
partition type should be left as the default of 83 (Linux native).

/archive/ (optional) - If you have any extra space lying around, perhaps you would benefit
from a partition for a directory called, for example, /archive. You can then use the
/archive directory to store backup material, large or infrequently accessed files, samba
file services, or whatever else you can find a use for it. The partition type can be left as
the default of 83 (Linux native), or if you want to access it from both Linux as well as
from another operating system, you could change it to a different ID, such as 6 (DOS 16-
bit >=32M).

As extra drive(s) are added, further partitions can be added to the new drives, mounted at various
mount-points as required -- this means a Linux system never needs to worry about running out of
space. As an example, if in the future it is clear that sda6 is starting to get filled up, we could add
another drive, set a nicely sized partition with a mount-point at /usr/local -- and then transfer all
the information from /usr/local over to the new drive. But no system or application component
would "break" because Linux would see /usr/local no matter where it was located.

2.8 Swap Space

Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system
needs more memory resources and the RAM is full, inactive pages in memory are moved to the
swap space. While swap space can help machines with a small amount of RAM, it should not be
considered a replacement for more RAM. Swap space is located on hard drives, which have a
slower access time than physical memory.

Swap space can be a dedicated swap partition (recommended), a swap file, or a combination of
swap partitions and swap files.

Swap should equal 2x physical RAM for up to 2 GB of physical RAM, and then an additional 1x
physical RAM for any amount above 2 GB, but never less than 32 MB.

So, if:
M = Amount of RAM in GB, and S = Amount of swap in GB, then
If M < 2
S = M *2
Else
S=M+2
Using this formula, a system with 2 GB of physical RAM would have 4 GB of swap, while one
with 3 GB of physical RAM would have 5 GB of swap. Creating a large swap space partition can
be especially helpful if you plan to upgrade your RAM at a later time.
For systems with really large amounts of RAM (more than 32 GB) you can likely get away with
a smaller swap partition (around 1x, or less, of physical RAM).

2.9 Logical Volume Management (LVM)

Logical volume management is a widely-used technique for deploying logical rather than
physical storage. With LVM, "logical" partitions can span across physical hard drives and can be
resized (unlike traditional ext3 "raw" partitions). A physical disk is divided into one or more
physical volumes (Pvs), and logical volume groups (VGs) are created by combining PVs as
shown in Figure 1. LVM internal organization. Notice the VGs can be an aggregate of PVs from
multiple physical disks.

Figure 1. LVM internal organization

Figure 2. Mapping logical extents to physical extents shows how the logical volumes are mapped
onto physical volumes. Each PV consists of a number of fixed-size physical extents (PEs);
similarly, each LV consists of a number of fixed-size logical extents (LEs). (LEs and PEs are
always the same size, the default in LVM 2 is 4 MB.) An LV is created by mapping logical
extents to physical extents, so that references to logical block numbers are resolved to physical
block numbers. These mappings can be constructed to achieve particular performance,
scalability, or availability goals.

Figure 2. Mapping logical extents to physical extents

For example, multiple PVs can be connected together to create a single large logical volume as
shown in Figure 3. LVM linear mapping. This approach, known as a linear mapping, allows a file
system or database larger than a single volume to be created using two physical disks. An
alternative approach is a striped mapping, in which stripes (groups of contiguous physical
extents) from alternate PVs are mapped to a single LV, as shown in Figure 4. LVM striped
mapping. The striped mapping allows a single logical volume to nearly achieve the combined
performance of two PVs and is used quite often to achieve high-bandwidth disk transfers.

Figure 3. LVM linear mapping


Figure 4. LVM striped mapping (4 physical extents per stripe)

Through these different types of logical-to-physical mappings, LVM can achieve four important
advantages over raw physical partitions:

1. Logical volumes can be resized while they are mounted and accessible by the database or
file system, removing the downtime associated with adding or deleting storage from a
Linux server

2. Data from one (potentially faulty or damaged) physical device may be relocated to
another device that is newer, faster or more resilient, while the original volume remains
online and accessible

3. Logical volumes can be constructed by aggregating physical devices to increase


performance (via disk striping) or redundancy (via disk mirroring and I/O multipathing)

4. Logical volume snapshots can be created to represent the exact state of the volume at a
certain point-in-time, allowing accurate backups to proceed simultaneously with regular
system operation

2.10 Differences between LVM1 and LVM2

The new release of LVM, LVM 2, is available only on Red Hat Enterprise Linux 4 and later
kernels. It is upwardly compatible with LVM 1 and retains the same command line interface
structure. However it uses a new, more scalable and resilient metadata structure that allows for
transactional metadata updates (that allow quick recovery after server failures), very large
numbers of devices, and clustering. For Enterprise Linux servers deployed in mission-critical
environments that require high availability, LVM2 is the right choice for Linux volume
management. Table 1. A comparison of LVM 1 and LVM 2summarizes the differences
between LVM1 and LVM2 in features, kernel support, and other areas.
Features LVM1 LVM2

RHEL AS 2.1 support No No

RHEL 3 support Yes No

RHEL 4 support No Yes

Transactional metadata for fast


recovery No Yes

Shared volume mounts with GFS No Yes

Cluster Suite failover supported Yes Yes

Striped volume expansion No Yes

256 PVs, 256 2**32 PVs, 2**32


Max number PVs, LVs LVs LVs

8 Exabytes (64-bit
Max device size 2 Terabytes CPUs)

Volume mirroring support No Yes, in Fall 2005

Table 1. A comparison of LVM 1 and LVM 2

2.11 Boot Loader

A boot loader, also called a boot manager, is a small program that places the operating
system (OS) of a computer into memory. When a computer is powered-up or restarted, the basic
input/output system (BIOS) performs some initial tests, and then transfers control to the master
boot record (MBR) where the boot loader resides. Most new computers are shipped with boot
loaders for some version of Microsoft Windows or the Mac OS. If a computer is to be used
with Linux, a special boot loader must be installed.

For Linux, the two most common boot loaders are known as LILO(LInux LOader) and
LOADLIN (LOAD LINux). An alternative boot loader, called GRUB (GRand Unified
Bootloader), is used with Red HatLinux. LILO is the most popular boot loader among computer
users that employ Linux as the main, or only, operating system. The primary advantage of LILO
is the fact that it allows for fast boot-up. LOADLIN is preferred by some users whose computers
have multiple operating systems, and who spend relatively little time in Linux. LOADLIN is
sometimes used as a backup boot loader for Linux in case LILO fails. GRUB is preferred by
many users of Red Hat Linux, because it is the default boot loader for that distribution.

2.12 Installation of Red Hat Linux Operating System

As the open source revolution grows around the world, more and more people are starting to
switch over to the Linux Operating System and pre-eminent of all the Linux OS is the Red Hat
Linux, owned and distributed by the Red Hat Inc. However, installation of Linux itself is seen as
a rather arduous and herculean task among many beginners/inexperienced users. As a result this
document has been formulated as a step-by-step guide to ensure that everybody can install and
use Red Hat Linux seamlessly and with ease. So lets start the installation, here are the steps to
easily install Red Hat Linux:

Step 1 Insert the Red Hat Linux DVD into the DVD-drive of your computer. As soon as the
following screen pops up, press Enter to install Red Hat Enterprise Linux (RHEL) through GUI
mode.

Step 2- RHEL installer would then prompt you conduct a check as to whether the CD media
from which youre installing is functioning correctly or not. Choose Skip, press enter and the
installation would begin.
Step 3- Next, we need to select the language- English or any other language as per your
preference, and then press Next .

Step 4- In this step, the RHEL installer would ask you about the appropriate type of keyboard for
the system. We take the US English keyboard, you can pick any other option depending on the
type of your keyboard. Then press Next to move to the next step.
Step 5- Next, the installer would ask for an installation number if you wish to install full set of
Red Hat functionalities. Enter the installation number and press OK if you have an officially
licensed installation number (for corporate clients that buy Red Hats backup support and full
features).

Others can select Skip entering installation number and press OK to proceed. RHEL would
show a warning message, press Skip in it to continue.
Step 6- The Red Hat installer would then require you to create partitions in your computers hard
disk for the installation. You can do it in four ways but the simplest way is to select Use free
space on selected drives and create default layout as this option will not affect any other OS
residing in your system.

Check the review and modify portioning layout to create partitions and click next.

Step 7- In this step you must create the required system partitions and mount points such as
/boot, /home, swap etc which are required for the Linuxs proper functioning.

To create different partitions such as /home, /var etc, click on New to create the partitions.
Then, select /home in the mount point and choose ext3 as the file system and give the desired
size for it and then click OK. Similarly also create /boot and /var.

Also, create a swap partition by clicking on New and then choosing the file system as swap
and also give the size of Swap partition.(Usually size of swap partition SHOULD BE twice the
size of RAM available to the system but you can keep its size less than that too)
Once you have made all the desired partitions and given their mount points, click Next to
continue installation.

Disk Druid is an interactive program for editing disk partitions. Users run it only within the
Fedora Core installation system. Disk Druid supports RAID and LVM to provide more extensible
and reliable data storage.

Disk Druid displays the following actions in the installation program:


New: Select this option to add a partition or LVM physical volume to the disk. In the Add
partition dialog, choose a mount point and a partition type. If you have more than one disk on
the system, choose which disks the partition may inhabit. Indicate a size in megabytes for the
partition.

You may also choose from three options for sizing your partition:

Fixed size: Use a fixed size as close to your entry as possible.

Fill all space up to: Grow the partition to a maximum size of your choice.

Fill to maximum allowable size: Grow the partition until it fills the remainder of the selected
disks.

After you enter the details for your partition, select OK to continue.

Edit: Select this option to edit an existing partition, LVM volume group, or an LVM physical
volume that is not yet part of a volume group. To change the size of a LVM physical volume
partition, first remove it from any volume groups.

Edit a partition to change its size, mount point, or file system type. Use this function to:

correct a mistake in setting up your partitions

migrate Linux partitions if you are upgrading or reinstalling Fedora Core

provide a mount point for non-Linux partitions such as those used on some Windows
operating systems

Delete: Select this option to erase an existing partition or LVM physical volume. To delete an
LVM physical volume, first delete any volume groups of which that physical volume is a
member. If you make a mistake, use the Reset option to abandon all the changes you have made.

Reset: Select this option to force Disk Druid to abandon all changes made to disk partitions.

RAID: Select this button to set up software RAID on your Fedora system.

Create a software RAID partition

Choose this option to add a partition for software RAID. This option is the only choice
available if your disk contains no software RAID partitions.

Create a RAID device


Choose this option to construct a RAID device from two or more existing software RAID
partitions. This option is available if two or more software RAID partitions have been
configured.

Clone a drive to create a RAID device

Choose this option to set up a RAID mirror of an existing disk. This option is available if
two or more disks are attached to the system.

LVM: Select this button to set up LVM on your Fedora system. First create at least one partition
or software RAID device as an LVM physical volume, using the New dialog.

To assign one or more physical volumes to a volume group, first name the volume group.
Then select the physical volumes to be used in the volume group. Finally, configure
logical volumes on any volume groups using the Add, Edit and Delete options.

Step 8- This step pertains to the default OS that will be loaded by the GRUB loader

(Note- If you have multiple Operating Systems installed, you would see multiple options here
and you have to check in front of the OS name that you want to be loaded by default when the
system is started.)

Click Next to continue.

Step 9- This step pertains to the network settings of the Linux system that you are going to
install. You can select the Ethernet devices through which the system would communicate with
other devices in the network.
You can also provide the hostname, Gateway address and DNS address to the system during this
step. (However its better to adjust these settings once the system has been fully installed).

Step 10- The next step is to adjust the system clock to your particular time zone. Select your
time zone and then click Next.

Step 11 This is a very important step that deals with the root (super-user) password for the
system . Type the password and confirm it and then click next.
Step 12 The RHEL installer would then prompt you about if you wish to install some extra
Software Development or Web Server features. By default, keep it at Customize later and
press Next.

Step 13- This next step will initiate the installation of Red Hat Linux, press Next to begin the
process.
Step 14- Upon the completion of installation you should the following screen. Press Reboot and
youd be ready to use your newly installed Red Hat Linux OS.

POST INSTALLATION CONFIGURATIONS

1. Accept the Red Hat License agreement and click Forward.


2. The next step is regarding the configuration of the Firewall. You can Enable or Disable the
firewall according to your preferences and then click Forward.

3. Next step is about the configuration of another security tool- SE Linux. By default you should
keep it Disabled unless youre working with very secure information.
4. You can also choose to configure the Kdump, that stores information about system crashes if
your system fails but uses valuable disk space. By default dont enable it.

5. Next, adjust the time and date settings, and then click Forward.
6. The next step is for software updates from Red Hat, at this point you should skip the
registration and register at a later time and then click Forward.

7. This step is to create a non-admin user for the system. Enter the details and click Forward.
8. This step is about configuration of your Sound Card, choose a sound device and then click
Forward.

9. Click Forward to complete the configurations and start using your Red Hat Linux OS.
(Note- On clicking Finish the system would require a reboot if you have made changes to the
configurations of Firewall or SE Linux.)

Your Red Hat Linux OS is now all installed and configured, ready to be used. Good luck
using and exploring various features of Red Hat Linux.

2.13 Command Line Interface Definition

A command line interface (CLI) is a type of human-computer interface (i.e.,


a way for humans to interact with computers) that relies solely on textual
input and output. That is, the entire display screen, or the currently active
portion of it, shows only characters (and no images), and input is usually
performed entirely with a keyboard.

The CLI gets its name from the fact that it is an interface which contains
command lines. A command line is a space on the display screen in which
commands (i.e., instructions telling a computer to do something) are typed in
by the user. Pressing the ENTER key after typing in a command causes that
command to be passed to the shell. A shell, also referred to as a command
interpreter, is a program that provides the CLI as well as reads commands
that are typed on a keyboard and then executes (i.e., runs) them. The results
of executing many, but not all, commands are also shown on the command
line.

2.14 Filesystem Hierarchy Standard

The Filesystem Hierarchy Standard (FHS) defines the directory structure and directory contents
in Unix and Unix-like operating systems, maintained by the Linux Foundation.

In the FHS all files and directories appear under the root directory "/", even if they are stored on
different physical or virtual devices.
/ It is the root directory in Linux FHS.
/bin Linux executable commands
Contains files required for the Linux boot process, including the
/boot
kernel image(s)
/dev System devices (terminals, disks, tapes, etc...)
/etc System information and configuration
Directories where individual accounts for local machine are
/home
stored
/lib Programming and system libraries
/ When the filesystem cannot properly identify files, they are
lost+found placed in this directory.
/misc Miscellaneous programs
Mounting point for temporary filesystems (e.g. cd-roms, floppy
/mnt
drives)
/opt Contains random data that has no other logical destination
/proc Contains information about the kernel and running processes
/root The root user's (system administrator's) home directory
Linux executable commands like /bin, but generally reserved
/sbin
for the root user (system administrator)
/scratch Temporary work space for users
/tmp Temporary work space for programs
Directories containing additional commands, libraries, and
/usr
system information
Contains files of variable file storage which are constantly
/var being written to or changed (e.g. printing queues, mail spoolers,
system logs, webpages)

Linux Directory and File Naming Conventions

Linux adheres to the following rules for file and directory names:

A file or directory name can have from 1 to 256 characters in length.

Linux is case sensitive -- uppercase characters are different from lowercase characters.

File or directory names can include letters, numbers, and the following special characters:
period ( . ), underscore ( _ ), and dash ( - ).
The special characters comma ( , ), quotes ( ' , " , or ` ), slash ( / ), backslash ( \ ) and
space can be used in file or directory names, but are highly advised against.

Linux provides two wildcard characters to represent ambiguous characters or strings in file or
directory names:

The question mark ( ? ) represents any single character.


(e.g.: ls file?.txt would list file1.txt file2.txt, but not file50.txt)

The asterisk ( * ) represents any string of zero or more characters.


(e.g.: ls file*.txt would list file.txt file1.txt file2.txt file50.txt, but not file01.data)

Basic File Management Tasks

Navigation Commands - [ pwd, cd ]


pwd
This command is used to find the current location or current working directory.
Eg:
[user@ws26 ~]$ pwd
/home/user

cd
This command is used to change the directory. You can move from one directory to another using
this command. Few examples are given below.

Consider you have a directory structure /home/user/test/test1/ . test and test1 are directories in
user home.

Example 1:
Consider you have a directory "test" in /home/user. Your current working directory is /home/user.
You want to change your current working directory from /home/user to /home/user/test, use the
following command
[user@ws26 ~]$ pwd
/home/user
[user@ws26 ~]$ cd test
[user@ws26 ~]$ pwd
/home/user/test

Example 2:
If you want to move back to /home/user, use the following command
[user@ws26 ~]$ cd ..
[user@ws26 ~]$ pwd
/home/user

Example 3:
To get back to the home directory of the user
[user@ws26 ~]$ cd ~
[user@ws26 ~]$ pwd
/home/user.

Listing contents in a directory - [ ls, ls -l, ll ]

ls
This command is used to list all the files and directory in the current directory.

Eg:
[user@ws26 ~]$ ls
1152696870.jpg book OperaDownloads snapshot52.png
image300.jpg Desktop test spiderman2.jpg

ls -l or ll
This command is also used to list all the files and directories. Here you will get more details
about the files and directories present in the current directory. You will see the permission set,
creation date, file / directory size etc.

Eg:
[user@ws26 ~]$ ls -l
total 5
-rw-rw-r-- 1 user user 33188 Dec 22 02:56 1152696870.jpg
-rw-rw-r-- 1 user user 17647 Aug 19 2006 534458.gif
-rw-rw-r-- 1 user user 26817 Aug 19 2006 534477.gif
drwxrwxr-x 2 user user 4096 Jan 13 04:20 book
drwx------ 3 user user 4096 Feb 4 02:34 Desktop

Wildcards in ls command

There are 3 types of wildcards that can be used Linux. They are the *, ? and [ ] .

* (Asterisk) Wildcard

This represents any sequence of characters. This means that if you include a * in your filename
then that part of the filename can be formed using any sequence of characters. The example
below explains this concept:

$ ls *gif

Would list all the files having the letters ' gif ' in them. So a file named somegifs.txt as well as a
file named 123.gif would be listed in the output.

$ ls *.gif

Would list all the files having 'gif ' as the extension of their filename. Thus in this case a file
named somegifs.txt file would NOT be listed since its extension is not ' gif '. Whereas a file
named 123.gif would be listed.

? (Question Mark) Wildcard

This represents only one character which can be any character. Thus in case you know a part of a
filename but not one letter, then you could use this wildcard. If there are many files that are
named such as article10, article11 and so on till article19 you could get all these files by using
article1? . In this case the ? would be interpreted as any one character and it would find all the
files like article10, article11..and so on till article19, since all these files differ in their names by
only the last letter.

$ ls article1?

Would list all the files that begin with ' article1 ' and have one more character in their names
which can be any one valid character.

[ ] (Square Brackets) Wildcard


This represents a range of characters. So in case you have files that are named article10,
article11, article12..all the way till article19 then you could select all the first 5 of them using the
above wildcard as shown below

$ ls article1[0-4]

Remember that [] represents a range from which any character can be present. This range can be
something like [0-4] or [1-9] or anything like that in case of numbers. Letters could also be
selected such as [a-g] or [F-Z] or [A-Z].

Reading files in Linux - [ cat, more, less ]

cat
This command is used to display the contents of a file. You can read the file contents using the
cat command.

Example:
[user@ws26 ~]$ cat testfile
this is a test file.. You can read me..

Less and More


Both the less and more commands serve similar function. They are used to display file one
screen at a time. You can press spacebar to continue reading the file. These commands are mainly
used while reading large files.

Example 1:
[user@ws26 ~]$ less testfile
this is a test file.. You can read me..

Example 2:
[user@ws26 ~]$ more testfile
this is a test file.. You can read me..

Manipulating files - [ cp, mv, rm, mkdir ]

cp
This command is used to copy files/directory.

Example:
[user@ws26 ~]$ cp file1 directory1
This will copy the file1 into the directory1
cp -R
This command is used to copy directories recursively (copy all the files and folders inside the
directory).

Example:
[user@ws26 ~]$ cp directory2 directory1
This will copy the whole directory2 into directory1

mv
This command is used to move the file or directory.

Example:
[user@ws26 ~]$ mv directory2 directory1
This will move the whole directory2 into directory1

rm
This command is used to remove or delete files and directories.

Example:
[user@ws26 ~]$ rm directory2
This will delete the directory - directory2

mkdir
This command is used to create a new directory

Example:
[user@ws26 ~]$ mkdir directory3
This will create a new directory - directory3.

Create new file in Linux - vi editor

The Vi editor is mainly used to create new files in Linux.


Example:
vi testfile
The command will open a new window and you can insert text to it. To begin press "i". After
adding your content press ":wq" to save the file.

Piping and Redirection

Two powerful features of the Linux command line shell are redirection and pipes
which allow the output (or even input) of a program to be sent to a file or another
program. You may have already used this features without being aware of it.
Whenever you have used the > sign in a command or | then you have used
redirection or a pipe, respectively.

On all Unix-like operating systems, like Linux and FreeBSD, the output from a command line
program automatically goes to a place known as standard output (stdout). By default, standard
output is the screen (the console) but that can be changed using pipes and redirection. Likewise
the keyboard is considered the standard input (stdin) and as with standard out, it can be changed.

Pipes

Pipes allow you to funnel the output from one command into another where it will be used as the
input. In other words, the standard output from one program becomes the standard input for
another.

The more command takes the standard input and paginates it on the standard output (the
screen). This means that if a command displays more information than can be shown on one
screen, the more program will pause after the first screen full (page) and wait for the user to
press SPACE to see the next page or RETURN to see the next line.

Here is an example which will list all the files, with details (-la) in the /dev directory and pipe the
output to more. The /dev directory should have dozens of files and hence ensure that more needs
to paginate.

ls -la /dev | more

Notice the --More-- prompt at the bottom of the screen. Press SPACE to see the next page and
keep pressing SPACE until the output is finished.

Here is another pipe example, this time using the wc (word count) tool.

ls -1 /dev | wc

wc counts the numbers of lines, words and characters in the standard input. If you use the l
parameter it will display only the number of lines, which is good way to see how many files are
in a directory!

Redirection

Redirection is similar to pipes except using files rather than another program. The standard
output for a program is the screen. Using the > (greater than) symbol the output of a program can
be sent to a file. Here is a directory listing of /dev again but this time redirected to a file
called listing.txt

ls -la > listing.txt


There wont be anything displayed on the terminal as everything was sent to the file. You can
take a look at the file using the cat command (which can be piped into more) or for convenience
you can just use the more command on its own:

more listing.txt

If listing.txt had already existed, it will be overwritten. But you can append to an existing file
using >> like this:

ls -la /home > listing.txt

ls -la /dev >> listing.txt

The first redirection will overwrite the file listing.txt while the second will append to it.

The cat command can be used to create a file using redirection, for example:

cat > atextfile.txt

Now whatever text you type will be sent to the file atextfile.txt until you press Control-D, at
which point the file will be closed and you will be returned to the command prompt. If you want
to add more text to the file use the same command but with two greater than signs (>>).

Working with Vi Editor

vi (visual editor) is the default editor that comes with the UNIX/Linux operating system.

The vi editor is a full screen editor and has two modes of operation:

1. Command mode commands which cause action to be taken on the file, and

2. Insert mode in which entered text is inserted into the file.

In the command mode, every character typed is a command that does something to the text file
being edited; a character typed in the command mode may even cause the vi editor to enter the
insert mode. In the insert mode, every character typed is added to the text in the file; pressing the
Esc key turns off the Insert mode. While there are a number of vi commands, just a handful of
these are usually sufficient for beginning vi users.

Both UNIX/Linux and vi are case-sensitive. Be sure not to use a capital letter in place of a
lowercase letter; the results will not be what you expect.

Basic vi Commands
Start vi

vi Filename - Open Filename in command mode

If Filename exists, the file will be displayed on the screen. If Filename does not exist, then an
empty file is created for entering text.

The screen looks like:

Exit vi

In the following, [Enter] means press Enter key after the keystrokes.

Keystrokes Meaning

:x [Enter] exit vi, save the modified file to file named

:wq [Enter] exit vi, save the modified file to file named

:q [Enter] exit vi

:q! [Enter] exit vi, without saving the modified file

Insert or Add Text

The following keystroke will lead to insert mode for inserting and adding text. Esc key must be
pressed to terminate the insert mode.

Keystroke Meaning

i insert text before cursor, until Esc key is pressed

a append text after cursor, until Esc key is pressed

o open a new line below current line, until Esc key is pressed

Cursor Movement Commands


In the command mode, move along the cursor on the screen.

Keystroke Meaning

h Cursor is moved one space to the left

l Cursor is moved one space to the right

j Cursor is moved one line down

k Cursor is moved one line up

Change Text

Keystroke Meaning

r Replace one character over the cursor

R Overwrite text until the keystroke of Esc

Delete Text

Keystroke Meaning

x delete single character under cursor

dd delete the current line

Ndd delete N lines, beginning with the current line

Cut and Paste Text

Keystroke Meaning

yy copy (yank, cut) the current line into the buffer

Nyy copy (yank, cut) the next N lines into the buffer
p paste the copied line(s) into the text after the current line

Screen Manipulation

In the table below, the symbol ^ before a letter means that the Ctrl key should be held down
while the letter key is pressed.

Keystroke Meaning

^f move down (forward) one screen

^b move up (backward) one screen

^d move down (forward) one half screen

^u move up (back) one half screen

Search and Replace Text

A common occurrence in text editing is to replace one word or phase by another. To locate
instances of particular sets of characters (or strings), use the following commands:

Keystroke(s) Meaning

/string [Enter] search forward for occurrence of 'string' in text

?string [Enter] search backward for occurrence of 'string' in text

n [Enter] move to next occurrence of search string

:%s/oldstring/newstring/cg search 'oldstring' and replace it with 'newstring' in the


[Enter] entire file

Determine Line Number

Keystroke(s) Meaning

:.= [Enter] returns line number of current line at bottom of screen


:= [Enter] returns the total number of lines at bottom of screen

:set number [Enter] provides the line number for the entire file

SED (Stream EDitor )

Sed is a stream editor. A stream editor is used to perform basic text transformations on an input
stream (a file or input from a pipeline). While in some ways similar to an editor which permits
scripted edits (such as ed), sed works by making only one pass over the input(s), and is
consequently more efficient. But it is sed's ability to filter text in a pipeline which particularly
distinguishes it from other types of editors.

-n, --quiet, --silent

suppress automatic printing of pattern space

-e script, --expression=script

add the script to the commands to be executed

-f script-file, --file=script-file

add the contents of script-file to the commands to be executed

-i[suffix], --in-place[=suffix]

edit files in place (makes backup if extension supplied)

-l N, --line-length=N

specify the desired line-wrap length for the `l' command

-r, --regexp-extended

use extended regular expressions in the script.

-s, --separate

consider files as separate rather than as a single continuous long stream.

-u, --unbuffered

load minimal amounts of data from the input files and flush the output buffers more often
--help

display this help and exit

-V, --version

output version information and exit

If no -e, --expression, -f, or --file option is given, then the first non-option argument is taken as
the sed script to interpret. All remaining arguments are names of input files; if no input files are
specified, then the standard input is read.

Вам также может понравиться