partitioning. You are asked to select the disk drive to use.
If you wish to partition the disk yourself, you would select partitions similar to what we
explored with our CentOS installation. Figure 8.14 demonstrates this process through the
install window and the new partition window. First, you select your hard disk (/dev/sda in
this case) and select New Partition Table… A pop-up window warns you that you might be
destroying previous partitions (as we have selected an entire hard disk to partition). Now,
we see (as shown in Figure 8.14) that /dev/sda consists solely of free space (17,179 MB in this
case). Click on Add… to create a new partition and the pop-up window shown on the right
FIGURE 8.13
Ubuntu install window.
FIGURE 8.14
Creating Ubuntu partitions.
Installing Linux
◾
333
side of Figure 8.14 appears. You now fill out the new partition information by specifying the
size, type, and mount point. Types are the same as with CentOS but you have a few addi-
tional types available: ResierFS, btrfs, JFS, Fat16, and Fat32. You can also specify if this will
be a primary partition, a logical partition, and whether the new partition should start at the
next available free location on the disk or end at the last remaining free location on the disk.
At this point, as with CentOS, you are asked to specify your time zone, keyboard lay-
out, and establish an initial user account. Unlike in CentOS, this happens concurrently
while the installation package is being unpacked and copied. After establishing your initial
account, installation occurs without interruption. However, you have the option of scroll-
ing through information about what Ubuntu has to offer. The installation process only
takes a few minutes. You are then required to restart your computer (or VM).
At this point, you are ready to use Ubuntu. Unlike the CentOS installation where there
are two separate accounts whose passwords you specified during installation (root and an
initial user), here, you have only specified one password, that of the initial user. In fact, root
is given an initially random password. To then accomplish any system administrator tasks,
this would normally leave the original user in a bind. You do not know the root password
and yet you need to be able to accomplish system administrative tasks. To get around this
problem, Ubuntu establishes this initial user account with some administrative capabili-
ties. This is similar to the Windows 7 operating system. From the GUI, this administrator
user has access to most system administrator programs. From the command line, the user
would have to accomplish the tasks through the program
sudo
. The sudo command is
used by one user to carry out commands as another user. The typical usage is to carry out
tasks as root without having to log in as root. We will explore sudo in detail in Chapter
9. For now though, when you issue a system administrator command from the command
line, you would precede it with the word sudo as in:
•
sudo chown foxr file1.txt
—change the owner of the given file to foxr
•
sudo more /etc/shadow
—view a file that is otherwise unreadable by nonroot
•
sudo useradd –m
newuser
—create account for
newuser
(the useradd instruc-
tion is covered in Chapter 9)
•
sudo /etc/init.d/network restart
—restart the networking service
•
sudo visudo
—edit the sudo configuration file to establish further sudo rights for
other users
Although it might seem inconvenient to not be able to directly access the root account,
there are advantages to this approach. It simplifies the initial user’s life in two ways. The
user does not have to remember multiple passwords and the user does not have to specify a
root password. It also saves the possible confusion of a Linux user who switches to root to
carry out a task and then forgets to switch back to their normal user account. Here, you are
never root, but to carry out a root task, you must use sudo. Further, every sudo command
is logged so that a history of commands can be explored at a later time.
334
◾
Linux with Operating System Concepts
You could change the root password using sudo although this is strongly discouraged.
Doing so would require the command
sudo passwd root
You would then be prompted to enter the new password and confirm it.
8.5 SOFTWARE INSTALLATION CHOICES
While we focus on software installation in Chapter 13, there are a number of options avail-
able when installing Linux. In CentOS, for instance, the OS installation process allows
you to specify additional packages to install. Only portions of these packages are installed
depending on the type of installation selected (e.g., Desktop, Minimal Desktop, etc.). The
packages are broken into 14 categories including Applications, Base System, Databases,
Desktops, Development, Servers, System Management, and Web Services. Below, we focus
in more detail on some of the options to these packages (other packages such as Languages,
Load Balancer, etc., are not discussed here).
Application packages include Emacs, Graphics Creation Tools, Internet Applications,
Internet Browsers, and the Office Suite. Within each of these packages, there are multiple
programs and subpackages available. For instance, under Graphics, you can find the GNU
Image Manipulation Program (GIMP) along with GIMP plugins, help files, and support
files. There is a vector-drawing program and a program for displaying and manipulat-
ing images in X Windows. There is the SANE program and software to support SANE.
The Internet browser package includes versions of Firefox and Firefox plugins. The Office
Suite has individual programs for word processing, presentation graphics, spreadsheets
and databases, as well as support programs.
Base systems include packages for backups, client management, console tools for
remote login over the Internet, debugging tools, support for various programming lan-
guages (Java, Perl, and Ruby), network tools, and scientific computation applications. All
the database packages revolve around MySQL (client and server) and PostgreSQL (client
and server).
Another set of packages provide different desktop programs and environments. The
default desktop for CentOS is Gnome. If you install a minimal desktop during installation,
you are only provided minimal Gnome programs. The full desktop installation provides all
of Gnome. The desktop packages include the KDE desktop, the X windows system, extra
fonts, and remote desktop client programs.
The development packages provide programming tools for software developers. These
include Ant for Java, a version of Python, the Yacc tool to construct your own language
compilers, C
++
support added to the GNU’s C compiler, Fortran 77, Ada 95, Object-C,
subversion for version control, and other useful programs.
The server packages include a backup server, network storage and file servers, an email
server, an FTP server, a print server, and server-oriented system administration tools. The
web server is located under the Web Services packages. The default web server for CentOS is
Apache. Other packages available under Web Services are the LDAP authorization module
Installing Linux
◾
335
for Apache, the Kerberos authentication module for Apache, SSL software, the Squid proxy
server, and language support for Apache including PHP and Perl.
8.6 VIRTUAL MEMORY
During the installation of both CentOS and Ubuntu, we created a swap partition. We
might find our system performing very poorly without this partition. Let us explore what
the swap partition is and what it is used for.
With our modern multitasking operating systems, it is desirable to run many programs
at one time. Programs require memory space to store both the code and the data. Even
with large amounts of RAM like 8 GB, it is possible and even likely that you will run out
of available memory space while running programs. Virtual memory extends the main
memory to the hard disk. The idea is that whatever cannot fit into the memory will be
placed in virtual memory for the time being. Virtual memory is implemented by creating
swap space on the hard disk. By having its own swap partition, swap space is treated differ-
ently from the rest of the file space that can lead to improved performance over ordinary
hard-disk access.
The implementation details for virtual memory will differ from operating system to
operating system. Here, we look at the typical strategy. First, we divide the program’s code
and data space into fixed-sized units called
pages
. The number of pages that a program
will require differs from program to program. One program may consist of four pages and
another may consist of 4000 pages.
The operating system is in charge of loading pages into the memory as are needed.
Memory is itself divided into fixed-sized units called
frames
. One page precisely fits into
one frame. That is, the page size and the frame size are the same.
Let us consider an example of a program that comprises 12 pages. Upon starting the
program, the operating system copies the entire program into swap space. Now, it decides
to load the first set of pages of this program into the memory. Let us assume it decides to
load four pages of this program. The operating system finds four available frames and loads
the pages from hard disk to memory. Then, if or when the program moves beyond the first
four pages to another page, the operating system is invoked to retrieve the needed page(s)
from swap space and load it (them) into memory.
In loading a new page into the memory, if all memory frames are being used, then the
operating system has to select one or more pages to discard from the memory. It does so by
moving these pages back to swap space. The situation whereby a request is made to a page
that is not in the memory is called a
Do'stlaringiz bilan baham: |