+ All Categories
Home > Documents > Linux Administration - Himalaya Publishing House · Shell is a command interpreter which interprets...

Linux Administration - Himalaya Publishing House · Shell is a command interpreter which interprets...

Date post: 27-Apr-2020
Category:
Upload: others
View: 49 times
Download: 2 times
Share this document with a friend
15
Transcript
Page 1: Linux Administration - Himalaya Publishing House · Shell is a command interpreter which interprets the command and then passes to the kernel for execution. Shell acts as an interface
Page 2: Linux Administration - Himalaya Publishing House · Shell is a command interpreter which interprets the command and then passes to the kernel for execution. Shell acts as an interface

LinuxAdministration

(As per the Syllabus 2013-14 of Mumbai University for B.Sc. – IT, Semester V)

Kiran GurbaniB.E., MCA, M.Phil.,

Head of Computer Science Department,R.K. Talreja College, Ulhasnagar - 3.

ISO 9001:2008 CERTIFIED

Page 3: Linux Administration - Himalaya Publishing House · Shell is a command interpreter which interprets the command and then passes to the kernel for execution. Shell acts as an interface

© AuthorNo part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by anymeans, electronic, mechanical, photocopying, recording and/or otherwise, without the prior written permission of thepublisher.

First Edition: 2016

Published by : Mrs. Meena Pandey for Himalaya Publishing House Pvt. Ltd.,“Ramdoot”, Dr. Bhalerao Marg, Girgaon, Mumbai - 400 004.Phone: 022-23860170/23863863, Fax: 022-23877178E-mail: [email protected]; Website: www.himpub.com

Branch Offices :

New Delhi : “Pooja Apartments”, 4-B, Murari Lal Street, Ansari Road, Darya Ganj,New Delhi - 110 002. Phone: 011-23270392, 23278631; Fax: 011-23256286

Nagpur : Kundanlal Chandak Industrial Estate, Ghat Road, Nagpur - 440 018.Phone: 0712-2738731, 3296733; Telefax: 0712-2721216

Bengaluru : Plot No. 91-33, 2nd Main Road Seshadripuram, Behind Nataraja Theatre,Bengaluru-560020. Phone: 080-41138821, 9379847017, 9379847005

Hyderabad : No. 3-4-184, Lingampally, Beside Raghavendra Swamy Matham, Kachiguda,Hyderabad - 500 027. Phone: 040-27560041, 27550139

Chennai : New-20, Old-59, Thirumalai Pillai Road, T. Nagar, Chennai - 600 017.Mobile: 9380460419

Pune : First Floor, "Laksha" Apartments, No. 527, Mehunpura, Shaniwarpeth(Near Prabhat Theatre), Pune - 411 030. Phone: 020-24496323/24496333;Mobile: 09370579333

Lucknow : House No. 731, Shekhupura Colony, Near B.D. Convent School, Aliganj,Lucknow - 226 022. Phone: 0522-4012353; Mobile: 09307501549

Ahmedabad : 114, “SHAIL”, 1st Floor, Opp. Madhu Sudan House, C.G. Road, Navrang Pura,Ahmedabad - 380 009. Phone: 079-26560126; Mobile: 09377088847

Ernakulam : 39/176 (New No.: 60/251), 1st Floor, Karikkamuri Road, Ernakulam,Kochi – 682011. Phone: 0484-2378012, 2378016 Mobile: 09387122121

Bhubaneswar : 5, Station Square, Bhubaneswar - 751 001 (Odisha).Phone: 0674-2532129, Mobile: 09338746007

Kolkata : 108/4, Beliaghata Main Road, Near ID Hospital, Opp. SBI Bank,Kolkata - 700 010, Phone: 033-32449649, Mobile: 7439040301

DTP by : SunandaPrinted at : Rose Fine Art, Mumbai. On behalf of HPH.

Page 4: Linux Administration - Himalaya Publishing House · Shell is a command interpreter which interprets the command and then passes to the kernel for execution. Shell acts as an interface

Dedication

I would like to dedicate this book to my mother Kavita S. Bajajfor providing me with quality education and for

being a constant guide and mentor of my life. I would like tothank to my son Chirag Gurbani for being my stress buster and a

motivating force for putting a better performance every time.

