You are on page 1of 46

REDHAT SERVER AUTOMATION

A
Summer Training Report
Submitted
In partial fulfillment
For the award of the Degree of
Bachelor of Technology
In Department of Computer Engineering and Information
Technology

Submitted To:

Submitted By:

Mr. Sunil Kr. Khinchi


(11EEAIT022)

Khushhal

(Assistant Professor)
Department of CSE/IT

Department of Computer Engineering and


Information Technology
Government Engineering College, Ajmer
Rajasthan Technical University

Mahur

ACKNOWLEDGEMENT

It is with profound gratitude that I express my deep indebtedness to head


of Linux world Informatics (P) Ltd., Jaipur without whose support and
guidance it would not have been possible for this training to have taken a
concrete shape.
In spite of my best effort to the contrary there may be some error in my
report. I shall very much appreciate knowing about them. I am heartily
thankful and highly pay my regards to Mr. Vimal Daga, who has developed
an educational rapport with me. My training has been completed with the
co-operation of many of the personalities.
I am also thankful to my college, Government Engineering College, Ajmer
and concerned teachers for providing me opportunity to develop skill
under summer training program.
I would like to express sincere thanks to Mr. Rakesh Rathi (Head, CS and
IT) and Mr. Sunil Kr. Khinchi (P.T. Co-coordinator) to give support to
join this organization.
Last but not the least I would like to express my sincere thanks to my
parents for their moral and financial support without which I could not
have seen the light of the day.

(Khushhal Mahur)
(11EEAIT022)

Page 2 of 46

INDEX
S. No.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

Chapter No.

Chapter 1

Chapter 2

Chapter 3

Chapter 4

Chapter 5

Chapter 6

Chapter 7

Chapter Name
COVER PAGE
ACKNOLEDGEMENT
TABLE OF CONTENTS
LIST OF FIGURES
ABSTRACT
ABOUT THE COMPANY
1.1 Introduction to Linux World
1.2 Our Vision Statement
1.3 Services
LINUX
2.1 Introduction
2.2 What is Open Source?
2.3 Why it is better than
windows?
2.4 Properties
2.5 Architecture
2.6 Flavors of Linux
REDHAT
3.1 About Redhat corporation
3.2 About Redhat Services
3.3 Introduction of RHEL
3.4 Hardware Requirements
(RHEL 6)
SHELL SCRIPT
4.1 Shell
4.2 Shell Script
4.3 Dialog Box Script
Server
5.1 Telnet
5.2 OpenSSH
5.3 FTP
5.4 NFS and NIS
5.5 Apache and Samba Server
5.6 SMTP
PROJECT OVERVIEW
6.1 Scope
6.2 Introduction
6.3 Design Principle and
Explanation
6.4 Technology Used
PROJECT SNAPSHOTS

Page No.
1
2
3
4
5
67
6
6
7
8 13
8
8
9
10
12
13
14 15
14
14
15
15
16 22
16
18
21
23 25
23
23
24
24
24
25
26 27
26
26
26
27
28 36
Page 3 of 46

39
40
41

Chapter 8

42
43

TESTING
8.1 Software Implementation
8.2 Methodology Used for
Testing
CONCLUSION AND FUTURE
SCOPE
BIBLIOGRAPHY AND REFRENCES

37 38
37
37
39
40

LIST OF FIGURES

Figure
No.
1
2
3
4
5
6
7
8
9
10

Description
Components of Linux System
System Architecture
Original Look up
Login and Sign up
Main Menu
Basic Commands
User Management
Disk Management
Server Menu
Apache Web Server

Page No.
12
13
28
29
30
31
32-33
34
35
36

ABSTRACT
Page 4 of 46

Linux-based operating system designed primarily for companys purpose.


Linux is mainly built for networking and server management.
It must be said that Linux, at least the core system, is less user-friendly
than MS Windows and certainly more difficult than Mac OS, but... In light of
its popularity, considerable effort has been made to make Linux even
easier to use, especially for new users.
Because working on TUI mode is more typical then GUI mode, for a new
user working on Linux is not easy than other OS, so i made this tool which
is easy to use and provide better user interface for the beginners as well
as expert.
Automation can be defined as system where information's are transmitted
and used for performing some function without direct participation of man.
Red hat Server Automation Tool is using for automate the servers
according to the requirements. This tool also provides user account
management and disk management services to user without using any
commands. So it is easy to use and understand to end user without any
prior knowledge of Command line OS.

Page 5 of 46

Chapter - 1
ABOUT THE COMPANY
1.1 Introduction to Linux World
Linux World ('LW') Informatics Private Limited - RedHat Awarded Partner,
Cisco Learning Partner and An ISO 9001:2008 Certified Company is
dedicated to offering a comprehensive set of most useful Open Source
and Commercial training programs todays industry demands. Its
dedicated to Open Source technologies and Linux promotion.
Since its inception in the year 2005, LW have achieved the status of
centre of excellence wherein there is latest technology, innovative
developing methodology, state of the art infrastructure and individual
needs of employees are identified and executed professionally, efficiently
& ethically.
We are the Red Hat Partner; Today Red Hat is the world's most trusted
provider of Linux and open source technology. The most recognized Linux
brand in the world.
Red Hat serves global enterprises through technology and services made
possible by the open source model, include Red Hat Enterprise Linux
operating platforms and features RHCE, the global standard Linux
certification.
Red Hat rewarded LinuxWorld as
"The Most Promising Partner"
In the field of Security, We are EC-Council Accredited Partner for Training
& we also serve as Examination Centre. LW is committed to nation
building through extending its high end technical support services to
MNC's and organizations.
Academic institutions are the natural channel to introduce Linux
knowledge and skills to a diverse student population. As the Linux
distributor and service provider, LW continues its long-standing
partnership with the education market by providing the world's only 100%
hands-on Linux curriculum designed on a competency based framework
that includes live- system testing measurements.
Add further quality & diversity to your IT program and/or teach the most
thorough, relevant and up-to- date Linux skills & certification.
Page 6 of 46

