Linux Installation and Configuration
From Colwiki.org
Linux comes in many forms including in CDROMs, DVDs, iso Images etc. Whichever form your Linux is contained in, you should be able to install it in your computer and use it. Many of the modern Linux distributions nowadays come with easy to follow user interfaces that you can run through and install. This manual will not focus on specific installation procedure for any distribution but will highlight the building blocks to behind the scene installation activities. The process of installing Linux involves copying files into the installation media. System files are more than just names for a collection of bits and bytes. Files are the central concept behind a variety of functions. Files not only store information but also allow applications to communicate, provide access to hardware devices, represent folders of other files, act as pointers to information, or (virtually) connect machines over a network. Files are the central concept behind Linux and Unix-like systems. Almost everything is treated as a file: all directories, pipes to other processes, the interface to hardware devices, even pointers to files (links). There are even virtual files that give a user access to kernel structures.
Whereas a file refers to a single entity, a file system describes the way files are stored on media. The term media includes the obvious hard or floppy disk, USB Disks and CD-ROMs, as well as a network service or the RAM of your machine. Each file system type implements different properties. Not every kind of file can reside on any file system, and not every file system type supports every medium. Files have properties that determine the file type. A common property of all files is that they have a set of permissions, which is the designation that indicates which group it belongs to and who is the owner. Before we discuss file systems or permissions and ownerships, let's take a closer look at the types of files.
- Regular Files: Regular files are used to store data on a file system. This is the "common sense" type of file, a container for persistent data.
- Directories: Directories hold other files. Because modern file systems are organized in hierarchies, you need something to hold the different levels of the hierarchy. That is a directory's purpose. If you're not used to referring to directories as files, remembering that they are nothing other than files containing a list of other files is important.
- Special Device Files: Special device files are simply interfaces to a device. Two kinds exist: buffered device files and unbuffered device files. The buffered special device files are called block device files; the unbuffered ones are the character device files.
- Regular Pipes: A pipe is a connection between two processes. It's treated like a file inside the application, yet doesn't have a representation in the file system. This type of file is interesting only if you mean to write an application. From a user level, pipes are an easy method to use to concatenate commands and give the output from one application as input to another one.
- Named Pipes: Named pipes are like pipes but are represented in the file system. They are also used for interprocess communication, but they can exist without any process accessing them.
- Sockets: Sockets are similar to pipes and perform the same functions. The difference is that sockets are used to communicate over a network. The details are important only if you want to use sockets in your application. Further details on sockets are beyond the scope of this book. You can find excellent sources that explain the concept in greater depth.
- Hard Links: A hard link is a sequential entry in a directory structure for an existing file. It's like a new name for a file.
- Soft Links: A soft link is a pointer to a file.
Executables are not a separate file type and are therefore not included in this list. In Linux systems, being executable or not is a property determined by the file permissions and does not depend on the type of file. Remember that some files can be executed only by designated users or user groups.
With this understanding, you will learn the following in this lesson:
|
Contents |
The Linux File System
At the core of any Linux operating system is the Kernel. The Linux Kernel is the core of the operating system and provides the ability for software to access the hardware systems. This Kernel and any of the other applications or systems running on a Linux system work through files. Almost all of the ways an operating system interacts with its users, applications, and security model are dependent upon the way it stores its files on a storage device. It is crucial for a variety of reasons that users, as well as programs, be able to refer to a common guideline to know where to read and write files. The table below summarizes a logical arrangement of files within the Linux Operating System:
The reason for looking at files in this manner is to help correlate the function of the file with the permissions assigned to the directories which hold them. The way in which the operating system and its users interact with a given file determines the directory in which it is placed, whether that directory is mounted read-only or read-write, and the level of access each user has to that file. The top level of this organization is crucial, as the access to the underlying directories can be restricted or security problems may manifest themselves if the top level is left disorganized or without a widely used structure.
In order to achieve this, many Linux systems abide to the File System Hierarchy Standard (FHS) - See http://www.pathname.com/fhs/ . The FHS is a standard that define the names and locations of many files and directories. It is very important that a Linux system complies with this standard as it ensures compatibility with other compliant systems. The following defines the File Organization within a Linux File System.
The /root/ Directory The root directory is the most important part of the whole system. During the boot process, this file system is mounted first and has to hold everything to bring the system to life. This requires certain things to be on this file system:
- Start-up data and utilities to set up the system configuration.
- All utilities needed to mount other file systems. In a networked environment, this may include the network utilities, as mounts may be made over NFS.
- Tools to repair broken file systems in order to perform a recovery after a system crash. In particular, this means utilities to restore backups from tapes, floppy disks, and other media.
On the other hand, the administrator's goal is to keep the root file system as small as possible. The smaller a file system is, the less likely it is to be corrupted in case of a system crash. The root file system holds essential utilities as well as major system configuration data in /etc, which means that it's not shareable. A small root file system means less required hard disk space in environments where as much data as possible is shared over a local network.
The /boot Directory /boot contains everything that is required for the first stage of the boot process. The /boot directory stores data that is needed before the kernel begins executing user mode programs. It also holds backup copies of the boot records, sector map files, and other items that are not edited manually. Programs that access this data (mainly lilo) are located in /sbin, and their configuration files are in /etc.
- The /dev/ Directory:The /dev/ directory contains file system entries which represent devices that are attached to thesystem. These files are essential for the system to function properly.
- The /etc/ Directory:The /etc/ directory is reserved for configuration files that are local to the machine. No binaries are to be put in /etc/. The X11/ and skel/ directories are subdirectories of the /etc/ directory and are used to configure the X Windows environment which is the graphical windowing system of Linux
- The /lib/' Directory:The /lib/ directory contains only those libraries that are needed to execute the binaries in /bin/ and /sbin/. These shared library images are particularly important for booting the system and executing commands within the root file system.
- The /mnt/ Directory:The /mnt/ directory is for temporarily mounted file systems, such as CD-ROMs and floppy disks.
- The /opt/ :The /opt/ directory provides storage for large, static application software packages. A package placing files in the /opt/ directory creates a directory bearing the same name as the package. This directory in turn holds files that otherwise would be scattered throughout the file system, giving the system administrator an easy way to determine the role of each file within a particular package.
- The /proc/ Directory:The /proc/ directory contains special files that either extract information from or send information to the kernel. Due to the great variety of data available within /proc/ and the many ways this directory can be used to communicate with the kernel.
- The /sbin/ Directory:The /sbin/ directory is for executables used only by the root user or system administrator. The executables in /sbin/ are only used to boot and mount /usr/ and perform system recovery operations.
- The /usr/ Directory:The /usr/ directory is for files that can be shared across a whole site. The /usr/ directory usually has its own partition, and it should be mountable read-only.
- The /var/ Directory:Since the FHS requires Linux to mount /usr/ read-only, any programs that write log files or need spool/ or lock/ directories should write them to the /var/ directory.
A review of the Linux File System
Now that we've reviewed the basics, single files, it's time to take this review to another level -- file systems. We've used the term file system quite frequently up to now without a working definition. Because file system has two different meanings, it can become quite confusing. When we talk about file systems, we usually think of directory trees. This is a hierarchical structure of directories that contain other directories and/or any kind of file. The second meaning of file systems is the lower-level format, used on a given media to store files.
Alternatives to File Systems Storing data to media can be done in many ways. The simplest one is to dump the raw data to the medium. This works fine but makes accessing the data inconvenient. You lack meta information such as size, type, or identifier. Matters are complicated if you want to store a second set of data to this medium. You have to remember the offset (where the first set ends), or you risk overwriting, which means losing data.This meta information can be supplied by special applications or made transparent for the user by a file system.
File systems organize files into logical hierarchical structures with directories, links, and so on. The Linux system supports over twenty-one different file system types: minix, ext2, iso9660, msdos, umsdos, vfat, proc, nfs, smb, ncp, hpfs, sysv, adfs, amiga-fs, ROM-fs,NTFS, joilet, Apple Macintosh fs, QNX fs, Coda, and ufs. A file system organizes the data on a block device. This can be a hard disk, a floppy disk, RAM, a flash RAM cartridge, or even a network link to a remote system. The file system itself doesn't know anything about the medium it uses. This is handled by the device driver. It's the job of the device driver to translate the address of a specific block to a physical position on a hard drive, a memory region, and so on.
The de facto standard file system on Linux systems is Extended 2 File System (ext2). The first file system for Linux was the Minix file system (Minixfs). It had many disadvantages. Partitions were limited to 64MB, filenames to 14 characters. The extended file system, introduced to the Linux world in April 1992, was mostly based on the Minixfs; it removed the previously mentioned limits, but still was far from perfect. This led to the development of the ext2 file system. It added better space allocation management to extfs, exhibited better performance, allowed the use of special flags for file management, and was extensible. It's been available since 1993 and is the most successful Linux file system to date.
When the extfs was added to the Linux kernel, a new layer entered the system, the so-called Virtual File System (VFS) layer. With this layer, the file system and the kernel were no longer one module. A well-defined interface between kernel and file system was created. VFS allows Linux to support many different file systems. All file systems appear identical to the kernel and to the programs running on the system. The VFS layer allows you to transparently mount different file systems at a time.
The ext2 file system is built on the premise that data is held in blocks of equal size on the storage medium. The block size can vary on different ext2 file systems, but within one file system, all blocks have the same length. The length is set when the file system is created by mke2fs. This strategy's disadvantage is that on average, half the block size is wasted for each file. Assuming that the block size is 1024 bytes, a file with 1025 bytes will use two blocks, just as a file with 2047 will. By handling the files this way, you reduce the CPU's workload.
Not all blocks on the file system hold actual file data. Some are used to hold information about the structure of the file system. Ext2 uses inode data structures for each file stored in the file system. An inode describes which blocks contain the data of the specified file, its type, owner, and group, the permissions and the date of the last access, the last modification, and its creation date. The inodes are held in inode tables. A directory is simply a file that contains pointers to the inodes of the files within this directory.
A detailed description of the whole ext2 file system can be found in David A Rusling's book The Linux Kernel, in Chapter 9, "The File System," available online at http://sunsite.unc.edu/LDP/LDP/tlk/tlk.html .
Partitioning Scheme
The figure below shows a possible partitioning scheme. The File System layout is a tree of directories and subdirectories. The physical resources with the data are mounted at specific locations on the file system called mount points. The root of the tree structure is called root and is represented by a forward slash “/”. At boot time, the boot loader is told which device to mount at root. The leaves in this tree structure are subdirectories. During installation you will partition the hard drive and assign a size and a mount point for each partition.
On a running Linux system, disks are represented by entries in the /dev directory. The kernel communicates with devices using a unique major/minor pair combination. All major numbers are listed in /proc/devices. For example the first IDE controller‘s major number is 3: 1 – ramdisk, 2 – fd and 3- ide0 . Hard disk descriptors in /dev begin with hd (IDE) or sd (SCSI), a SCSI tape would be st, and so on. Since a system can have more than one block device, an additional letter is added to the descriptor to indicate which device is considered.
| Physical block devices | |
|---|---|
| hda | Primary Master |
| hdb | Primary Slave |
| hdc | Secondary Master |
| hdd | Secondary Slave |
| sda | First SCSI disk |
| sdb | Second SCSI disk |
Disks can further be partitioned. To keep track of the partitions a number is added at the end of each physical device.
| Partitions | |
|---|---|
| hda1 | First partition on first hard disk |
| hda2 | Second partition on first hard disk |
| sdc3 | Third partition on third SCSI disk |
IDE type disks allow 4 primary partitions, one of which can be extended. The extended partition can further be divided into logical partitions. There can be a maximum of 64 partitions on an IDE disk and 16 on a SCSI disk. The primary partitions (1,2,3,4) and (1,2,5,6,7,8).
During the installation you will be required to create various partitions to hold your file system. A linux system will require at least two partitions:
- The root partition: This is the partition where / (the root directory) will be located on a UNIX or UNIX-compatible system. This partition should not be confused with the /root directory which is the home directory of super user
- A swap partition: This is space on your hard drive that can be used as virtual memory. Virtual memory allows your computer to run large programs and perform complex tasks even if it does not have enough physical RAM to do the job. The amount of swap space required is subjective. To keep it simple, create one swap partition of either 64MB or 128MB (you may have to use 127MB instead depending on the program you use to create the partition). If you are short on RAM with plenty of drive space, go large. If you're short on drive space and have 128MB or more of RAM, go small.
Linux Installation
Because of the Open Source nature of the Linux Kernel, which allows anyone to modify or enhance the base kernel with other software, Linux in available in a wide variety of distributions. A linux distribution is a collection of software packages, utilities, and tools and is based on the version of a Linux kernel. Some distributions can be created with a specific purpose in mind e.g to set-up a firewall, or a security linux distribution (e.g backtrack),or for educational purposes etc but there are also general-purpose distributions, meaning that they come with a variety of software packages, tools and applications that can be installed by the end user resulting in flexibility. Each distribution comes with its own characteristics and special tools, created by the distribution company to increase the value of their version of Linux. Most of these distributions are obtained for free (in keeping with the GPL License) but many companies also sell commercial distributions. Most Linux vendors center their business on a service support model for their distribution.
Often mention will be made for distinct changes with other key Linux distributions. It is also important to note that this manual does not seek to promote any particular distribution but will seek to expound on implementations that cut across any Linux distribution. This implies that the concepts described in this manual cut across majority of the Linux distributions out there. For a comprehensive listing of Linux distributions see http://www.distrowatch.com/
| There are many Linux distributions out there, most of them with very elaborate installation instructions. This manual shall not replicate those installation instructions here but shall instead point you to the relevant installation instructions for your module. The following are some of the key linux distributions and where you can find their download and installation instructions.
{ |
| In this module you learned about the various Linux File types. You have also looked at the Linux File System Standard and learned how to install the SuSE Linux Enterprise Server 10 on your machine. |
| Attempt to access and download two different distributions above and attempt to install them on your computer. Note the differences between the distrubtion’s installation processes. |
This work is licenced under a Creative Commons - By Attribution Licence - Share Alike License.