My sincerest thanks for a lifetime to Mr. S.K. Shrivastav ofHimalaya Publishing House Pvt. Ltd. whose belief in this book

has kept me motivated and inspired on even the darkest of days.

Page 5: Linux Administration - Himalaya Publishing House · Shell is a command interpreter which interprets the command and then passes to the kernel for execution. Shell acts as an interface

Preface

We are having great pleasure in presenting First Edition of this Book “LinuxAdministration” to the students of T.Y. B.Sc. (IT) (T.Y.B.Sc. Information Technology). Thisbook will be useful for T.Y.CS students also. This book is written to cover all the topics ofsyllabus prescribed by the University of Mumbai for T.Y.B.Sc. Information Technology

Linux Operating System is open source software. It supports CUI and GUI interface. Withmajor developments of technology, this operating system is considered more efficient thanWindow Operating System. Linux Operating System is secure because of its firewall protectionfeature. The Linux Operating System has its own K-Office and having powerful internet, networkcapabilities as well in Linux we have many inbuilt servers like NFS, Samba server, Web server –Apache, mailing server- sendmail, Proxy server – Squid, DNS, System Administration for usersand groups, DHCP Server, FTP, http, etc.

The concept and theory of each topic is followed by the theoretical explanation, some self-assessment questions, all practical questions and Configuring servers solutions are provided at theend of this book. Within practicals Linux Installation step-wise with wizard is provided. Sincebefore understanding Linux Admin, one should have an idea about simple Linux Commands.Hence, efforts have been made to make the text easy to read and understand. In this book, I havecovered simple Linux commands and Administration commands along with different serverconfigurations.

Constructive suggestions and comments from the users will be sincerely appreciated. I wouldappreciate hearing from you about any textual errors or omissions which you identify. If youwould like to suggest improvements or to contribute in any way, I would be glad to hear from you.

Please send correspondence to [email protected]. and if you are facing anyproblem in understanding, you can call me at 9637128628.

I would like to thank to Mr. S.K. Shrivastava (Himalaya Publishing House Pvt. Ltd.) for hisguidance and cooperation.

I want to dedicate this book to my mom Kavita S. Bajaj. Finally, I express my debt ofgratitude to my parents and both sons who have provided me motivation, encouragement to writethis book.

Kiran [email protected].: 9637128628

Page 6: Linux Administration - Himalaya Publishing House · Shell is a command interpreter which interprets the command and then passes to the kernel for execution. Shell acts as an interface

SyllabusLinux Administration

Unit I Introduction: Introduction to UNIX, Linux, GNU and Linuxdistributions. Duties of the System Administrator: The LinuxSystem Administrator, Installing and Configuring Servers, Installingand Configuring Application Software, Creating and MaintainingUser Accounts, Backing Up and Restoring Files, Monitoring andTuning Performance, Configuring a Secure System, Using Tools toMonitor Security.Booting and shutting down: Boot loaders – GRUB, LILO,Bootstrapping, Init process, rc scripts, Enabling and disablingservices.The File System: Understanding the File System Structure, Workingwith Linux-supported File Systems, Memory and Virtual FileSystems, Linux Disk Management, Network Configuration Files.

10Lectures

Unit II System Configuration Files: System-wide Shell ConfigurationScripts, System Environmental Settings, Network ConfigurationFiles, Managing the init Scripts, Configuration Tool, Editing YourNetwork ConfigurationTCP/IP Networking: Understanding Network Classes, Setting Up aNetwork Interface Card (NIC), Understanding Subnetting, Workingwith Gateways and Routers, Configuring Dynamic HostConfiguration Protocol, Configuring the Network using the Network.The Network File System: NFS Overview, Planning an NFSInstallation, Configuring an NFS Server, Configuring a NFS Client,Using Automount Services, Examining NFS Security.

10Lectures

Unit III Connecting to Microsoft Networks: Installing Samba, Configuringthe Samba Server, Creating Samba Users 3, Starting the SambaServer, Connecting to a Samba Client, Connecting from a WindowsPC to the Samba Server.Additional Network Services: Configuring a Time Server,Providing a aching Proxy Server.

10Lectures

