Vous êtes sur la page 1sur 34

Introduction to Linux

What is Linux?

 Version of UNIX
 Linus Torvalds – Creator of Linux
 Open Source Operating System
 Free Software
 Source Code Available
 A Multi-user, Multitasking, Multiprocessor OS
 Fully-networked 32/64-Bit Unix-like Operating System
 Coexists with other Operating Systems
 GUI – KDE ,GNOME

Reference: http://en.wikipedia.org/wiki/History_of_Unix
What is Unix?
 Initially, Named as “UNiplexed Information Computing System
(UNICS)”

 Changed the name to “UNIX”

 Developed in 1969 at AT&T’s Bell Labs by


 Ken Thompson - UNIX

 Dennis Ritchie - C Language

 Douglas Mcllroy - Pipes

 A multi-tasking and multi-user Operating System


 You can have many users logged into a system simultaneously, each
running many programs.

 00:00:00 Hours, Jan 1, 1970 is time zero for UNIX. It is also called as
epoch.
Reference: http://en.wikipedia.org/wiki/History_of_Unix
What is Linux?
 A clone of UNIX, Developed in 1991 by Linus Torvalds, a
Finnish graduate student (It was his personal project)

 Inspired by and replacement of “Minix (Mini Unix by


Tanenbaum for education)”

 Linus + Minix  Linux

 First kernel (v1.0) was released in 1994 (Under GNU general


public license)

 Consist of

 Linux Kernel

 GNU (GNU is Not Unix) Software

 Software Package management & Others


Linux is everywhere
 Originally developed for X86-32
Bit

 Internet was built around UNIX

 Android & MAC OS are


developed based on Linux
kernel

 Ported to other architectures.

 IBM PowerPC

 Mobile Phones -Nokia


N810, Google Nexus
(Ubuntu), etc.

 Routers, GPS
Linux is everywhere
Check www.top500.org to know the power of Linux (June-2015 List)
Why Linux is everywhere?
 Open, Free or Cheap

 Scalable and Portable


 Scalable – In terms of processor count, Number of users, Memory size,
I/O, Resource management etc..

 Portable – It can work efficiently on anything from wristwatch to World’s


fastest Supercomputer

 Multiuser and multitasking

 Robust – A cluster or a Server can run for years without


rebooting  Reliable
Linux Distributions
 600+ Linux Distributions
 RHEL (Commercial Support)

 Fedora (Free, Majorly used for Desktop)

 Ubuntu (Free, Majorly used for Desktop, From South Africa)

 Slackware (One of the oldest, simple and stable)

 CentOS (free RHEL, From England)

 SuSe (Free and Commercial, From Germany)

 Knoppix (first LiveCD distribution)


Which Linux Distribution…?
 Depends on user requirements
1. Slackware

2. Ubuntu

3. Fedora

4. RHEL

5. CentOS
Open source and Free software

 Open Source : a program in which source code is


available to general public for use and/or modification
from its original design free of charge, .i.e .open.

 Free software: A program is free to use but its source


code need not be available in public.

 FOSS : Free Open Source Software

17-02-2016 Centre For Development of 10


GNU project
 Established in 1984 by Richard Stallman
 GNU is a recursive acronym for “GNU's Not Unix”

 Unix like OS developed with fully free software

 Uses GNU Hurd kernel

 No stable release yet

 Non GNU kernel can be used with the GNU software's

 Gcc, glibc,GNOME GDB,etc.....


GNU GPL

 GPL was written by Stallman in 1989

 GPL is the license of 60-70% free projects

 GPLs
 GPLv1: 1989
 Source code should be published with binary
 Modified version of program is GPLv1 license
 GPLv2: 1991
 GPLv3: 2007
GNU GPL

• GNU GPL aim is,


– To run the program for any propose
– To study and modify
– To copy & redistribute the program
– To improve
– If you sell the software to someone, he can also sell it
GNU/Linux

 The Linux provides the Kernel

 GNU provides
 Lot of tools, applications, libraries, …
 Some License

 Combining Kernel and GNU tools – GNU/LINUX - LINUX –


Distribution

 Now you are using the GNU/Linux

 Today GNU/Linux is maintained by free software foundation(FOSS)


Distribution/GNU Linux

 Linux Distribution
 Combination of Linux Kernel, GNU Tools, Other tools and
management tools

 Now more than 250 distributions


 Major distributions: Fedora, SuSe, Ubuntu, …

 What is the difference between distribution?


 Linux Kernel Version
 Pre-compiled applications
 Management tools
Now, GNU/Linux
 More than 3 major desktops
 GNOME, KDE, Xfce
 More than 5 major shells
 Bash, csh, tsh, …
 Complete set of compilers
 C, C++, java, Fortran, Python, Ada, …
 Many network services
 Web, Email, File Sharing, DNS, FTP, SSH, …
 Many user applications
 OpenOffice, Web browser, Latex, multimedia, …
