You are on page 1of 54

 Meta Verified

Open Source?
Unix/Linux
Contents:  Introduction and History
 Types And Flavors
 Why Linux & that too Red Hat
 Installation using Virtual Machine
 Basic key Points
 User Administration
 File and Directory Concept
 File Security
 Services management
 Boot Process
 Software Installation
 Basic Networking and File sharing
Introduction
And
History
2.1 Introduction And history:

In 1969, a team of developers in the Bell Labs laboratories started working on a


solution for the software problem, to address these compatibility issues. They
developed a new operating system, which was Simple and elegant.
 Written in the C programming language instead of in assembly code.
 Able to recycle code.
 The Bell Labs developers named their project "UNIX."
2.1 Introduction And history:

 Who is Dennis M. Ritchie?


Some people become important because they change history, others make
the history.
 Dennis Ritchie belongs to the second group of people.
 he developed the "C" language, the most used programming language.
 But it was not enough for him. Dennis Ritchie and Ken Thompson developed
the Unix operating system, i.e. The Operating System.
 Yes, He created UNIX.
2.1 Introduction And history:
2.1 Introduction And history:

 He didn’t Stop! as a result, Plan 9 and Inferno were developed by the


group of researchers under his leadership.
 His work has been recognized by numerous computer organizations:

 ACM award for the outstanding paper of 1974 in systems and languages;
 IEEE Emmanuel Piore Award (1982),
 Bell Laboratories Fellow (1983);
 Association for Computing Machinery Turing Award (1983);
 C&C Foundation award of NEC (1989):
 IEEE Hamming Medal (1990), etc.
2.1 Introduction And history:

Problems With Unix:


 UNIX was initially found only in very large environments with mainframes
and minicomputers. You had to work at a university, for the government
or for large financial corporations in order to get your hands on a UNIX
system.
 Smaller computers were also being developed, and by the end of the 80's,
many people had home computers. By that time, there were several
versions of UNIX available for the PC architecture, but none of them were
truly free and more important: they were all terribly slow, so most people
ran MS DOS or Windows 3.1 on their home PCs.
2.1 Introduction And history:

Linus, Linux And Start Of Revolution


 Every Organizations/Companies started modifying Unix Source Code and
hence started making flavors leading a huge fall in the marked of Unix
and making it no more cost free.
 It became very costly Where as Dennis Ritchi was against it. He Again sit
back called back all team member as he was made thankful for his great
services at Bell Labs.
2.1 Introduction And history:

Linus, Linux And Start Of Revolution


 He had a plan to redesign a Unix that must go freely in hands. So, he started
working on a GNU Project (GNU=GNU’s Not Unix) with Richard Stallmen.
 Exactly in the same days when Linus Torvald was in at the edge of his
graduation; he was looking for a project just for fun But his fun in his final
project changed a history by designing a kernel which was compatible to
every system/hardware/machines which was nearly to impossible.
 This News prompted Dennis Ritchi and Richard Stallmen to call him and join
the table and in the same way members from all other places were also
called and told them that whatever you can do, do... In this way Peoples
started designing Apps and Later on a new Interface was Named as
 Linus + Unix = Linux!
 And a community GNU(GNU’s Not Unix) appeared on the planet.
Types
And

Flavors
2.2 Types And Flavors

Mark Shuttleworth, Canonical

And many more….


2.2 Types And Flavors

Whereas from their usage aspects:


Why Linux
And
That too Red Hat
2.3 Why Linux
2.3 Why Linux
2.3 Why Linux

But its Biggest Disadvantage:


 We can’t copy files larger than 3.7 GB Approx. to external drives or Networks
 For this we have divide data in sub chunks! And then these are transferred!
And rejoining them back.
2.3 Why Red hat Linux

 In 1994, Marc Ewing created Red Hat Linux


(Ewing used to wear a red Cornell University lacrosse hat)

After Too much Devotions to OpenSource, Company was gonna break !


New innovation: Addition of Entreprise Layer, 2000-03
 Now CentOS community which used to remove trademark of REDHAT from
RHEL source Code, is gonna join with Redhat Team (News)

 Most Widely Used Linux which runs on server machines and enable us to
provide services.
 And also let us to make virtualizations (KVM) of multiple Operating System within
it, hence making multiple layered security more enhanced.
2.3 Why Red hat Linux

 The top 10 enterprise apps run on RHEL and 500++ rely on, hence jobs++
 Mostly Used in Cloud Computing
 The most demanding applications run better on red hat enterprise linux
 Enterprise linux is robust, scales well, and is more reliable
 Enterprise linux is secure
 Red hat partners with hardware vendors
 Enterprise linux supports standard datacenter management tools
 Everyone benefits from red hat’s strategic partnerships
 Red hat training and support
 Enterprise linux is ahead of the curve
Installations
using Virtual Machine
2.4 Installation using Virtual Machine

 What is VM?
 Tool Name: VMware Workstation
 Used as: To run Multiple OS within One OS regardless of buying Multiple