Unit IV Internet Services: Secure Services, SSH, scp, sftp, Less SecureServices (Telnet, FTP, sync, rsh, rlogin, finger, talk and ntalk, LinuxMachine as a Server, Configuring the xinetd Server, Comparingxinetd and Standalone, Configuring Linux Firewall Packages,Domain Name System: Understanding DNS, Understanding Typesof Domain Servers, Examining Server Configuration Files,

10Lectures

Page 7: Linux Administration - Himalaya Publishing House · Shell is a command interpreter which interprets the command and then passes to the kernel for execution. Shell acts as an interface

Configuring a Caching DNS Server, Configuring a Secondary MasterDNS Server, Configuring a Primary Master Server, CheckingConfiguration.

Unit V Configuring Mai1 Services: Tracing the Email Delivery Process,Mail User Agent (MUA), Introducing SMTP, Configuring Sendmail,Using the Postfix Mail Server, Serving Email with POP3 and IMAP,Maintaining Email SecurityConfiguring FTP Services: Introducing vsftpd, Configuring vsftpd,Advanced FTP Server Configuration, Using SFTP.

10Lectures

Unit VI Configuring a Web Server: Introducing Apache, ConfiguringApache, Implementing SSI, Enabling CGI, Enabling PHP, Creating aSecure Server with SSLSystem Administration: Administering Users and Groups Installingand Upgrading Software Packages.

10Lectures

Page 8: Linux Administration - Himalaya Publishing House · Shell is a command interpreter which interprets the command and then passes to the kernel for execution. Shell acts as an interface

Paper PatternMax. Marks: 75 Time: 2½ Hrs.

Instructions:1. All questions are compulsory.2. Attempt any TWO sub-questions from each question.3. Each sub-question is of 5 marks.

Q.1 Answer any TWO of the following: [10](a) From unit 1(b)(c)(d)

Q.2 Answer any TWO of the following: [10](a) From unit 2(b)(c)(d)

Q.3 Answer any TWO of the following: [10](a) From unit 3(b)(c)(d)

Q.4 Answer any TWO of the following: [10](a) From unit 4(b)(c)(d)

Q.5 Answer any TWO of the following: [10](a) From unit 5(b)(c)(d)

Q.6 Answer any TWO of the following: [10](a) From unit 6(b)(c)(d)

Q.7 Answer any THREE of the following: [15](a) From unit 1(b) From unit 2(c) From unit 3(d) From unit 4(e) From unit 5(f) From unit 6

Page 9: Linux Administration - Himalaya Publishing House · Shell is a command interpreter which interprets the command and then passes to the kernel for execution. Shell acts as an interface

Contents

1. Introduction 1 – 5

2. Duties of the System Administrator 6 – 11

3. Booting and Shutting Down 12 – 24

4. File System Structure of Linux 25 – 44

5. System Configuration Files 45 – 62

6. TCP/IP Networking 63 – 75

7. Network File System 76 – 86

8. Connecting to Microsoft Networks 87 – 97

9. Additional Network Server 98 – 108

10. Internet Services 109 – 118

11. Domain Name System 119 – 144

12. Configuring Mail Services 145 – 160

13. Configuring FTP Services 161 – 172

14. Configuring a Web Server 173 – 187

15. System Administration 188 – 197

PracticalsPractical 1 198 – 202

Practical 2 203 – 225

Practical 3 226 – 227

Practical 4 228 – 234

Practical 5 235 – 238

Practical 6 239 – 242

Practical 7 243 – 245

Practical 8 246 – 249

Page 10: Linux Administration - Himalaya Publishing House · Shell is a command interpreter which interprets the command and then passes to the kernel for execution. Shell acts as an interface

Practical 9 250 – 253

Practical 10 254 – 255

Practical 11 256 – 256

Practical 12 257 – 259

Practical 13 260 – 262

Practical 14 263 – 264

Practical 15 265 – 268

Practical 16 269 – 271

Practical 17 272 – 272

Practical 18 273 – 275

Practical 19 276 – 283

Practical 20 284 – 289

Practical 21 290 – 292

Page 11: Linux Administration - Himalaya Publishing House · Shell is a command interpreter which interprets the command and then passes to the kernel for execution. Shell acts as an interface

Introduction

Structure:1.1 Introduction to Different Operating Systems1.2 Introduction to Unix1.3 History of Linux Operating System1.4 Features of Linux Operating System (Apr., 14)1.5 GNU and Linux Distribution

1.1 Introduction to Different Operating SystemsOperating System:

An Operating System is a system software which acts as a user interface between computerhardware & user.

Types of operating systemsDos (disk os) – Booting – disk (hd,fd,cd)Windows 3.11Windows 95Windows 97Windows 98Windows 2000 (professional & server edition)Windows MillenniumWindows xpWindows vistaWindows 7unix/zenixLinux

Booting & Types of BootingBooting is Turn ON of Computer.There are two types of Booting1. Cold Booting2. Warm Booting

1

ChapterUnit-I

Page 12: Linux Administration - Himalaya Publishing House · Shell is a command interpreter which interprets the command and then passes to the kernel for execution. Shell acts as an interface

2 Linux Administration

1. Cold Booting1. turn On of Computer2. switch on3. POST – Power on Self Test

It checks all hardware devices are properly attached or not.4. it will check for 3 bootable files

Autoexec.batCommand.com - fortran – jcl – job control lang - $job, $run, $endConfig.sys – system configurationC:\> d:\> e:\>

2. Warm Booting- (faster compared to cold booting)1. it will check for 3 bootable files

Autoexec.batCommand.com - fortran – jcl – job control lang - $job, $run, $endConfig.sys – system configurationC:\> d:\> e:\>

2. ctrl + alt + delete OR Restart button press

1.2 Introduction to UnixLinux/Unix Architecture:

Unix Architecture is also called kernel and shell relationship. The kernel is the core program oflinux that runs programs, manages and controls all software and hardware devices such as disc &printers. Hence, core of LINUX system is the kernel. It controls the resource of computer allocatingthem to different users & tasks. It interacts directly with the hardware thereby making programs easyto write & portable across different hardware platforms. The main function of kernel is that it has anode one level below the shell.

Page 13: Linux Administration - Himalaya Publishing House · Shell is a command interpreter which interprets the command and then passes to the kernel for execution. Shell acts as an interface

3Introduction

Shell is a command interpreter which interprets the command and then passes to the kernel forexecution. Shell acts as an interface between user & kernel.

It is a program started after you log on to the LINUX. It provides a command line interface orshell between user & LINUX kernel. Hence, it is called as fundamental interface to O.S “Kernel”.Typed ‘cmds are interpreted by the shell & sent to the kernel which, in turn, opens, closes, reads orwrites files. The shell runs like any other program under the LINUX system. A shell is simply a macroprocessor that executes commands that you enter at the command prompt. A Linux shell is understoodto be both a command interpreter and a programming language. You can enter the commands at thecommand prompt (#) and the shell will run them. If you have several commands that you need to run,you can put them in a special text file called a script file and the shell will run it also.

User programs that need to access the hardware use the services of the kernel hence kernel acts asan interface between user and hardware. These programs access the kernel through a set of functionscalled System calls. Kernel manages the system memory, schedules processes, and decides theirpriorities.

1.3 History of Linux Operating SystemHistory of Linux and Unix Operating Systems:

In 1969, Ken Thompson & Dennis Ritchie wrote a small, general purpose operating systemcalled UNIX. This operating system was written in assembly language. In 1973, Thompson &Ritchie rewrote the Unix operating system in c breaking away from the tradition of writingoperating system in assembly language.

Around 1974, Unix was licensed to universities for educational purpose and a few years laterwas made commercially available.

Many vendors such as SUN, IBM, Hewlett Packard & other purchased the source code ofUnix & developed their own versions of Unix. Most of these versions were proprietary &maintained by their developers who had to wait for a long time for bug fines to get released.

In 1980, Microsoft developed a PC version of Unix called Xenix.In 1984, Ritchard Stallman’s free software foundation (FSF) began the GNU (GNU stands

for GNUs not Unix) project to create a free version of Unix O.S. The FSF successfully built a largenumber of tools that could be freely used, read, modified & redistributed.

Around 1990, they had developed a number of tools but were having trouble creating a kernel.In 1991, Linus Torvalds developed a kernel & called it Linux. It has developed Linux version

0.11. Around 1992, Linux kernel was combined with the not quite complete GNU system resulting ina complete free operating system. This operating system is called GNU/LINUX as it is acombination of the GNU system & Linux as the Linux operating system. Hence, Linux waswidely distributed over the internet and Linux has all the internet utilities such as FTP (File TransferProtocol) web browsers and remote connections with PPP (Point To Point Protocol). It also has a fullset of program development utilities such as C++ compilers and debuggers. Hence, Linux hasdeveloped in the free and open environment of the internet. Linux is an open Source software. Thekernel coding is available on the net. We can download the source code & do the changes in thecoding and can create new version of Linux.

Page 14: Linux Administration - Himalaya Publishing House · Shell is a command interpreter which interprets the command and then passes to the kernel for execution. Shell acts as an interface

4 Linux Administration

Linux also has Linux file system standard (FSSTAND), which specifies the location of files anddirectories in Linux file structure. Linux supports ext3 partitions & swap partition for RAM, Linuxsupports all windows partitions Like VFAT, FAT32, NTFS, MSDOS Partition etc.

Distributors names of Linux:1. RedHat2. Caldera3. Mandrake4. Debian5. Suse6. Stackware7. Fedora8. Ubuntu

1.4 Feature of Linux Operating System (Apr., 14)Features of Linux

1. GUI (Graphical User Interface)2. Multitasking: No. of programs running at the same time.3. Multiuser: Several users on the same machine at the same time4. Multiplatform: Number of processors at a time runs on many different CPUs, not just Intel.5. Multiprocessor: Kernel supports multiple independent threads of a single process or multiple

processes.6. Multithreading: Has native kernel support for multiple independent threads of control within a

single process memory space.7. Linux runs in a protected mode on a 386 machine.

It has memory protection between processes so that oneprogram can’t bring whole system down.

8. It supports virtual memory using paging i.e. separate partition or file in file system created.9. Dynamically linked shared libraries & static libraries.

10. It is an open source s/w hence all the source codes are available including the kernel and alldrivers. Also all development tools and all user programs are freely distributed on the net.

11. Multiple virtual consoles i.e. it has several independent login sessions to console. You canswitch by pressing hot key combination. These are dynamically allocated. You can use upto64.

12. Linux has different file systems depending upon file systems like FAT32, VFAT, NTFS orNFS, ext3, ext4, swap(RAM)

13. It supports Network connectivity14. It supports Network Servers like TCP/IP Networking including FTP, Telnet, NFS, etc.15. It has Hardware Support16. Firewall Protection inbuilt is available so that no outsider introducer can attack on our System.17. It has its own K-office

Page 15: Linux Administration - Himalaya Publishing House · Shell is a command interpreter which interprets the command and then passes to the kernel for execution. Shell acts as an interface

5Introduction

18. Linux supports netware client and server with static Routing & Dynamic Routing with thehelp of DHCP.

19. Linux supports ‘Samba Server’ for connectivity of windows & Linux file sharing.20. It supports different Time Servers with sendmail facility.21. It supports ftp & http services with apache web server.

1.5 GNU and Linux DistributionLinux is actually just a kernel. You can obtain the sources for the kernel to compile and install it

on a machine and then obtain and install many other freely distributed software programs to make acomplete Linux installation. These installations are usually referred to as Linux systems, because theyconsist of much more than just the kernel- Most of the utilities come from the GNU Project of the FreeSoftware Foundation.

Many people have put together ready-to-install distributions (often called flavors), usuallydownloadable or on CD-ROMs or DVDs, that contain not just the kernel but also many otherprogramming tools and utilities. These often include an implementation of the X Window System, agraphical environment common on many UNIX systems.

GNU Linux Distributors areRed Hat Linux:http://www.redhat.com

A commercial business distributionused mainly for Internet servers

SUSE Linux: http://www.suse.com Open SUSE is a community-createdLinux distribution sponsored by Novell.

Mandrake Linux:http://www.mandrakesoft.com

A community Linux distributioninitially forked from Mandriva Linux inresponse to the discontinuation of freeversions of Mandriva Linux.

Debian GNU/Linux:http://www.debian.org/

Debian is an older Linux distributionwhich comes with the GNOME desktopenvironment by default. It is alsoFREEBSD with 37500 packages.

Slackware Linux:http://www.slackware.com/

One of the original distribution setspopular with Linux geeks

Questions1. Explain different Linux Distributions.2. Explain features of Linux in detail with different Linux distributions.3. Explain history of Linux in detail.4. Write a note on backing up and restoring files.5. Explain the role of system administrator in creating and administrating users.6. Explain role and functions of root user or super user/Duties of system Administrator.


Recommended