1.04k likes | 1.06k Views
Peter J. Vasquez Sr. CSCI 6303.01. The UNIX OS. The UNIX OS. What is UNIX? OpenBSD Installation Introduction to VI OpenBSD Configuration Introduction to ksh ksh Scripting. What is UNIX?. Design Architecture Filesystems Brief History. UNIX Design. Modular Programming
E N D
Peter J. Vasquez Sr. CSCI 6303.01 The UNIX OS
The UNIX OS • What is UNIX? • OpenBSD Installation • Introduction to VI • OpenBSD Configuration • Introduction to ksh • ksh Scripting
What is UNIX? • Design • Architecture • Filesystems • Brief History
UNIX Design • Modular Programming • software design technique that increases the extent to which software is composed from separate parts, called modules.http://en.wikipedia.org/wiki/Modularity_(programming) • Re-Usable Code • the likelihood a segment of source code can be used again to add new functionalities with slight or no modification. http://en.wikipedia.org/wiki/Reusability
UNIX Architecture • Kernel – manages the computer's resources and controls their use by programs. • Consists of: • CPU – responsible for running or executing programs. The kernel decides which processes are allocated to the processor. • Memory – used to store instructions and data. The kernel decides what memory is available to a process, and whether nor not enough is available. • I/O – input and output devices (keyboards, mice, disk drives, etc). The kernel allocates requests to these devices from applications to perform I/O.
UNIX Architecture (cont.) • Shell - user interface to the kernel, where commands are input (whether on the command line interface or in a GUI) • Shell Examples: • Bourne Shell (and variants) • C Shell (and variants) • Blackbox, fluxbox, fvwm, GNOME, KDE, XFCE, CDE
UNIX Architecture (cont.) • System Processes (Daemons) – programs that assist the kernel with specific system tasks. • Refers to background processes • Handles tasks in the background that the user cannot be bothered with • Most daemons are child processes of another running process (usually the init process, which is the initialization shell script responsible for starting up most processes after the kernel has loaded)
UNIX Architecture (cont.) • Parent/Child Processes • Relationship of running process to other running processes. If one process initiates a new process, it is called the parent, while the new process is known as a child • New processes are spawned through a procedure called 'fork', which creates a copy of the parent along with the needed memory space and parameters to run with a task/set of instructions • Common example is the execution of shell commands, which remain interactive while child processes can be sent to the background to run
UNIX Filesystems • UFS – UNIX File System (4.2/4.4BSD) • a few block at the beginning reserved for boot blocks • a superblock containing a magic number identifying as UFS filesystem • a collection of cylinder groups, each containing the following: • backup copy of the superblock • cylinder group header with statistics • number of inodes • number of data blocks
UNIX Filesystems (cont) • <swap> - • form of virtual memory used to extend available main memory • dedicated partition, which should be at least the size of main memory • not required, but highly recommended
A Brief Overview of OpenBSD • UNICS -> UNIX TSS -> BSD -> NetBSD -> OpenBSD • Designed with Security and Simplicity as primary goals (only 2 remote holes in the default install in the past 10 years) • Major contributions to other UNIX/Linux Operating Systems include • OpenSSH : free implementation of SSH (secure shell) which provides for encrypted remote administration of UNIX/Linux systems (85% of installed systems world-wide) • pf : or packet filter (firewall) has been used in a wide range of embedded systems (for example, the syswall security appliance)
OpenBSD Installation • Obtain CD (can be purchased at openbsd.org, or ISO download from ftp.openbsd.org) • Boot up using correct version (i386 in this example) • Set up partition sizes, choose filesystem type • Set up basic system and package configuration
OpenBSD Installation (cont.) • Boot from CD
OpenBSD Installation (cont.) • Press 'i' for install
OpenBSD Installation (cont.) • Press <enter>
OpenBSD Installation (cont.) • Press <enter>
OpenBSD Installation (cont.) • Press <enter>
OpenBSD Installation (cont.) • Type 'yes' to proceed with install
OpenBSD Installation (cont.) • Press <enter>
OpenBSD Installation (cont.) • Press <enter> for default disk, or specify disk
OpenBSD Installation (cont.) • Type 'yes' to use the entire disk for OpenBSD
OpenBSD Installation (cont.) • Press <enter>
OpenBSD Installation (cont.) • Now, type '?' for help, then press <enter>
OpenBSD Installation (cont.) • Now type 'p' to see current partition map
OpenBSD Installation (cont.) • Press <enter>
OpenBSD Installation (cont.) • Create (/) root, <swap>, /tmp and /var partitions
OpenBSD Installation (cont.) • Create /usr and /home partitions
OpenBSD Installation (cont.) • Type 'p' and press <enter> to see partitions
OpenBSD Installation (cont.) • Type 'w', <enter>, 'q', <enter>, to write and exit
OpenBSD Installation (cont.) • Now begin basic system, package configuration
OpenBSD Installation (cont.) • Type hostname, networking info, press <enter>
OpenBSD Installation (cont.) • Type in root password, press <enter> for CD
OpenBSD Installation (cont.) • Type in 'all' to select all packages
OpenBSD Installation (cont.) • Press <enter>, type 'done', and press <enter>
OpenBSD Installation (cont.) • Packages begin unpacking/installing to disk
OpenBSD Installation (cont.) • Type timezone 'US/Central', type 'halt' to reboot
OpenBSD Installation (cont.) • Press <enter>, the system will now reboot
Introduction to VI • Two modes of operation • Insert mode : type in a character to modify the contents under the cursor directly • Command mode : type in a “:” followed by the command string for more advanced options • We can create files, modify their contents, and write the changes back to the disk • We can search within files for common strings • Useful in modification of the OS configuration files
Introduction to VI (cont.) • Login as new user, list contents of directory
Introduction to VI (cont.) • Type 'vi sample' for a new file named 'sample'
Introduction to VI (cont.) • Type 'I' for insert mode, type, press <esc> ': wq'
Introduction to VI (cont.) • We can open the same file to make changes
Introduction to VI (cont.) • Type 'yy' and then 'p' to copy and paste the line
Introduction to VI (cont.) • You can type 'dd' to delete the current line
Introduction to VI (cont.) • We can search/replace a word, ':%s/new/old/g'
Introduction to VI (cont.) • Now our file reads the following:
Introduction to VI (cont.) • We can undo the change by typing 'u'
Introduction to VI (cont.) • A lot of changes are available, for a complete reference you can type in 'vi reference' into a search browser, which will provide many results • The most common uses of vi are for the modification of system configuration files, and in shell programming (scripting)
OpenBSD Configuration • Default configuration is listed in /etc/rc.conf