Machines to run
 Competitors: Oracle Virtual Box. Parallels, QEMU etc.
 You must have
 rhel-server-7.0-x86_64-dvds.ISO or DVD in order to install.
 Follow the steps :
Basic
key Points
2.5 Basic key Points

1. Shell, Bash, Terminal


2. GUI Components
3. Super User
4. Root and “/”
 Interaction with Terminal
5. root@Computer:~#
6. Limited@Computer:~$
6.1 The Use of Tab 6.2 The use of “>” within Commands
6.3 Synopsis (Constructers in c/java)
2.5 Basic key Points
7. Few Basic Commands:
Commands Uses
ls , ls –a, ls –al Displays a list of files in the current working directory
cd, cd.. , cd / change directories, change to backward directory, change to root
Passwd change the password for the current user
file filename display file type of file with name filename
Pwd display present working directory
exit or logout leave this session
man command read manual pages of command
Su To get superUser Rights
Sudo Enable us to execute a command with full rights
Arch Shows the architecture of Machine
Ping To check system is alive
Find (find / -name “”) To find any sort of file
Cp To copy
Mv To move a file or to rename
Rm To remove
mkdir To make a directory
$PATH and $HOME Displays Path of current or Home Directory
more To display texts files
Vi, vim Edit files of texts or configs files
hexdump View bytes of files in hexadecimal codes
2.5 Basic key Points

8. Few Basic Commands:


Color File Type
blue directories
Red compressed archives
white text files
pink images
cyan links
yellow devices
green Executable
flashing red broken links
User
Administration
2.6 User Administration

1  In Linux there are three type of users:


1. Super user or Root user
Super user or the root user is the most powerful user. He is the administrator user.
2. System users
System users are the users created by the software or applications. For example if we
install Apache it will create a user apache. This kind of users are known as system users.
3. Normal Users
Normal users are the users created by root user. They are normal users like Mohammad,
Ali, etc. Only the root user has the permission to create or remove a user.
2.6 User Administration

2  In Linux systems every user will have a unique user ID. It is known as UID.
 The Range of UIDs will be as follows:

1. Root user UID will be "0"


2. Systems users UID will be "1 - 499"
3. Normal users UID will be "500 - 60000"
2.6 User Administration
3  There are three important files a user administrator should be aware of.
1. "/etc/passwd"
2. "/etc/shadow"
3. "/etc/group"
Each of the above mentioned files have specific formats.

1. "/etc/passwd“

 The first line will be like this.


 root:x:0:0:root:/root:/bin/bash
 There are seven fields in it with each separated by ":"
 Fields are as follows:
User_name:Pointer_to_Shadow_file:UID:Comment:GID:Home_Directory:Login_shell
2.6 User Administration
2. "/etc/shadow"
 Shadow file contains the user's encrypted password and password aging options.
 The first line will be like this
root:$1fdsfsgsdfsdkffefje:14757:0:99999:7:::
The fields are as follows,
 1. User_name
 2. Encrypted password
 3. Days since that password was last changed.
 4. Days after which password must be changed.
 5. Days before password is to expire that user is warned.
 6. Days after the password is expires that the user is disabled.
 7. Days since the account is disabled.
 8. A reserved field.
2.6 User Administration

3. "/etc/group"
Contains information about groups in the system.

 The first line will be like this


root:x:0:root
 The fields are as follows.
1. Group_name, the name of the group
2. The encrypted group password
3. GID, Group ID
4. User_list, all the group member's user names. Separated by commas.
2.6 User Administration

4  How to Create User?


 In linux a user can be created with specific UID, GID, comment, Home directory and
login shell. The options are as follows.

#adduser or #useradd
 A command to add a user with all the fields we mentioned before is as follows.
#useradd -u UID -g GID/Group_name -c COMMENT -d Home_dir -s LOGIN SHELL User_name

An example:
#useradd -u 555 -g linuxg -c Teamlead -d /teamleads/azeem -s /bin/ksh azeem
Prior to the executing of the above command you should create the group 'linuxg'.
 You can also add -p for password and -G for secondary groups. If u want to add the
password, u 've to give the password in encrypted form.

For example,
#useradd -p encrypted_password Azepasswd
2.6 User Administration

4  How to create a group?

There are two kinds of users in linux. They are:


1. Primary group
2. Secondary group

When we create a user a group also will be created in the same name of the user.
But what if the user needs access to the directories created by other groups? or a user
has to supervise a number of groups? then comes the secondary group concept.
All the other groups are added as the secondary groups of that user.

The command to add a group is


 #groupadd