1.2 Our Vision Statement


"To come out with the best operating system i.e. a globally acceptable
product this would be different, new and useful to the entire world."
1.3 Services

High end Business & Training Services


(i.e. Training & Development Centre):
LW provides training by in-house experts or certified trainers or corporate
developers in areas related to System & Network Administration,
Programming Languages, Applications/ Software Packages, and Server
Administration etc. depending on the skills required by the customer.
LW is structured around its Customers, in which customers are the focus
of the Organisation. Customers lie at the heart of our strategy. We
encourage our customers to self-manage, identifying for themselves
where their needs lie. Following are the few courses available in various
areas like security, certificate courses, development, database
management, etc.

Ethical Hacking (Basic & Advance Module)

Web Application Development with PHP

RHCE, RHCSS, RHCA

CCENT, CCNA, CCNP, CCIE etc.


Technical Support Services:
With a passionate technical team, fully committed to the development
and progress of Open Source, LW offers its clients high end support
solutions every time.
LINUXWORLD provides support for all major Open Source applications
"Our philosophy be a part of the solution, not part of the
problem"
Research & Development Centre:
The main objective of LW R&D's team is to work dedicate on the loopholes
present in the existing Linux Operating System, to ensure that the same
are removed and plug-in the new development which does not exist in
Page 7 of 46

Linux OS at present. In other words, it follows Push-Pull Strategy i.e. Pull


out the loopholes and Push in the new developments.
Many companies' combines various software available in the
communities/platforms and edits the existing ones to some extent, to give
a new look to the same. As it is rightly said "Old wine in the New bottle"
whereas LW's R&D Centre develops its own networking tools, system
monitoring tools and many other software's and LINUX related tools with
their own and new ideas and not with the help of the existing ones.
LinuxWorld R&D centre is developing, maintaining & promoting its own
special tools based on open source technology & softwares.
According to survey conducted:"LW is the only Organisation in India having a wholly and solely
dedicated R&D Centre for Linux OS"

Chapter - 2
LINUX
2.1

Introduction

Linux was implemented by Linux Torvalds on August 25, 1991 under the
licensed version of UNIX.
Linux is distributed under the GNU General Public License which makes it
mandatory for developers and sellers to make the source code public.
Linux is particularly strong in networking and Internet features, and is an
extremely cost-effective solution in setting up an Internet server or a local
internet. Today, development on Linux is carried out at several locations
across the globe at the behest of the Free Foundations.
In simple terms Linux is an operating system. It is the software on a
computer that applications and the computer operator access the devices
on the computer to perform desired functions. The operating system
relays instructions from an application to, for instance, the computer
processor. The processor performs the instructed task, then send result
back to application via the operating system.
As an operating system, Linux is developed collaboratively meaning no
one company is solely responsible for its developing or ongoing support.
Companies participating in the Linux economy share research and
development costs with their partners and competitors. This spreading of
development burden amongst individuals and companies has resulted in a
large and efficient ecosystem and unheralded software innovation.
Page 8 of 46

2.2

What is open source??

The idea behind Open Source software is rather simple: when


programmers can read, distribute and change code, the code will mature.
People can adapt it, fix it, debug it, and they can do it at a speed that
dwarfs the performance of software developers at conventional
companies. This software will be more flexible and of a better quality than
software that has been developed using the conventional channels,
because more people have tested it in more different conditions than the
closed software developer ever can.
The Open Source initiative started to make this clear to the commercial
world, and very slowly, commercial vendors are starting to see the point.
While lots of academics and technical people have already been
convinced for 20 years now that this is the way to go, commercial vendors
needed applications like the Internet to make them realize they can profit
from Open Source. Now Linux has grown past the stage where it was
almost exclusively an academic system, useful only to a handful of people
with a technical background.
Now Linux provides more than the operating system: there is an entire
infrastructure supporting the chain of effort of creating an operating
system, of making and testing programs for it, of bringing everything to
the users, of supplying maintenance, updates and support and
customizations, etcetera. Today, Linux is ready to accept the challenge of
a fast-changing world.
The Open Source community, consisting largely of people who have been
contributing for over half a decade, assures Linux' position as an
important player on the desktop market as well as in General IT
application. Paid employees and volunteers alike are working diligently so
that Linux can maintain a position in the market.
The more users, the more questions. The Open Source community makes
sure answers keep coming, and watches the quality of the answers with a
suspicious eye, resulting in ever more stability and accessibility.
2.3 Why it is differ than Windows??
Difference between Linux and Windows is as follows:
1: Full access vs. no access: Having access to the source code is probably
the single most significant difference between Linux and Windows. The
fact that Linux belongs to the GNU Public License ensures that users can
access the code to the very kernel that serves as the foundation of the
Linux operating system. In Windows unless you are a member of a very
select group, you will never lay eyes on code making up the Windows
operating system.
Page 9 of 46

