logical volume manager
. This is a means of implementing one or more disk
partitions in a logical rather than physical way so that partitions can be easily resized. This
means that part of the file system is managed by software. The software specifically keeps
track of the partitions’ file usage so that it can modify the “boundaries” of the partitions.
FIGURE 8.9
Default partitions.
Installing Linux
◾
327
This allows you to have an adaptable set of partitions whereby they grow as needed. Using
physical disk partitions, you are locked into the established size of the partitions. If you
make a partition too small, you might find that you do not have enough disk space for
Linux to run at all, or at least to run effectively. Or, you might find that you have run out of
space and you have to delete files. At the other extreme, if one partition is too large, then
other partitions might eventually suffer from too small a size. Now, these other partitions
may fill up more quickly than desired. Resizing or otherwise changing partitions requires
making physical changes to the disk that has the potential of destroying data. We examine
LVM in more detail in Chapter 10.
Let us imagine that we do not want to use this default setup of partitions and want to
create instead partitions for / (root), /var, and /home. These are
mount points
that provide
an entry to the partition from the root file system. That is, the mount point is the logical
location as we reference it from the operating system. All these partitions will be managed
by LVM so that we can ensure that as they grow, as long as there is disk space available, the
partitions will not run out of space. First, we need to delete the current setup. Select the two
rows of lv_root and lv_swap (one at a time) and select the Delete button. You would wind
up with a single entry underneath VolGroup that says Free followed by the amount of free
space (9736 in this case).
Now, we can create our new partitions. Click on Create and you will see the Create Storage
window as shown in Figure 8.10. You would select LVM Logical Volume underneath the
FIGURE 8.10
Creating a partition.
328
◾
Linux with Operating System Concepts
Create LVM section and then select the appropriate Volume Group (VolGroup is the only
one available in our example).
Clicking on the Create button from this pop-up window presents you with two new
pop-up windows, as shown in Figure 8.11. In the Make Logical Volume window, select the
Mount Point, File System Type, and Size. By default, you are provided ext4 for the type,
which is the best choice. Mount Point for our first partition will be / (root) and we will use
a size sufficient for / to leave us space for other partitions. A size of 4000 MB is satisfactory.
With this filled in, click on OK and both windows disappear leaving us with two entries
under VolGroup, LogVol00 whose size is 4000 MB, whose mount point is / and whose type
is ext4, and Free which is now 5736. We repeat this process to create /var (in this case, we
will give /var 4000 MB).
For the swap space, instead of selecting a mount point, we select under File System Type
“swap”. Swap does not have a mount point, so the Mount Point selection becomes Applicable>. Here, we select a size of 2000 MB because we are limited based on the size of
the virtual machine (10 G). The common size for swap space is often cited as 1–2 times that
of main memory. However, Linux is a very efficient operating system and you may never
need more than about 2 GB worth of swap space. Our last partition has a mount point of
/home and will use the remaining space, 736. Note that we could have chosen to encrypt
any of these file systems during this partitioning.
At this point, we would have the following list of partitions specified:
LVM Volume Groups
VolGroup
9736
LogVol03
736 /home ext4
LogVol01 4000 /var ext4
LogVol00 4000 /
ext4
LogVol02 1000
swap
FIGURE 8.11
Creating logical partitions.
Installing Linux
◾
329
Hard Drives
sda
sda1
500
/boot
ext4
sda2 9739 VolGroup
physical volume (LVM)
This summary tells us that our physical hard disk is divided into two file systems, sda1
and sda2 that is storing the boot partition (/boot) and VolGroup, an LVM. VolGroup itself
consists of four logical groups, /, /home, /var, and swap that has no mount point. We can
now proceed with formatting our disk with the above layout. Click on Next and a Format
Warnings pop-up window appears. Click Format and then a Writing storage configuration
to disk-warning window appears and click on Write changes to disk. A number of win-
dows appear indicating the formatting and creation of the file systems as specified. Now,
we can continue with the installation.
The main advantage of LVM is that a partition is not restricted to the size specified when
we formatted the disk. Instead, a partition grows by grabbing space from the available disk,
sda2 in this case, as needed and as available. Only if sda2 runs out of space would a parti-
tion not be able to grow further. By using the LVM, we, for instance, could potentially use
more space for /home than the 736 MB specified while using less space for say /var.
However, the flexibility from LVM comes with some costs. One reason why you might
want to forego the use of an LVM is that it adds a layer of complexity to the file system,
resulting in both a reduction in efficient access and a complication with processes such as
system booting and disaster recovery. Again, refer to Chapter 10 for a greater discussion
on LVM.
In the meantime though, let us look at creating partitions with physical sizes by
using the Standard Partition selection from the Create Storage window. With this selec-
tion, we get an Add Partition window rather than a Make Logical Volume window. See
Figure 8.12.
In creating our own physical partitions, we specify much of the same information as
we did with the LVM approach. We need to specify the mount point, file system type,
and size. For the size specification, we can provide the size in the Size box that indicates
a fixed size, we can select Fill all space up to and then specify a maximum size, or we can
select Fill to maximize allowable size that uses the remainder of this drive’s free space. You
can also select whether this partition will be a primary partition and whether it should be
encrypted. A primary partition is one with a boot program stored in it. We use a similar set
of partitions as we did earlier except that we will forego a separate /boot partition, instead
placing /boot with the root partition (/). Here are the values we might select:
• Partition 1: / (mount point), ext4 (type), 4000 MB, Fixed Size
• Partition 2: /var, ext4, 4000 MB, Fixed Size
• Partition 3: (mount point), swap, 2000 MB, Fixed Size
• Partition 4: /home, ext4, Fill to maximum size
330
◾
Linux with Operating System Concepts
As before, swap space does not have a mount point. All the other partitions have mount
points.
Before partitioning your hard disk, you need to consider what you are going to use your
computer for and make a wise choice. Once partitioned, while it is possible to repartition
or resize your partitions, it is not necessarily a good thing to do given that you can easily
destroy data in the process. We examine the file system and partitioning in more detail in
Chapter 10. For now, we will continue with our installation.
With your partition information filled out, select Next. Two pop-up windows will
appear consecutively. The first warns you that the changes you are making will delete data,
click on Format. The second states that you are writing configuration information to the
disk. Select Write changes to the disk. You will then see formatting taking place on /dev/
sda (or /dev/hda) as the partitions are created.
The next window allows you to specify the location of the boot loader program and
the boot image(s) of your operating system. For our first partition using LVM, /boot was
explicitly placed on /dev/sda1. Without using LVM, the /boot directory is located on the
root (/) partition that is again placed on /dev/sda1. You should not have to do anything
with the bootloader specification as the default settings should be correct. You can also
establish a boot loader password if desired. Click Next to continue.
8.3.3 Finishing Your Installation
We have reached the last screen before installation finally begins. We must specify the type
of installation. The type of installation dictates the software to be installed. Your choices are
Desktop that provides access to the GUI, Minimal Desktop that provides only some GUI
facilities, Minimal that provides only text-based access (and is the default), Basic Server,
Database Server, Web Server, Virtual Host, and Software Development Workstation. The
FIGURE 8.12
Creating a partition.
Installing Linux
◾
331
last five categories cause different application software to be loaded. If you were intending
your computer to be used for one of these latter categories, you do not necessarily have to
select it now as you could install the software later (see Chapter 13). You can also add addi-
tional software packages on this page. The default is to “Customize later.” Select Desktop
and then Next. At this point, CentOS 6 is unpacked and installed. Depending on the speed
of your processor, hard disk, and optical drive, this will take several minutes, perhaps as
many as 20. The last step after installation is to reboot your computer (the VM).
Upon rebooting, you will see a welcome screen. From here, you are nearly done with the
installation. First, you will have to agree to the license. In this case, it is the CentOS license
under the GPL. The license states that CentOS 6 comes with no guarantees or warranties
and also states that individual software packages will come with their own licenses.
At the next window, you are required to provide your first user’s account. It is important
to create this first user account so that, when you are to log in for the first time, you log in as
a user and not as root. Logging in as root through the GUI is never advisable because you
have control over all files in the file space and so it is too easy to delete or destroy data acci-
dentally. For the first user’s account, you will provide the username, the user’s full name,
and the user’s initial password. As with the root password, this password will be tested to
see if it is a strong password, and if not, you will be warned. You can also select a network
login mechanism. The Advanced… button will bring up the User Manager window, which
we will explore in Chapter 9.
The next window allows you to set the date and time or alternatively synchronize this
over the network. Finally, the last window provides you the ability to establish the kdump
kernel-dumping mechanism including whether kdump should be enabled, the size of the
dump, and the kdump configuration file. Alternatively, you can leave it disabled or not
alter the default. After completing this step, you are provided with the CentOS 6 GUI login
screen and you are done! Log in and start using Linux.
Although you now have a desktop available, you will probably find that there are a num-
ber of additional configuration steps required. These include, at a minimum, the creation of
user accounts (we cover this in Chapter 9), the installation of additional software (we cover
this in Chapter 13), and ensuring that your network is configured correctly (we cover this
in Chapter 12). Other aspects of configuring your Linux environment include establishing
and configuring services (covered in Chapter 11), setting up scripts to automate tasks such
as backups, and setting up proper security such as the firewall (also covered in Chapter 12).
8.4 INSTALLING UBUNTU
Ubuntu is a descendant of Debian Linux. Here, we discuss the installation of Ubuntu 12.
As with the CentOS install, much of it is simplified. The start-up window asks if you want
to try Ubuntu (via the Live or bootable CD) or install. You would select Install and the
language of choice (English is the default). See Figure 8.13.
You are cautioned that you should have at least 4.5 GB of available hard-drive space and
Internet access. You can install updates during the installation as well as install third-party
software. You are then asked whether to erase the hard disk and install Ubuntu, or cre-
ate a separate partition for Ubuntu to the current disk setup (you can also resize existing
332
◾
Linux with Operating System Concepts
Ubuntu partitions). Unless you specify the latter, you will be given the default Ubuntu
Do'stlaringiz bilan baham: |