Linux basics 1/2


Published on

Linux Basics tutorial 1 / 2

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Linux basics 1/2

  1. 1. Linux Basics - 1/2 Jul 2013 Saturday, July 27, 13
  2. 2. Linux Is a Unix-like operating system (OS) created by Linus Torvalds. He developed Linux because he wasn't happy with the currently available options in Unix and felt he could improve it. So he did what anybody else would do, and created his own operating system. Saturday, July 27, 13
  3. 3. Linux When Linus finished building a working version of Linux, he freely distributed the OS, which helped it gain popularity.Today, Linux is used by millions of people around the world. Many computer hobbyists (a.k.a. nerds) like the operating system because it is highly customizable. Programmers can even modify the source code and create their own unique version of the Linux operating system. Saturday, July 27, 13
  4. 4. Kernel In computing, the kernel is a computer program that manages input/output requests from software, and translates them into data processing instructions for the central processing unit and other electronic components of a computer.The kernel is a fundamental part of a modern computer's operating system. Saturday, July 27, 13
  5. 5. Linux Kernel The Linux kernel is the operating system kernel used by the Linux family of Unix-like operating systems. It is a prominent example of free and open source software. The Linux kernel is released under the GNU General Public License version 2 (GPLv2)(plus some firmware images with various non-free licenses), and is developed by contributors worldwide. 3.10.3 stable version Saturday, July 27, 13
  6. 6. Linux Distros A Linux distribution (often called distro for short) is a member of the family of Unix-like operating systems built on top of the Linux kernel. Such distributions are operating systems including a large collection of software applications such as word processors, spreadsheets, media players, and database applications. Saturday, July 27, 13
  7. 7. Linux Distros Popular main distros • Debian • RedHat • Suse • Gentoo • Slackware* Saturday, July 27, 13
  8. 8. Linux Distros Popular child distros • Ubuntu (Debian based) • Fedora (RedHat) • Centos (RedHat) Saturday, July 27, 13
  9. 9. Which Distro? It depends on • Software requirements • Team or staff knowledge • The one that makes you happy Saturday, July 27, 13
  10. 10. Uses • Desktop • Phones • Tablets • TV’s • Servers Saturday, July 27, 13
  11. 11. How it works? 1. System startup - BIOS / BootMonitor 2. Stage #1 bootloader (master boot record) 3. Stage #2 bootloader (LILO GRUB) 4. Kernel 5. Init 6. Runlevel Saturday, July 27, 13
  12. 12. How it works? 1. BIOS • BIOS stands for Basic Input/Output System • Performs some system integrity checks • Searches, loads, and executes the boot loader program. • It looks for boot loader in floppy, cd-rom, or hard drive.You can press a key (typically F12 of F2, but it depends on your system) during the BIOS startup to change the boot sequence. • Once the boot loader program is detected and loaded into the memory, BIOS gives the control to it. • So, in simple terms BIOS loads and executes the MBR boot loader Saturday, July 27, 13
  13. 13. How it works? 2. MBR • MBR stands for Master Boot Record. • It is located in the 1st sector of the bootable disk.Typically / dev/hda, or /dev/sda • MBR is less than 512 bytes in size.This has three components 1) primary boot loader info in 1st 446 bytes 2) partition table info in next 64 bytes 3) mbr validation check in last 2 bytes. • It contains information about GRUB (or LILO in old systems). • So, in simple terms MBR loads and executes the GRUB boot loader. Saturday, July 27, 13
  14. 14. How it works? 3. GRUB • GRUB stands for Grand Unified Bootloader. • If you have multiple kernel images installed on your system, you can choose which one to be executed. • GRUB displays a splash screen, waits for few seconds, if you don’t enter anything, it loads the default kernel image as specified in the grub configuration file. • GRUB has the knowledge of the filesystem (the older Linux loader LILO didn’t understand filesystem). • Grub configuration file is /boot/grub/grub.conf (/etc/grub.conf is a link to this). • So, in simple terms GRUB just loads and executes Kernel and initrd images. Saturday, July 27, 13
  15. 15. How it works? 4. Kernel • Mounts the root file system as specified in the “root=” in grub.conf • Kernel executes the /sbin/init program • Since init was the 1st program to be executed by Linux Kernel, it has the process id (PID) of 1. Do a ‘ps -ef | grep init’ and check the pid. • initrd stands for Initial RAM Disk. • initrd is used by kernel as temporary root file system until kernel is booted and the real root file system is mounted. It also contains necessary drivers compiled inside, which helps it to access the hard drive partitions, and other hardware. Saturday, July 27, 13
  16. 16. How it works? 5. Init • Looks at the /etc/inittab file to decide the Linux run level. • Following are the available run levels • 0 – halt • 1 – Single user mode • 2 – Multiuser, without NFS • 3 – Full multiuser mode • 4 – unused • 5 – X11 • 6 – reboot • Init identifies the default initlevel from /etc/inittab and uses that to load all appropriate program. • Execute ‘grep initdefault /etc/inittab’ on your system to identify the default run level • If you want to get into trouble, you can set the default run level to 0 or 6. Since you know what 0 and 6 means, probably you might not do that. • Typically you would set the default run level to either 3 or 5. Saturday, July 27, 13
  17. 17. How it works? 6. Runlevel • When the Linux system is booting up, you might see various services getting started. For example, it might say “starting sendmail …. OK”.Those are the runlevel programs, executed from the run level directory as defined by your run level. • Depending on your default init level setting, the system will execute the programs from one of the following directories. • Run level 0 – /etc/rc.d/rc0.d/ • Run level 1 – /etc/rc.d/rc1.d/ • Run level 2 – /etc/rc.d/rc2.d/ • Run level 3 – /etc/rc.d/rc3.d/ • Run level 4 – /etc/rc.d/rc4.d/ • Run level 5 – /etc/rc.d/rc5.d/ • Run level 6 – /etc/rc.d/rc6.d/ Saturday, July 27, 13
  18. 18. How it works? 6. Runlevel • Please note that there are also symbolic links available for these directory under /etc directly. So, /etc/rc0.d is linked to /etc/rc.d/ rc0.d. • Under the /etc/rc.d/rc*.d/ directories, you would see programs that start with S and K. • Programs starts with S are used during startup. S for startup. • Programs starts with K are used during shutdown. K for kill. • There are numbers right next to S and K in the program names. Those are the sequence number in which the programs should be started or killed. • For example, S12syslog is to start the syslog deamon, which has the sequence number of 12. S80sendmail is to start the sendmail daemon, which has the sequence number of 80. So, syslog program will be started before sendmail. Saturday, July 27, 13
  19. 19. How it works? Saturday, July 27, 13
  20. 20. Installation Methods • CD or DVD • Normal • Live • USB installer • Network installation • Virtual installation (iso file) Saturday, July 27, 13
  21. 21. System Requirements Desktop • 700Mhz processor • 512Mb RAM • 5Gb hard-drive space • VGA 1024x768 • CD/DVD or USB port for installer media • Internet access (not required but helpful) Saturday, July 27, 13
  22. 22. System Requirements Server CLI • 300Mhz processor • 128Mb RAM • 1Gb hard-drive space • VGA 640x480 • CD Saturday, July 27, 13
  23. 23. Workshop 1. Internet access required. 2. Create a new virtual machine on Oracle VirtualBox with the following settings. 1. 512Mb RAM 2. 5Gb hard disk 3. Use debian iso image 3. Star the virtual machine Saturday, July 27, 13
  24. 24. Workshop 4. Choose the installation language 5. Choose the country or territory 6. Choose the locale settings 7. Choose the keymap to use 8. Type the hostname (linux-#x) 9. Type the domain name Saturday, July 27, 13
  25. 25. Workshop 10.Type the root password (twice) 11.Create a new user • Name, username and password 12.Choose the timezone 13.Chose the partition method (Guided - entire disk) 14.Select the hard disk to use Saturday, July 27, 13
  26. 26. Workshop 15.Select partition scheme (all files in one partition) 16.Finish partitioning 17.Write changes to disk 18.Choose debian mirror (Mexico) 19.Choose archive mirror ( 20.Use proxy? No 21. Saturday, July 27, 13
  27. 27. Installation facts • Language? • Locale settings? • Territory? • Hostname and domainame? • Root user? • Hard disk to use? • Partition scheme? • Mirror? • Packages? Saturday, July 27, 13
  28. 28. root or superuser In computing, the superuser is a special user account used for system administration. Depending on the operating system, the actual name of this account might be: root, administrator, admin or supervisor. In some cases the actual name is not significant, rather an authorization flag in the user's profile determines if administrative functions can be performed. In operating systems which have the concept of a superuser, it is generally recommended that most application work be done using an ordinary account which does not have the ability to make system-wide changes. Saturday, July 27, 13
  29. 29. hostname A hostname is a label that is assigned to a device connected to a computer network and that is used to identify the device in various forms of electronic communication such as the World Wide Web, e- mail or Usenet. Hostnames may be simple names consisting of a single word or phrase. Saturday, July 27, 13
  30. 30. domainame A domain name is an identification string that defines a realm of administrative autonomy, authority, or control on the Internet. Domain names are formed by the rules and procedures of the Domain Name System (DNS). Saturday, July 27, 13
  31. 31. Hard disk • Linux identified the hard disk with a OS resource.Typically this are the resources. • IDE • SCCI Saturday, July 27, 13
  32. 32. Partitions Partitions are divisions in the formatting of the hard disk.  It’s a logical – as opposed to a physical – division, so you can edit and manipulate them for various purposes.  Think breaking a disk into two configuration parts.  Partitions are really handy because they act as a sandbox. f you have a 1 TB hard drive partitioned into a 250 GB partition and a 750 GB partition, what you have on the latter will not affect the other, and vice versa. You can share one of those partitions on the network and never worry about people accessing information on the other. Saturday, July 27, 13
  33. 33. Partition Schemes It depends on the using of the SO and the size of the hard disk • Desktop • All files in one partition • Server • Split the data in multiple partitions Saturday, July 27, 13
  34. 34. Partition Schemes Server partition scheme Saturday, July 27, 13
  35. 35. Partition types • Foreign partitions (other SO) • Primary partitions • The number of partitions on an Intel-based system was limited from the very beginning:The original partition table was installed as part of the boot sector and held space for only four partition entries.These partitions are now called primary partitions. • Logical partitions • One primary partition of a hard drive may be subpartitioned.These are logical partitions.This effectively allows us to skirt the historical four partition limitation. • Swap partitions • If you have too many processes running on a machine, the kernel will try to free up RAM by writing pages to disk.This is what swap space is for. It effectively increases the amount of memory you have available. However, disk I/O is about a hundred times slower than reading from and writing to RAM. Consider this emergency memory and not extra memory. Saturday, July 27, 13
  36. 36. Partition - File Systems / - root partition /var - This fs contains spool directories such as those for mail and printing. In addition, it contains the error log directory. If your machine is a server and develops a chronic error, those msgs can fill the partition. Server computers ought to have /var in a different partition than /. /usr - This is where most executable binaries go. In addition, the kernel source tree goes here, and much documentation. /tmp - Some programs write temporary data files here. Usually, they are quite small. However, if you run computationally intensive jobs, like science or engineering applications, hundreds of megabytes could be required for brief periods of time. In this case, keep /tmp in a different partition than /. /home - This is where users home directories go. If you do not impose quotas on your users, this ought to be in its own partition. /boot - This is where your kernel images go. See discussion above for placement on old systems. Saturday, July 27, 13