2: Licensing freedom vs. licensing restrictions: With a Linux GPLlicensed operating system, you are free to modify that software and use
and even republish or sell it. Also, with the GPL, you can download a
single copy of a Linux distribution and install it on as many machines as
you like. With the Microsoft license, you can do none of the above. You are
bound to the number of licenses you purchase, so if you purchase 10
licenses, you can legally install that operating system on only 10
machines.
3: Online peer support vs. paid help-desk support: This is one issue
where most companies turn their backs on Linux. With Linux, you have
the support of a huge community via forums, online search, and plenty of
dedicated Web sites. And of course, if you feel the need, you can
purchase support contracts from some of the bigger Linux companies.
However, when you use the peer support inherent in Linux, you do fall
prey to time. You could have an issue with something, send out e-mail to a
mailing list or post on a forum, and within 10 minutes be flooded with
suggestions. Or these suggestions could take hours of days to come in. It
seems all up to chance sometimes. Still, generally speaking, most
problems with Linux have been encountered and documented. So chances
are good you'll find your solution fairly quickly. On the other side of the
coin is support for Windows. Yes, you can go the same route with Microsoft
and depend upon your peers for solutions. There are just as many help
sites/lists/forums for Windows as there are for Linux. And you can
purchase support from Microsoft itself. Most corporate higher-ups easily
fall victim to the safety net that having a support contract brings. But
most higher-ups haven't had to depend up on said support contract.
4: Command line vs. no command line: No matter how far the Linux
operating system has come and how amazing the desktop environment
becomes, the command line will always be an invaluable tool for
administration purposes. You can still use the command line with
Windows, but not nearly to the extent as with Linux. And Microsoft tends
to obfuscate the command prompt from users.
5: Centralized vs. noncentralized application installation: With Linux
you have a centralized location where you can search for, add, or remove
software. With Synaptic, you can open up one tool, search for an
application, and install that application without having to do any Web
searching. Windows has nothing like this. With Windows, you must know
where to find the software you want to install, download the software, and
run setup.exe or install.exe with a simple double-clicks. For many years, it
was thought that installing applications on Windows was far easier than
on Linux. Not so much now. Installation under Linux is simple, painless,
and centralized.
Page 10 of 46

6: Flexibility vs. rigidity: Unless you are willing to pay for and install a
third-party application that can alter the desktop appearance, with
Windows you are stuck with what Microsoft has declared is the ideal
desktop for you. With Linux, you can pretty much make your desktop look
and feel exactly how you want/need.
7: Multilayered run levels vs. a single-layered run level: With this, you
can work from either the command line (run level 3) or the GUI (run level
5). This can really save your socks when X Windows is fubared and you
need to figure out the problem. You can do this by booting into run level 3,
logging in as root, and finding/fixing the problem. With Windows, you're
lucky to get to a command line via safe mode - and then you may or may
not have the tools you need to fix the problem. In Linux, even in run level
3, you can still get and install a tool to help you out.
2.4 Properties
A lot of the advantages of Linux are a consequence of Linux' origins,
deeply rooted in UNIX, except for the first advantage, of course:

Linux is free:
As in free beer, they say. If you want to spend absolutely nothing, you
don't even have to pay the price of a CD. Linux can be downloaded in
its entirety from the Internet completely for free. No registration fees,
no costs per user, free updates, and freely available source code in case
you want to change the behavior of your system.
Most of all, Linux is free as in free speech:
The license commonly used is the GNU Public License (GPL). The license
says that anybody who may want to do so has the right to change Linux
and eventually to redistribute a changed version, on the one condition
that the code is still available after redistribution. In practice, you are
free to grab a kernel image, for instance to add support for
teletransportation machines or time travel and sell your new code, as
long as your customers can still have a copy of that code.

Linux is portable to any hardware platform:


A vendor who wants to sell a new type of computer and who doesn't
know what kind of OS his new machine will run (say the CPU in your car
or washing machine), can take a Linux kernel and make it work on his
hardware, because documentation related to this activity is freely
available.

Linux was made to keep on running:


As with UNIX, a Linux system expects to run without rebooting all the
time. That is why a lot of tasks are being executed at night or scheduled
Page 11 of 46

automatically for other calm moments, resulting in higher availability


during busier periods and a more balanced use of the hardware. This
property allows for Linux to be applicable also in environments where
people don't have the time or the possibility to control their systems
night and day.

Linux is secure and versatile:


The security model used in Linux is based on the UNIX idea of security,
which is known to be robust and of proven quality. But Linux is not only
fit for use as a fort against enemy attacks from the Internet: it will
adapt equally to other situations, utilizing the same high standards for
security. Your development machine or control station will be as secure
as your firewall.

Linux is scalable:
From a Palmtop with 2 MB of memory to a petabyte storage cluster with
hundreds of nodes: add or remove the appropriate packages and Linux
fits all. You don't need a supercomputer anymore, because you can use
Linux to do big things using the building blocks provided with the
system. If you want to do little things, such as making an operating
system for an embedded processor or just recycling your old 486, Linux
will do that as well.

The Linux OS and quite some Linux applications have very short
debugtimes:
Because Linux has been developed and tested by thousands of people,
both errors and people to fix them are usually found rather quickly. It
sometimes happens that there are only a couple of hours between
discovery and fixing of a bug.

Linux is not very user friendly and confusing for beginners:


It must be said that Linux, at least the core system, is less user-friendly
to use than MS Windows and certainly more difficult than Mac OS, but...
In light of its popularity, considerable effort has been made to make
Linux even easier to use, especially for new users. More information is
being released daily, such as this guide, to help fill the gap for
documentation available to users at all levels.

Linux is an Open Source Technology.

Linux is built for Networking.


It has Multi-User, Multiprogramming OS.
It has Hierarchical File System.

2.5 Architecture
2.5.1 Principles:
Linux was built upon a small set of core principles. That includes:
Page 12 of 46

Small single purpose commands.


Strictly simple output form said commands.
Loosely accepted varied input for said commands.
EVERYTHING is a File.
All configuration stored in ASCII.

2.5.2 Components of Linux System:

