System Administration NAME _________________________ Unix Lab Spring 2006 HW4 - 30 points (due 2 week) Type up the answers neatly and be clear. Boldface the answers so that they stand out. Space things out neatly. In your lab, you already installed a Unix server, using Redhat Linux, on your pc. After the install, you will sign on to the system and test some commands and look at some files. You will also test shutting down and rebooting the system. Work on this lab alone or with a partner..but learn! (this will not be done as a class...you will work on your own) When typing in commands, you also need to be exact. Unix is case sensitive. Spacing matters. Syntax is EXACT ! If you are unsure of a command or its syntax/options, see the man pages (online manual). [To quit out of the man pages, use "q". To scroll thru the man pages, hit the return key or spacebar.] For many of the below questions, you will need to open up a "terminal" window to type in commands. That can be found under: Start Button (Red Hat lower left) --> System Tools --> Terminal or Right Click on the background and pick "New Terminal" Also, if you need to edit the file, your best bet is to use "emacs filename" at the terminal prompt. This will bring up the emacs editor, in a gui mode. Easy to use. --------------------------------------------------------------- In this assignment, we will have a general overview of many system admin tasks and tools/commands....from a linux perspective. 1. Lets start off with a general review of what the system interface looks like under Red Hat Linux 9.0. Log into your system as root. Notice on the screen, there are 3 icons in the upper left. a. What are they? And what are they used for? There is also a task bar at the bottom of the screen. On the lower right is the date/time and also a red circle with an ! in it. If you click on this, your system would attempt to go out to the internet and download any patches/security fixes from Redhat. This is like "windows update" in the windows world. Also on the taskbar, from left to right, you see: red hat - which is the start button and brings up the main menu of applications/software world icon - brings up web browser (mozilla) letter icon - email package next some icons for office products (word processor, power point type of software, and spreadsheet) Finally a printer icon (we have no printers) And last an icon made up of 4 screens. Linux allows you to have multiple screens/desktops, and you can jump between them by clicking on this icon. Try it out. note- linux is freeware and the software it makes available is what they call open source (free). Note- another useful tool, is to "right click" on the backgroup, and this will pop up a menu of items. You can select "new terminal" which will open up a terminal window. This is what you will use to type in unix commands at the command prompt. Very very useful and you will using this alot! This gives you access to the command line method of administering a unix system (typing in commands). But there are also many gui tools that will be useful to us..that you will see under the Red Hat button (start button - lower left). Now.. Click on the Red Hat (start button). This will open up a menu. Some of the key items listed are: accessories - calculators, dictionary, text editor, etc.. games - (ooops..never mind) internet - email and web browsers ** preferences- system preferences ** system settings - like control panel, includes server settings, date/time, add/remove programs, network, security level, users and groups (account management), etc.. ** system tools - gui tools, disk management, network management, system monitor, systems logs, etc.. help info home folder -your home directory run program (like windows) lock screen logout - you can logout, shutdown system, reboot, etc.. Please look around and become familiar with the above. Take your time. The asterisk-ed items above are key and give access to various system admin gui tools we will be using in the labs. That and the Terminal Window (command line) are the main way we will use system admin tools/commands. b. What happens when you pick red hat--> system tools --> Terminal? What happens when you right click on background and pick from the menu "New Terminal"? Are these the same? (as with windows, in unix, there is often many ways to get to the same application or to do the same thing) c. If you pick "red hat" --> system settings --> Root Password What does this allow you to do? (dont change anything) ---------------------------------------------------------------- Next... Answer the following questions: 2. System Admins are concerned about hard disk space, partitions, formatting, etc... During the initial install, what partitions did you setup and what size were they (in MB)? (you can refresh your memory using the "df" command on the terminal windows..thats the disk free command....or look on your lab install paper) 3. What is LILO? What is GRUB? What are they used for? Which did you use during the install? 4. Networking is also a key element for a system admin, since most servers and clients sit on a network. What type of network information did you have to enter during the initial install? (name the data fields and give the values entered) 5. Account Management is another key duty for system admins. there are 3 main files involved with this.. Sign on to the system and take a look at the files /etc/passwd, /etc/shadow and /etc/group (type more /etc/passwd for example, at the unix prompt in the terminal window) [note - with the more command, you will see one page at a time of a file. To see more lines, hit the return key (next line) or space bar (next page). To break out of this, type control-c.] What is the contents of each file (list the first 3 lines)? If you cant see the contents of a file, or the file does not exist, state that. What are these files used for? Also check out the file's permissions (ls -l). What are the permissions, owner and group on each of the above files? What do these permissions mean? Be clear...clearly state what the permissions are and what do they mean, who is the owner and what is the group name (you can list what is shown on the screen, when using the ls -l commands, but also write what each field means in reference to this). (ie. ls -l /etc/passwd ls -l /etc/shadow ls -l /etc/group ) Does this explain why you couldn't see the contents of one of the files? 6. One must also know how to bring a system up and shut it down properly. Test shutting down and starting up the system, by using the commands: (try this out in a terminal window) halt shutdown now shutdown -r now reboot What do all the commands do...how do they differ ? 7. try "echo $PATH". What does this display? What is it? Does windows have the same sort of thing? 8. On the bottom left of the screen, is the main menu/start button (red hat icon). If you click on it and pick "log off", what 3 choices do you have? (that should remind you of windows) 9. processes/daemons. try "man ps" and "man kill" what info does it show you? What do these commands do? Read and learn. System admins also have to know what standard systems jobs are running and how to monitor them and delete them when needed. Do a "ps -ax | more" , you should see some of the following daemons (jobs) running on your system : init (first process always running, spawns all other processes) xinetd (super daemon) syslogd crond lpd sendmail nfsd httpd named Describe what each of the above daemons is used for (what do they do)? (you will find this info also in the book and discussed in class) Was all of the above running on your system, if not, which wasn't...? What is the PID (what does it stand for)? Next, do a regular "ps" command to see just your own jobs/processes on the system. See what PID number is associated with your current login shell (bash). Kill your current shell/job using the command "kill -9 PID#" . What happens? What is normally job number 1 (pid 1)? 10. memory and swap space. A system admin has also be concerned about RAM and virtual memory (swap). Unix uses a separate partition on the hard drive for swap space. The "free" or "free -t" command shows you info on your current swap space and usage, and ram info. What is your total amount of ram (memory)? How much is in use? How much is free? What is your total amount of swap space? How much is in use? How much is free? 11. cron System admins also need to be able to schedule jobs to be run at specific times..like backup jobs, payroll programs, etc.. Linux keeps all of its cron table info, in a single configuration file called /etc/crontab . Check the current date/time ("date"). edit /etc/crontab (you can edit it using "emacs /etc/crontab") Be very careful when editing system files..YOU NEED TO BE EXACT. If not sure..ask! Add a line to the bottom of the file, which will reboot the system in 3 minutes. (have the line call /sbin/reboot) your 1 line entry should look something like: 30 18 * * * root /sbin/reboot The above mean 6:30 pm..(18 is military time for 6pm). Use whatever time is 3 minutes from now. root is who is running this job, and /sbin/reboot is the command to run at the given date/time. Type the above single line in EXACTLY. Dont add an extra blank line to the end of the file. Dont even put an extra space at the end of the file!! Save the file. Wait three minutes, and your system should reboot. This shows that you can run jobs/commands, on a scheduled basis, via cron. This can be very handy for running things like tape backups. Q. What was the exact entry did you add to /etc/crontab? Q. Did it work (reboot)? 12. Look at the output of the "df" command and also the contents of the /etc/fstab file ("more /etc/fstab"). They both should be similar. df shows what is the current disk free space for any currently mounted partitions. And /etc/fstab should have the list of partitions that are automatically mounted when the system first boots up. Look at the "mount" command. That should also show what is currently mounted on the system. All 3 should show you similar info, in a different format. /etc/fstab is read by the system on boot-up to determine what partitions to mount up and how. The "mount" command shows you the results of the above after the system is booted up. The "df" command is more geared to seeing free space on your hard drives/partitions. Q. What partitions did you setup during the install (you will see them via df) and what is their current overall size and capacity filled? (use "df -m" which shows sizes in meg, instead of k...easier to read) Q. what partitions are listed with the "mount" command but not with the "df" command? Q. Show the first 3 lines of /etc/fstab Read "man fstab" to get info on the /etc/fstab file. The man pages are useful to not only learn about commands, but also system files. 13. System Admins often have to monitor the performance of their server. One tool to do that in unix is the "top" command. top - type in the following command "top" in the command window. What does it do? What info does it show? Control-d to get out of it. 14. Running an email server and/or print server, are two specific services that a unix server can run, and needs to be monitored by the system admin. Both services have a distinct spool area on the server: check out /var/spool/lpd and /var/spool/mail : cd /var/spool ls -l cd /var/spool/lpd ls -l cd /var/spool/mail ls -l Q. Is anything in these areas? Q. What is /var/spool/lpd used for ? Q. What is /var/spool/mail used for ? 15. As we stated earlier, system admins often need to monitor system jobs (processes). The manual way to do that is by using the "ps" command, and "kill" command to stop jobs. That was described above. There is also a gui method under linux. Start up: Start (red hat) --> system tools --> system monitor Under the Process Listing Tab: (this shows all jobs/processes/tasks (whatever you call them) running on your system) Look for the crond job. Who is the owner of this job? What % of CPU is this job taking up? What is its PID (ID) number? Next look up the "init" job (daemon). Who is the owner of this job? What % of CPU is this job taking up? What is its PID (ID) number? How would you kill a process (job/daemon)? Next, start up the calculator under accessories (under red hat). Do you see "gnome-calculator" now listed in your process listing (you should)? Highlight it and click on "End Process". What happens? Next go to the System Monitor Tab: What things can you monitor? What does this whole gui tool (system monitor) remind you of in windows? ---------------------------------------------------------------