GNU/Linux’s Advantages

• Stability
– It is very rarely to see the Kernel Panic

• Free Software
– There is no any charge for software

• Support Wide Range of Hardware


• Security
– Open source  There is not any backdoor
– Quick bug fixing
GNU/Linux’s Disadvantages
• Leaning Curve
– Linux is NOT for dummies

• Applications
– Some applications have NOT equivalent in Linux

• Official Support
– Companies need official support
– No one is responsible for most Linux applications
Linux Operations as a server

DNS
DHCP
Web server
Application server
NTP
NFS
NIS
Database server
FTP Server
UNIX/Linux Structure
Linux File System
Details of File System

/  root directory
/boot  files for booting system
/etc  configuration files
/bin  important system binaries
/sbin  contains system admin programs(super user)
/usr  user applications
/lib  dynamic libraries
/home  user home directories
/root  super user home dir
/var  contains variable data constantly generated when
system is running
/dev  device files
Linux boot process
Bootstrapping (simplified version)

BIOS Boot Loader Kernel Initialization

init

Runs scripts from Spawns Spawns


/etc/rc[0-6].d/ getty processes Xdm/gdm processes

login login
BIOS

 Basic Input/Output System


 Contains information about the machine’s
configuration. Eg. IDE controller, NIC
 PC knows which device to boot from via BIOS
 PC tries to run code from the MBR, ie. 1st 512 bytes,
of the disk
 MBR tells the PC to load the boot loader from
certain disk partition
 The boot loader loads the kernel
Boot Loaders - LILO
 Traditional and stable
 /etc/lilo.conf
 boot=/dev/hda

 root=/dev/hda1

 timeout=5

 image=/boot/vmlinuz-2.6.20

 label=Linux
 read-only
 other=/dev/hdb1
 label=Windows
 table=/dev/hdb
 To install it
 $ lilo

 lilo must be run after every reconfiguration


Boot Loaders – GRUB

 GRand Unified Boot loader


 Default on Red Hat and SuSe
 Read configuration file at boot time
 Understand filesystems and kernel executable formats
 ie. Only need to know the device, disk partition and
kernel filename
 GRUB device (hd0,0) → /dev/hda1 or /dev/sda1
 To install GRUB (for the very first time)
 $ grub-install ‘(hd0,0)’

 Edit /boot/grub/grub.conf
Boot Loaders – GRUB (cont)

 /boot/grub/grub.conf
 default=0

 timeout=5

 splashimage=(hd0,0)/boot/grub/splash.xpm.gz

 title CentOS (2.6.18-8.el5)

root (hd0,0)
kernel /boot/vmlinuz-2.6.18-8.el5 ro root=LABEL=/
initrd /boot/initrd-2.6.18-8.el5.img
 title Windows

rootnoverify (hd1,0)
chainloader +1
Kernel Initialization

 A program itself
 /vmlinuz or /boot/vmlinuz
 Two-stage loading process
 initrd (init RAM disk)
 A transient root filesystem in RAM before a real root filesystem
is available
 Eg. It is used to install file system modules into the kernel
 The real root filesystem
 Device detection and configuration
 You tell the kernel what to expect
 The kernel probes the H/W itself
 Kernel threads creation
 Eg. init (a user process)
Startup/Init Scripts

 After Kernel initialization, a process called init


is created with PID 1
 init runs startup scripts (normal shell scripts)
to perform specific tasks, eg.
 Setting the hostname, time zone, etc
 Checking and mouting the disks
 Configuring network interfaces
 Starting up daemons and network services
Startup/Init Scripts (cont)

 Startup scripts (rc files) are run based on run levels


 0 the level in which the system is completely shut down
 1 single-user mode
 2 multiuser mode w/out NFS
 3 full multiuser mode
 4 unused
 5 X11
 6 reboot level
 Starts with run level 0 to the default run level (usually 3)
 /etc/inittab tells init what to do at each level
 To find out which run level the system is current in
 $ runlevel
Startup/Init Scripts (cont)

 init runs the scripts from /etc/rc.d/rc[0-6].d/


 /etc/rc.d/rc0/K25sshd → /etc/init.d/sshd
 /etc/rc.d/rc3/S55sshd → /etc/init.d/sshd
 Each server/daemon provides a master script
 Stored in /etc/init.d
 Understands the arguments: start, stop, restart
 /etc/init.d/sshd start
 run level 0 → 3
 /etc/rc.d/rc3/S* start
 run level 3 → 0
 /etc/rc.d/rc0/K* stop
Reboot & Shutdown

 To reboot
 $ shutdown -r now
 $ reboot
 $ init 6
 To halt
 $ shutdown -h now
 $ halt
 $ init 0
 $ poweroff
Reboot & Shutdown (cont)

 To shutdown gracefully
 $ shutdown -h +15
“Shutdown in 15 mins”

Vous aimerez peut-être aussi