I. Kernel:
The kernel is the core part of the operating system a collection of
routines mostly written in C. It is located into memory when the system
is booted and communicates directly with the Hardware. It is responsible
for all major activities of the operating system.
Kernel provides the required abstraction to hide low level hardware
details to system or application programs.
It manage the system`s memory, schedules processes, decide their
properties, and perform other task.
II. System Library:
System Libraries are special functions or programs using which
application programs or system utilities access Kernel`s features. These
Libraries implements most of the functionalities of the operating system
and do not requires Kernel module`s code access rights.
III. System Utility:
System utility programs are responsible to do specialized, individual
level tasks.
2.5.3 System Architecture
The Linux System Architecture is consists of following layers:

Page 13 of 46

a) Hardwar Layer: Hardware devices of all peripheral devices


(RAM/HDDD/CPU etc).
b) Kernel: Core component of Operating System, interacts directly with
hardware provide low level services to upper layer components.
c) Shell: An interface to Kernel, hiding complexity of kernel`s functions
from users. Takes commands from user and executes kernel`s
functions.
d) Utilities: Utility programs giving user most of the functionalities of an
operating system.
2.6 Flavors of Linux
There are many OS flavors based on Linux available in market. Some
flavors as follows:
Red Hat: Red Hat (Enterprise) Linux is probably the largest commercial
Linux vendor. Focus on stability and long term support. Red Hat
sponsors a community version (Fedora) which undergoes a more rapid
development cycle.
KNOPPIX: The first Live CD version. The OS can be booted from, and
run completely off the CD. KNOPPIX is based on Debian Linux. Many
vendors now offer live versions. No installation necessary.

Ubuntu: Ubuntu based on Debian Linux. Ubuntu claims to be most


popular desktop version. Many applications and excellent update
mechanism contribute to its success. Revenue is created by selling
technical support.
Puppy: This distribution is small enough to be loaded entirely in RAM.
This frees up the CD/DVD drive for other uses. Configuration can be
saved to a file between reboots.
Page 14 of 46

SuSE Linux: primarily available for pay because it contains many


commercial programs, although there's a stripped-down free version
that you can download.
Mandrake Linux: Mandrake is perhaps strongest on the desktop.
Gentoo Linux: Gentoo is a specialty distribution meant for
programmers.

Chapter - 3
REDHAT ENTERPRISE LINUX (RHEL)
3.1 About Red Hat Corporation
Red Hat, Inc. is an American multinational software company providing
open-source software products to the enterprise community. It was
founded in 1993, by Bob Young and Marc Ewing. Red Hat has its
corporate headquarters in Raleigh, North Carolina, with satellite offices
worldwide. It has approx. 6500 employers in 2014. Official website of
redhat is www.redhat.com.
Red Hat has become associated to a large extent with its enterprise
operating system Red Hat Enterprise Linux and with the acquisition of
open-source enterprise middleware vendor JBoss.
Red Hat provides operating system platforms, middleware, applications,
management products, and support, training, and consulting services.
Red Hat creates, maintains, and contributes too many free software
projects and has also acquired several proprietary software packages and
released their source code mostly under the GNU GPL while holding
copyright under a single commercial entity and selling user subscriptions.
As of June 2013, Red Hat is the largest corporate contributor to Linux.
REDHAT INDIA:
Red Hat, Inc. created its subsidiary Red Hat India to deliver Red Hat
software, support, and services to customers in India. Colin Tenwick, vice
president and general manager of Red Hat EMEA said that "the opening of
[Red Hat India] is in response to the rapid adoption of Red Hat Linux in the
subcontinent. Demand for open source solutions from the Indian markets
is rising and Red Hat wants to play a major role in this region".
Red Hat India has worked with local companies to enable adoption of open
source technology in both government and education. In 2006 Red Hat
India had a distribution network of more than 70 channel partners
spanning 27 cities across India. Red Hat India's channel partners included
Ashtech InfoTech Pvt Ltd, Efensys Technologies, Embee Software, Allied
Page 15 of 46

Digital Services, and Softcell Technologies. Distributors included Integra


Microsystems and Ingram Micro.
3.2 About Red Hat Services
Red Hat provides installation and configuration support to certification
programs, Red Hat services set a new standard for enterprise-level
support for Linux based operating system. Red Hat continues to grow its
support offerings, including the international expansion of its popular Red
Hat Certified Engineer training and certification courses for RedHat Linux.
It also offers developer training courses. Some Training and Certification
Courses as follows:

RHCT REDHAT Certified Technician


RHCE REDHAT Certified Engineer
RHCSS REDHAT Certified Security Specialist
RHCDS REDHAT Certified Datacenter Specialist
RHCA REDHAT Certified Architect
RHOSA REDHAT OpenStack Administration

RHCVA REDHAT Certified Virtualization Administration


3.3 Introduction of Red Hat Enterprise Linux (RHEL)
Red Hat is the world's most trusted provider of Linux and open source
technology. Red Hat provides operating system platforms along with
virtualization, middleware, applications, management, and serviceoriented architecture (SOA) solutions, as well as support, training, and
consulting services to customers worldwide and through top-tier
partnerships. Red Hat is the first distributor to bring cross-platform JAVA
technology to Linux community.
Red Hat Enterprise Linux (RHEL) is a Linux distribution developed by Red
Hat and targeted toward the commercial market. Red Hat Enterprise Linux
is released in server versions for x86, x 86-64, Itanium, PowerPC and IBM
System z, and desktop versions for x86 and x 86-64. All of Red Hat's
official support and training and the Red Hat Certification Program centers
on the Red Hat Enterprise Linux platform. Red Hat Enterprise Linux is
often abbreviated to RHEL, although this is not an official designation.
The first version of Red Hat Enterprise Linux to bear the name originally
came onto the market as "Red Hat Linux Advanced Server".
In 2003 Red Hat rebranded Red Hat Linux Advanced Server to "Red Hat
Enterprise Linux AS", and added two more variants, Red Hat Enterprise
Linux ES and Red Hat Enterprise Linux WS. Red Hat uses strict trademark
rules to restrict free re-distribution of their officially supported versions of
Page 16 of 46

Red Hat Enterprise Linux, but still freely provides its source code. Thirdparty derivatives can be built and redistributed by stripping away non-free
components like Red Hat's trademarks, including community- supported
distributions like CentOS and Scientific Linux, and commercial forks like
Oracle Linux, which aim to offer 100 % binary compatibility with Red Hat
Enterprise Linux.
In market a lot of versions are available but latest version is REDHAT 7,
which is used Linux Kernel from range 2.6 to 3.10. REDHAT 7 is mainly
based on virtualization and cloud.
3.4 Hardware Requirements for RHEL 6

System with 64 Bit CPU and related hardware.

Intel/AMD x86_64 Architecture.

RAM: Minimum 200 MB (on VM without GUI) and Maximum 2TB on 64bit system.

Hard Drive: Minimum 12 GB.

Chapter - 4
SHELL SCRIPT
4.1 SHELL
4.1.1 What Is a Shell?
The shell is a user program or it is an environment provided for user
interaction.
It is a command language interpreter that executes commands read
from the standard input device such as keyboard or from a file.
The shell gets started when you log in or open a console (terminal).
Quick and dirty way to execute utilities.
The shell is not part of system kernel, but uses the system kernel to
execute programs, create files etc.
Several shells are available for Linux including:
BASH (Bourne-Again Shell) - Most common shell in Linux. It's Open
Source.
CSH (C Shell) - The C shell's syntax and usage are very similar to the C
programming language.

Page 17 of 46

KSH (Korn Shell) - Created by David Korn at AT & T Bell Labs. The Korn
Shell also was the base for the POSIX Shell standard specifications.
TCSH - It is an enhanced but completely compatible version of the
Berkeley UNIX C shell.
Each shell does the same job, but each understands different command
syntax and provides different built-in functions. Under MS-DOS, the shell
name is COMMAND.COM which is also used for the same purpose, but it is
by far not as powerful as our Linux Shells are!
4.1.2 Shell Prompt
There are various ways to get shell access:
Terminal - Linux desktop provide a GUI based login system. Once logged
in you can gain access to a shell by running X Terminal (X Term), Gnome
Terminal (G Term), or KDE Terminal (K Term) application.
Connect via secure shell (SSH) - You will get a shell prompt as soon as
you log in into remote server or workstation.
Use the console - A few Linux System also provides a text-based login
system. Generally you get a shell prompt as soon as you log in to the
system.
4.1.3 Command Line Interface (CLI)
The shell provides an interface to Linux where you can type or enter
commands using the keyboard. It is known as the command line interface
(CLI). To find out your current shell type following command:
echo $SHELL
ps $$
ps -p $$
Basic Command Line Editing
You can use the following key combinations to edit and recall commands:
CTRL + L : Clear the screen.
CTRL + W : Delete the word starting at cursor.
CTRL + U : Clear the line i.e. Delete the all words from command line.
Up and Down arrow keys : Recall commands (see command history).
Tab : Auto-complete files, directory, command names and much more.
CTRL + R : Search through previously used commands (see command
history)
Page 18 of 46

CTRL + C : Cancel currently running commands.


CTRL + T : Swap the last two characters before the cursor.
ESC + T : Swap the last two words before the cursor.
Executing a Command
Type your command, and press enter key. Try this date command which
will display current date and time:
date
Sample outputs:
Tue Apr 27 05:20:35 IST 2010
Getting Help in Linux
Most commands under Linux will come with documentation.
You can view documentation with the man command or info command.
In this example, open the man page for date command:
man date
You can read info documentation as follows for the ls command:
Info ls
Many commands accept --help or -h command line option. In this
example, display helps options for the date command:
date --help
In short use any one of the following option to get more information
about Linux: commands:
man commzandName
info commandName
commandName -h
commandName help

4.2 SHELL SCRIPT


4.2.1 What Is Shell Script

Page 19 of 46

A Shell script can be defined as - "a series of command(s) stored in a


plain text file". A shell script is similar to a batch file in MS-DOS, but it is
much more powerful compared to a batch file.
Shell scripts are a fundamental part of the UNIX and Linux programming
environment.
Each shell script consists of:
Shell keywords such as if..else, do..while.
Shell commands such as pwd, test, echo, continue, type etc.
Linux binary commands such as w, who, free etc.
Text processing utilities such as grep, awk, cut etc.
Functions - add frequent actions together via functions. For example,
/etc/init.d/functions file contains functions to be used by most or all
system shell scripts in the /etc/init.d directory.
Control flow statements such as if..then..else or shell loops to preform
repeated actions.
Each script has purpose:
Specific purpose - For example, backup file system and database to NAS
server.
Act like a command - Each shell script executed like any command
under Linux.
Script code usability - Shell scripts can be extended from existing
scripts. Also, you can use functions files to package frequently used
tasks.
4.2.2 Why shell scripting?
Shell scripts can take input from a user or file and output them to the
screen.
Whenever you find yourself doing the same task over and over again
you should use shell scripting, i.e., repetitive task automation.
Creating your own power tools/utilities.
Automating command input or entry.
Customizing administrative tasks.
Creating simple applications.
Since scripts are well tested, the chances of errors are reduced while
configuring services or system administration tasks such as adding new
users.
Page 20 of 46

Practical examples where shell scripting actively used:


Monitoring your Linux system.
Data backup and creating snapshots.
Dumping Oracle or MySQL database for backup.
Creating email based alert system.
Find out what processes are eating up your system resources.
Find out available and free memory.
Find out all logged in users and what they are doing.
Find out if all necessary network services are running or not. For
example if web server failed then send an alert to system administrator
via a pager or an email.
User administration as per your own security policies.
Find out information about local or remote servers.
Advantages
Easy to use.
Quick start, and interactive debugging.
Time Saving.
System Admin task automation.
Shell scripts can execute without any additional effort on nearly any
modern UNIX / Linux / BSD / Mac OS X operating system as they are
written an interpreted language.
Disadvantages
Compatibility problems between different platforms.
Slow execution speed.
A new process launched for almost every shell command executed.
4.2.3 Write a Shell Script
Following steps are required to write shell script:
(1) Use any editor like VI or gedit to write shell script.
(2) After writing shell script set execute permission for your script as
follows
syntax:
chmod permission your-script-name
Example: $ chmod 755 your-script-name
(3) Execute your script as
syntax:
Page 21 of 46

bash your-script-name
sh your-script-name
./ your-script-name
NOTE In the last syntax ./ means current directory, But only . (dot) means
execute given command file in current shell without starting the new copy
of shell, The syntax for . (dot) command is as follows:
. command-name
Now you are ready to write first shell script that will print "Knowledge is
Power" on screen.
$ vi first
#
# My first shell script
#
clear
echo "Knowledge is Power"
After saving the above script, you can run the script as follows:
$ ./first
This will not run script since we have not set execute permission for our
script first; to do this type command
$ chmod 755 first
$ ./first
First screen will be clear, then Knowledge is Power is printed on screen.
Normally shells are interactive. It means the shell will accept command
from you (via keyboard) and execute them. However, if you store a
sequence of commands to a text file and tell the shell to execute the text
file instead of entering the commands, that is known as a shell program or
shell script.

4.3 DIALOG BOX SCRIPT


Dialog Box is used to provide a GUI Interface on command line. It is
started with dialog command.
Dialog Box has many attributes which as following:
--calendar text height width day month year
A calendar box displays month, day and year in separately adjustable
windows. You can increment or decrement any of those using the left-,
up-, right- and down-arrows.
On exit, the date is printed in the form day/month/year.
Page 22 of 46

--checklist text height width list-height [ tag item status ] ...


A checklist box is similar to a menu box; there are multiple entries
presented in the form of a menu. Instead of choosing one entry among
the entries, each entry can be turned on or off by the user. The initial
on/off state of each entry is specified by status. On exit, a list of the tag
strings of those entries that are turned on will be printed on dialog's
output.
--form text height width formheight [ label y x item y x flen ilen ] ...
The form dialog displays a form consisting of labels and fields, which are
positioned on a scrollable window by coordinates given in the script. The
field length flen and input-length ilen tell how long the field can be. The
former defines the length shown for a selected field, while the latter
defines the permissible length of the data entered in the field. On exit, the
contents of the form-fields are written to dialog's output, each field
separated by a newline. The text used to fill non-editable fields (flen is
zero or negative) is not written out.
--infobox text height width
An info box is basically a message box. However, in this case, dialog
will exit immediately after displaying the message to the user. The screen
is not cleared when dialog exits, so that the message will remain on the
screen until the calling shell script clears it later. This is useful when you
want to inform the user that some operations are carrying on that may
require some time to finish. On exit, no text is written to dialog's output.
Only an "OK" button is provided for input, but an ESC exit status may be
returned.
--inputbox text height width [init]
An input box is useful when you want to ask questions that require the
user to input a string as the answer. If init is supplied it is used to initialize
the input string. When entering the string, the backspace, delete and
cursor keys can be used to correct typing errors. If the input string is
longer than can fit in the dialog box, the input field will be scrolled. On
exit, the input string will be printed on dialog's output.
--inputmenu text height width menu-height [tag item]
An inputmenu box is very similar to an ordinary menu box. There are
only a few differences between them:
1. The entries are not automatically centered but left adjusted.
2. An extra button (called Rename) is implied to rename the current item
when it is pressed.

Page 23 of 46

3. It is possible to rename the current entry by pressing the Rename


button. Then dialog will write the following on dialog's output.
RENAMED <tag> <item>
--menu text height width menu-height [tag item] ...
Menu box is a dialog box that can be used to present a list of choices in
the form of a menu for the user to choose. Choices are displayed in the
order given. Each menu entry consists of a tag string and an item string.
The tag gives the entry a name to distinguish it from the other entries in
the menu. The item is a short description of the option that the entry
represents. The user can move between the menu entries by pressing the
cursor keys, the first letter of the tag as a hot-key, or the number keys 19. There are menu-height entries displayed in the menu at one time, but
the menu will be scrolled if there are more entries than that.
On exit the tag of the chosen menu entry will be printed on dialog's
output. If the "--help-button" option is given, the corresponding help text
will be printed if the user selects the help button.
--msgbox text height width
A message box is very similar to a yes/no box. The only difference
between a message box and a yes/no box is that a message box has
only a single OK button. You can use this dialog box to display any
message you like. After reading the message, the user can press the
ENTER key so that dialog will exit and the calling shell script can continue
its operation. On exit, no text is written to dialog's output. Only an "OK"
button is provided for input, but an ESC exit status may be returned.
--passwordbox text height width
A password box is similar to an input box, except that the text the user
enters is not displayed. This is useful when prompting for passwords or
other sensitive information.
--textbox file height width
A text box lets you display the contents of a text file in a dialog box. It is
like a simple text file viewer. The user can move through the file by using
the cursor, page-up, page-down and HOME/END keys available on most
keyboards. On exit, no text is written to dialog's output. Only an "EXIT"
button is provided for input, but an ESC exit status may be returned.
--yesno text height width
This dialog box is useful for asking questions that require the user to
answer either yes or no. The dialog box has a Yes button and a No
button, in which the user can switch between by pressing the TAB key. On
exit, no text is written to dialog's output. In addition to the "Yes" and "No"
exit codes (see DIAGNOSTICS) an ESC exit status may be returned.
Page 24 of 46

Chapter - 5
SERVER
5.1 TELNET
Telnet server is used to login into another system on same network. The
system can be on your local area network or available through an internet
connection. Telnet operates as if you were logging in to another system
from a remote terminal. You will ask for a login name and password. In
effect, you are logging in to another account on another system. In fact, if
you have an account on another system, you could see telnet to log in to
it.
You invoke the telnet utility with the keyword telnet. If you know the
name of the site you want to connect with, you can enter name of the site
on Linux command line.
Example:
[root@localhost ~] # telnet 192.168.0.2
5.2 Open SSH
Secure shell (SSH) is used to provide secure connections over a network
or internet. All data transferred using Open SSH tool is encrypted, making
it inherently more secure. The Open SSH suite of tools includes SSH for
securely logging in to a remote system.
Open SSH uses a server-client relationship. The system being connected
to is referred to as the server. The system requesting the connection is
referred to as the client. A System can be both an SSH server and a client.
Open SSH also has added the benefits of X11 forwarding and port
forwarding.
X11 forwarding:
If X11 forwarding enabled on both the server and client, allow users to
display a graphical application from the system they are logged in to on
the system they are logged in from.
Port forwarding
It allows a connection request to be sent to one server but be forwarded
to another server that actually accepts the request.
Example:
Page 25 of 46

Logging from normal user of another system follows:


[root@localhost ~] # ssh 192.168.0.2 -l hp
5.3 FTP
FTP Server is used to transfer files between server and clients. All major
operating system supports ftp. Ftp is the most used protocol over internet
to transfer files. FTP work on client-server model. FTP client programs can
enable users to transfer files to and form a remote running an FTP server
program.
Any Linux system can operate as an FTP server. It has to run only the
server software-an ftp daemon with the appropriate configuration.
Transfers are made between user accounts on client and server system. A
user on the remote system has to log in to an account on a server an can
than transfer files to and from that account`s directories only.
A special kind of user account, named ftp, allow any user to log in to it
with the username anonymous.
This account has its own set of directories and files that are considered
public available to anyone on the network who wants to download them.
The numerous FTP sites on the internet are FTP server supporting FTP
user account with anonymous login. Any Linux system can be configured
to support anonymous FTP access, turning them into network FTP sites.
Such sites can work on intranet or on the or internet.
5.4 NIS and NFS
NIS or Network Information System is a network service that allows
authentication and login information to be stored on a centrally located
server. This includes the user name and password database for login
authentication, database of user group, and locations of home directories.
NFS or Network File System is a server-client protocol for sharing files
between computers on a common network. NFS enables you to mount a
file system on a remote computer as if it were local to your own system.
You can then directly access any of the files on that remote file system.
The server and client do not have to use the same operating system. The
client system just needs to be running an NFS Client compatible with the
NFS server.
5.5 Apache and Samba Server