eg:
2.6 User Administration
#groupadd group_name
#groupadd -g 540 linux
Suppose we want to create a user qamar with linux, java, hp, ibm as secondary groups, it
can be done as follows:
#useradd -G linux,java,hp,ibm qamar
You have to specify all the secondary groups in single command, not one after one in
different commands.
But you can appended the secondary groups to a user using the -a option with usermod
command.
For example,
A user qamar is a member of groups linux and java. We can append the group ibm to him as
follows.
#usermod -a -G ibm qamar
Checking the groups of a user
#groups username
Will list all groups that the user belongs to.
2.6 User Administration
5  Switching users
1. #su Switches to root user. But only gets privileges.
2. #su - Switches to root user. Gets privileges and home directory access.
e.g. # su qamar Switches to user qamar with its privileges.
6  Modifying existing users
#usermod e.g.
#usermod -u 555 -g linux -c Teamlead -d /teamleads/qamar -s /bin/ksh qamar
Changing the login name of a user using the option -l
#usermod -l new_name old_name
7  Locking and unlocking the users
#usermod -L username
#usermod -U username
8  Removing a user
#userdel user_name will remove the user but not his home directory
#userdel -r user_name will remove the user as well as user's home directory.
File and Directory
Concept
2.7 File and Directory Concept
 General:
A simple description of the UNIX/Linux system, is this:
"On a LINUX system, everything is a file; if something is not a file, it is a process."
 Difference btw Services and Process?
 Types Of Files:
Most files are just files, called regular files; they contain normal data, e.g. text files,
executable files or programs, input for or output from a program and so on.
• Directories: files that are lists of other files.
• Links: a system to make a file or directory visible in multiple parts of the system's file tree.
• (Domain) sockets: a special file type, similar to TCP/IP sockets, providing inter-process
networking protected by the file system's access control.
• Named pipes: act more or less like sockets and form a way for processes to communicate
with each other, without using network socket semantics.
 # ls –l
-l specifies FileTypes
2.7 File and Directory Concept
Partition Layouts and Types
 There are two kinds of major partitions on a Linux system:
• data partition: normal Linux system data, including the root partition containing all the
data to start up and run the system;
• swap partition: expansion of the computer's physical memory, extra memory on hard disk.
 Partition Formatting:
Fat, Fat32, NTFS
Extfat, ext4, swap, etc

 # fdisk –l
 **Another Way of recognizing Partition is Directory which have Lost+Foud Directory
2.7 File and Directory Concept
Partition Layouts and Types
 There are two kinds of major partitions on a Linux system:
• data partition: normal Linux system data, including the root partition containing all the
data to start up and run the system;
• swap partition: expansion of the computer's physical memory, extra memory on hard disk.
 Partition Formatting:
Fat, Fat32, NTFS
Extfat, ext4, swap, etc

 # fdisk –l
 **Another Way of recognizing Partition is Directory which have Lost+Found Directory
2.7 File and Directory Concept
Linux file system layout
2.7 File and Directory Concept
Linux file system layout (Details)

Adjusting PATHS
# cd /
# cd ..
# cd ../
# cd ../etc
File
Security
2.8 File Security

 #ls –l file_name
USERs Public
Output of File Permissions would be alike:
- rw- rw- r--
- --- --- ---
File OR Dir
Groups

- rwx rwx rwx


Code So, if we want to set/modify any file’s permissions :
Meaning
0 or - #chmod 000 filename
The Access right that is supposed to be on this place is not granted
4 or r Read Access is granted
- rwx rwx rwx
2 or
- w4+2+1 4+2+1
Write 4+2+1
Access is=granted
777
1 or x Execute Permissions
#chmod 777 file_nameare granted
Services And Processes
Management
2.9 Services And Processes Management

 # ps –aux | more
 #netstat –lp | more
 #ps –aux | grep rpc*
 #kill -9 PID
>>To Start stop etc with Services:
 # Service service_name start/stop/restart/status
>>System Utilizations;
 #top
Basic Networking
And
File Sharing
2.10 Basic Networking And File Sharing
Terms:
 10-> 100 mbps eth0 or en01
 1000 mbps an0
 Wireless wlan0
 Modem(P->PP) ppp0
 Virtual Bridge Virbr0
 Loopback l0
Ip Obtain (Dynamic/Static):
Statically: #ipconfig en01 192.168.0.1 255.255.255.0 up
Or #ipconfig en01 192.168.0.1/24 up
Dynamically: #dhclient en01
For File Sharing:
We use SAMBA.rpm tool to share resources from linux , and it enables to provide client-
server connection between windows and Linux.
Basic Networking
And
File Sharing
2.11 Software Installation
For offline Repositories:
List All Programs installed
 #rpm –qa
 #rpm –qa | more
 #rpm –qa | grep –i name* e.g setup
Install software.RPM
 #rpm –ivh Package_Fullname.rpm
Check Installation
 #rpm –q package_name
Uninstalling Programs:
 #rpm –e package_name
For Online Repositories of REDHAT
 Yum install packages_name
Boot Process
Of Linux
2.12 Boot Process

 POST (Power On Self Test)


 BIOS (Basic I/O System)
 Boot Loader Phase e.g GRUB
 Kernel Starting Phase
 Hardware Sufficiency
 Hardware Compatibility
 Init Phase (Run Level) services up
End…

You might also like