Linux Intro Linux, the do it yourself OS Linux, successor to MINIX Linux, Unix for the masses (PC users) History:
Linux Organization Central core of a Linux system is the kernel All CPU communication goes through the kernel Network devices are controlled via device drivers in the kernel The TCP/IP network protocol stack is built into the kernel
Linux Kernel Can be modified by the user Handles device drivers as needed by hardware The kernel can be built for several different types of Linux applications
Linux Devices Devices communicate with the kernel through the /dev directory Each device has a node number associated with it to point to a location in the kernel crw-rw root tty 4, 64 Nov 26 15:39 0 crw-rw root tty 4, 65 Nov 27 14:34 1 brw rootroot 8, 0 Oct 12 13:40 hda0
Linux File system Everything starts at the root (/) directory – /bin binary executables are here – /sbin system binary executables are here – /usr libraries, include files, system files are here – /tmp temporary storage – /var system logs, spool files, mail, accounting here – /lib library files – /etc system control files here – /dev devices – /proc process storage – /boot the boot files (kernel etc.) go here
Linux File system Linux always mounts and dismounts all file systems. Floppies, Zips, Cdroms, and any other random access storage is mounted before use and dismounted after use. Dismounting insures that all writes have completed and files are closed before removal of the media.
Linux Swap The swap partition is used for virtual memory and task swapping. Depending on the applications, throughput desired, and amount of RAM memory the swap space can be from 1 to 3 times the size of RAM. Swap space is unformatted disk space
Linux Basics Single boot or Dual boot? – Partitioning rules – Format (FAT32, ext2, ext3, swap) – Common disk partitions Install operating system – Decide what features you need to add such as networking, server, development, ganes
Linux Bootup The linux boot program (lilo “Linux Loader” or grub “Grand Unified Boot loader”) starts the linux system. After the kernel is loaded and the system can talk to it’s peripherals the initialization begins. The /etc/inittab file tells the system what to start up, the first is usually rc.sysinit.
Linux Bootup rc.sysinit – Starts logging – Sets the hostname – Prepares the network for startup – Checks the clock – Sets up the host computer hardware – Sets up and mounts the filesystem
Linux bootup Depending on the run level that the system is to run to, different rc files will be executed. – Run level 0 is shutdown – Run level 1 is single user – Run level 2 is multiuser, no NFS – Run level 3 is ready to use full multiuser – Run level 4 is unused at present – Run level 5 is GUI – Run level 6 is reboot
Linux Bootup You don’t have the root password? Boot the system in single user mode Select command line mode from LILIO or GRUB linux –s or linux -single
Linux bootup To keep the startup files organized, they are put into a directory /etc/rc.d/init.d Links to those programs are placed in the run level subdirectories back to init.d so changes are only needed in the init.d directory.
Linux bootup To control the sequence of startup processes, each start program is start sequentially by the numbers before the start script. – S98http (same as /etc/init.d/http start at sequence 98) At shutdown the process reverses – K98http (same as /etc/init.d/http stop at sequence 98) Init 2, init 3, init 4, and init 5 run the S##name scripts Init 0, init 1 and init 6 run the K##name scripts
Linux bootup last step Once linux boots and loads the appropriate drivers and files it executes “login”. Login provides a prompt for username, then prompts for a password. The username is stored in /etc/passwd and the password is stored in /etc/shadow. One the account is authenticated the user is given a command prompt (%)
Linux configuration Interfaces are configured using the linuxconf program (point and click) or command line programs. The default network interface is called eth0 The hardware board device drivers is selected via the linuxconf program
GUI configuration Linux uses the X window system for it’s graphical user interface GUIs are typically installed at system installation time. If the Linux box is in command line mode then the GUI can be installed with the Xconfigurator program. Linux will probe for the correct video board but may need to be told what display is being used. The GUI can be set up to start at boot time to provide a windows like login screen.
Linux Networking Linux normally will install networking with DHCP (Dynamic Host Control Protocol) enabled to receive TCP/IP configuration parameters. Linux network programs are controlled either by starting the program and placing it in the background through the /etc/xinit.d dispatcher (httpd start) for CPU intensive programs, or by calling it as needed via /etc/xinetd.conf to save memory and CPU time.
Linux Network apps Shared password file – NIS (yellow pages) allows sharing of a single password file for a group of systems NFS (Network File system) – Allows a group of systems to share a common disk farm.
Linux Network Security Linux can filter incoming and/or outgoing ip packets to control access to it’s resources. The filter programs are called ipchains or iptables depending on the flavor of linux. The tables may allow or deny certain ip addresses or ports to control access. The xinetd program can control which services are available to the network
Knoppix Knoppix is the easy way to start into Linux Knoppix boots from CD and starts a limited linux on any PC. Knoppix is free!
Linux terminal interface Linux is ready to take requests from serial interfaces as soon as it boots. The serial devices use terminal emulators to log in to the system (command line mode) Modem’s use the serial ports to access the linux box and the system can also be used as a modem pool for PPP use.
Interaction with Linux Login – username user – Password may not be needed Now what? – ls list files, ls –al list with attributes – man help files man –k search for key word in man – ps –ef processor status, what is running on the system – df disk free, what disks are there and how much is left on them
More Commands grep search files for a string paste put two files together cut pull a pattern from a file tr translate characters sort sort a file >, > file redirection | pipe (flow data between programs) grep csh /etc/passwd | sort > file.temp
Examples sort file2 cut -d, -f4 file1 paste file1 file2 > file3
Linux Intro The End Check the website for homework Remember, no class next week