Page 26 of 46

Apache Server:
When you view a web page over the internet, the code of that page must
be retrieved from a server somewhere on the internet. The Server that
sends your web browser the code to display a web page is called a web
server. There are countless web servers all over the internet serving
countless websites to people all over the world.
Whether you need a web server to host a website on the internet a Red
Hat Enterprise Linux server can function as a web server application using
the Apache HTTP Server. The Apache HTTP Server is a popular, open
source server application that runs on many UNIX-based as well as
Microsoft Windows.
Apache web server provides two type webs hosting as follows:
Name Based Hosting: In this type you have configured multiple sites
with same ip address.
IP Based Hosting: In this type we will host multiple sites with multiple ip
address.
Samba Server:
Most Linux systems are the part of networks that also run Windows
systems. Using Linux Samba Server, your Linux and Windows systems
can share directories and printers. This is most use full situation where
your clients are window native and you want to use Linux security
features.
5.6 SMTP Mail Server
SMTP: SMTP is an acronym for Simple Mail Transport Protocol. This is the
protocol used by the email systems to transfer mail message from one
server to another. This protocol is essentially the communications
language that the MTAs use to talk to each other and transfer messages
back and forth.
MTA: The Mail Transfer Agent is the part of the email system that does
much of the work of transferring the email message from one computer to
another (either on the same local network or over the internet to a remote
system). Once configured correctly, most users will not have any direct
interaction with their chosen MTA unless they wish to re-configure it for
any reason. There are many choices of MTA available for Linux including
sendmail, Postfix, Fetchmail, Qmail and Exim.

Page 27 of 46

Chapter - 6
PROJECT OVERVIEW
I worked on the project titled as REDHAT Server Automation. This is an
automation tool which is developed for REDHAT Servers automation by
using shell script. This project is made keeping in mind the people is work
on a new OS without knowing more about that.
4.1 Scope:

Red hat Server Automation Tool is using for automate the servers
according to the requirements.
It provides a better user interface for the beginners as well as expert.
Working on TUI mode is more typical then GUI mode so it provides
graphical interface on terminal mode.

4.2 Introduction
Automation can be defined as system where information's are
transmitted and used for performing some function without direct
participation of man.
In this tool we automate the following servers:

Telnet Server
Open SSH Server
Networks Server : NFS and NIS
Web Servers : Apache and Samba
Mail Server : SMTP
File Transfer : FTP

4.3 DESIGN PRINCIPLES & EXPLANATION


Page 28 of 46

4.3.1. Modules

Basic commands

User Management

Disk Management

Server Management

4.3.2. Module Description


Basic Commands:

It is usable to beginners of Linux, which have knowledge of command line


OS.
It has described some basic commands of Linux like Cal, date, pwd etc.
It describes Syntax, output of a command that will helpful to new user to
show about command that how it is used and what the output is given by
it.

Disk Management:

This option is used to manage disk partitions on HDD and USB. It is used to
create new partition, delete partition, change partition type
(NTFS/FAT/exFAT) etc.
You can simply provide disk type, partition number, partition size, partition
type to this option. Its can simply create a new partition and automatically
mount this partition.

User Management:
This option is used to manage user accounts, groups, and change access
permission to particular user according to requirements. It has following parts:

ADD USER: It is used to add a new user account. You can simply click on
this option and give a user name and click ok or press enter than it
automatically added a new user and give permission and security to new
user.
ADD GROUP: It is used to add a new group. You can simply click on this
option and give a group name and click ok or press enter than it
automatically added a new group.
REMOVE USER: It is used to remove user account.
REMOVE GROUP: It is used to remove group.

Server Management:
This option is used to manage server`s installation and configuration. This is used
to provide this management service to both Server and Client Side. It consists
following server:
Page 29 of 46

Telnet Server
Open SSH Server
NFS
NIS
Apache
Samba
Mail Server : SMTP
File Transfer : FTP

4.4 TECHNOLOGY USED

REDHAT 6.4

Kernel 2.6.32

Shell Script and Dialog Box Script

TUI Based Programming

Chapter - 7
PROJECT SNAPSHOTS
ORIGINAL LOOKUP

Page 30 of 46

LOGIN AND SIGN UP-

Page 31 of 46

MAIN MENU

Page 32 of 46

BASIC COMMANDS

Page 33 of 46

Page 34 of 46

DISK MANAGEMENT MENU


Create Partition
Provide Disk Type, Disk Size, Partition Type and Partition Size:

Page 35 of 46

Page 36 of 46

USER MANAGEMENT MENU

Page 37 of 46

USER MANAGEMENT
Page 38 of 46

ADD USER

REMOVE USER

Page 39 of 46

SERVER MENU
(Server Side OR Client Side)

Page 40 of 46

APACHE WEB SERVER

Page 41 of 46

Chapter - 8
TESTING
7.1 Software Implementation
Page 42 of 46

A software implementation method is a systematically structured


approach to effectively integrate software based service or component
into the workflow of an organizational structure or an individual end-user.
It is a blueprint to get users and/or organizations running with a specific
software product.
The method is a set of rules and views to cope with the most common
issues that occur when implementing a software product: business
alignment from the organizational view and acceptance from the human
view.
It is stated that the implementation of software consumes up to 1/3 of the
budget of a software purchase (more than hardware and software
requirements together).
The complexity of implementing product software differs on several
issues. These issues may be:

The number of end users that will use the product software.
The effects that the implementation has on changes of tasks and
responsibilities for the end user.
The culture and the integrity of the organization where the software
is going to be used.
The budget available for acquiring software.

7.2 Methodology used for testing:


Software testing is a critical element of software quality assurance and
represents the 0ultimate review of specification, design, and code
generation. The increasing visibility of software as a system element and
the attendant costs associated with a software failure are motivating
forces for well-planned software development, through testing.
The main objectives of testing are listed below:

Testing is a process of executing a program with the intent of finding


an error.
A good test case is one that has a high probability of finding an asyet-undiscovered error.
A successful test is one that uncovers an as-yet-undiscovered error.

7.2.1 Testing Perspectives

Page 43 of 46

Software is tested from two different perspectives:


1. Internal program logic is exercised using "white-box" test case design
techniques.
2. Software requirements are exercised using "black-box" test case design
techniques.
In both cases, the intent is to find the maximum number of errors with the
minimum amount of effort and time.
The two types of techniques, which have been used to test this project are
briefly described as follows:
Black-box testing:
It refers to testing a system with no specific knowledge to the internal
workings of the system, no access to the source code, and no knowledge
of the architecture. In essence, this approach most closely mimics how an
attacker typically approaches your application. However, due to the lack
of internal application knowledge, the uncovering of bugs and/or
vulnerabilities can take significantly longer.
White-box testing:
It refers to testing a system will full knowledge and access to all source
code and architecture documents. Having full access to this information
can reveal bugs and vulnerabilities more quickly than the "trial and error"
method of black box testing. Additionally, you can be sure to get more
complete testing coverage by knowing exactly what you have to test.
However, because of the sheer complexity of architectures and volume of
source code, white box testing introduces challenges regarding how to
best focus the test and analysis efforts. Also, specialized knowledge and
tools are typically required to assist, such as debuggers and source code
analyzers.

Page 44 of 46

CONCLUSION AND FUTURE SCOPE

While developing the Automation Tool I learned about Red Hat operating
system. I learned how I can install and configure a server in Red Hat
operating system. Red Hat servers are used in bride range than Windows
server in maximum companies. Redhat Servers is more trusted and useful
than windows Server. It is becoming the most widely spread platform and
contains many opportunities for the developers to make more applications
as it is very flexible and easy to use.
This tool is help to install and configure server according to requirements
and manage user accounts, disk partitions, so no need to remember of
commands or any prior knowledge of Linux OS.
This tool is easy to use and helpful for beginners as well as experts, so it
has a good future scope that people use it to save time and cost for setup
servers.

Page 45 of 46

BIBLIOGRAPHY AND REFRENCES


(I) BIBLIOGRAPHY:
UNIX by Sumitabha das
Red Hat Linux Networking and System Administration
(II) REFERENCES:

RHCE Course Manuals provided by Linux World Informatics Pvt. Ltd.


www.google.com
www.wikipedia.com
www.linuxquestions.org

Page 46 of 46

You might also like