Configuration and Administration
Jeremy Portzer, 3/19/2003
jeremyp@pobox.com
Reconfiguring Installed Options
Not sure exactly what this means, but here are some options:
redhat-config-* tools (GUI/TUI tools)
redhat-config-packages, up2date, and RPM for package management
Use "dateconfig" to set date options: timezone, whether system clock is set to UTC or not (discussion?), NTP configuration
Networking, Sound and User Authorization configuration
Networking configuration
/etc/sysconfig/network : HOSTNAME, GATEWAY
/etc/hosts & /etc/resolv.conf
/etc/sysconfig/network-scripts/ifcfg-eth0, eth1, etc:
BOOTPROTO={dhcp,static,none}
IPADDR, NETMASK, NETWORK, BROADCAST
ONBOOT={yes,no}
service network restart, ifup ethN, ifdown ethN, ifconfig -a, ifconfig ethN {up,down}
"netconfig" sets all this for you, or redhat-config-network (use the latter for wireless)
The network-scripts/ifcfg-ethN scripts take priority over /etc/sysconfig/network .
/etc/sysconfig/networking/ contains the saved information for neat (r-c-network).
Sound configuration
Don't know too much, but sndconfig for older cards, redhat-config-soundcard for newer ones. May need to fiddle with /etc/modules.conf (sndconfig should do this for you however).
User Authorization
authconfig allows you to set NIS, LDAP, hesiod by adjusting /etc/pam.d/system-auth which is referenced by other PAM modules, which are used by all login features. Doesn't deal with home directories or other things you might need for networks (see NFS, automounter, etc.) Look at file /etc/nsswitch.conf for order of lookups. The name service cache daemon (nscd) can play a role here if installed.
File Systems and /etc/fstab
May need to make adjustments so users can mount things, but generally users should have permissions based on console ownership, to mount the floppy disk. Or use mtools "mdir a:", "mcopy filename a:filename" etc, which doesn't require mounting. Floppies and windows hard drives usually use "vfat" filesystem (not fat or msdos). NTFS drives aren't really supported (read-only mode is okay but NTFS might not be in kernel). Mount command can be shortened if information is already in /etc/fstab, otherwise specify fs type, device, and mountpoint:
mount -t vfat /dev/fd0 /mnt/floppy
mount -t iso9660 /dev/hdc /mnt/cdrom
note: /dev/cdrom is usually a symlink to /dev/hdb, hdc, etc.
Always unmount before ejecting, though the "eject" command for CDROMs will do this for you ("eject /dev/cdrom" or "eject /mnt/cdrom")
/etc/mtab has a list of mounted filesystems in the same format as fstab, do not edit.
Ext3 filesystems are basically just ext2 filesystems with a hidden journal file. You can upgrade ext2 to ext3 by using "tune2fs" to create a journal and then remounting as ext3 (see man page). Be sure to always mount as ext3 from then on, though if something goes wrong it can still be used as ext2.
RPM Package Manager
Query commands
rpm -qa | grep packagename (good for pattern matches)
rpm -qi packagename (info page)
rpm -ql packagename (list files in package)
rpm -qi --changelog packagename | less
rpm -qilp packagefile.i386.rpm (or just -qlp, -qip, etc)
rpm -qa --queryformat '%{NAME}-%{VERSION}-%{RELEASE}\t{ARCH}\n' |grep i686 (handy since arch doesn't normally show)
Install/upgrade commands
rpm -Uvh packagefile.i386.rpm (also -i for install only)
rpm -Fvh *.i386.rpm Freshen -- upgrade all packages from current directory where a previously installed version exists
rpm -e packagname Erase (uninstall)
rpm -Uvh --oldpackage oldversion.i386.rpm
DO NOT IGNORE DEPENDENCIES. DO not use --nodeps, --force, etc. Instead use tools like up2date to calculate deps for you.
Misc other commands
rpm -qf /path/to/filename Lists what package owns a file
rpm -V Verify mode, see man page for meaning of output
Also there are --whatprovides, --whatrequires, etc, functions. Or install the "rpmdb-redhat" package to get the --redhatprovides functions.
redhat-config-packages -- helps you install packages from the Cds. Also you can right-click on a package in the GUI file manager to install it.
rpmbuild --rebuild packagename.src.rpm -- On a basic system you need to be root and packages will go in /usr/src/redhat/, but you really should setup a build area in your home directory. See Tanner's RPM building notes for more info.
rpm --rebuilddb -- Rebuilds your RPM database. May want to backup /var/lib/rpm
killall -9 rpm; rm /var/lib/rpm/__db.* : cleans up from nasty RHL 8 rpm bug
Printing
Use redhat-config-printer or "printconf" in older versions. In RHL 8 redhat-config-printer only configures LPRng, for CUPS you'll need to use the web interface (updated in Phoebe beta). Works in both GUI or TUI.
Remember to apply changes and restart LPD before sending test pages. Use Unix/LPD printer queues for things like Linksys print servers, and Jetdirect queues for HP laserjets with Ethernet cards. Samba printer queues rely on an already working samba configuration. If text output it stair-stepped, enable the LF to CRLF translation checkbox. Check http://www.linuxprinting.org/ for the recommended driver (filter) for your printer if you're not sure.
Print most files with "lpr" command, also try "lpr -Pqueuename" for non-default printer queues. Use "lpq" to list things in the queue, "lprm" to get rid of a stuck job.
Virtual Consoles
alt-f1 through f-6 are text consoles. F7 is first X console (if you start additional X sessions/servers, they go on F8 etc). From X use ctrl-alt-f1 to get back to 1st text console. Use the "open" command to open programs on a given console (not installed by default).
Administering User Accounts and Groups
useradd/groupadd/groupmod/usermod/gpasswd for dealing with users & groups
passwd to reset passwords, /etc/passwd, /etc/group, /etc/passwd, /etc/gshadow hold info; useful commands are: id, whoami, groups
redhat-config-users
Understand user/group/other permissions, chown, chmod
SetGID permission in conjunction with group ownership and umask 002 makes nice group file setup.
cron and anacron
/etc/cron.daily, hourly, weekly, etc; run as root with the "run-parts" wrapper
User crontab files - use "crontab -u <username> -e" to edit, or just "crontab -e"
(See "man 5 crontab" for the format)
Output normally goes to the user, or to root. Be sure to check root's mailbox or make it forward somewhere. (I recommend "pine" for quick checking of local mailboxes but it's not installed by default.)
Anacron automatically runs cronjobs that are missed when a computer was off. It delays things so that everything doesn't happen at once. For example the nightly "updatedb" job (updates the database for the "locate" command) seems to run about an hour after I turn my laptop on, usually in the middle of a bzflag game ("sudo killall -updatedb" is what I do to stop it).
locate and tmpwatch
Locate is handy for quickly finding files. "slocate", the version of locate included in Red Hat Linux, is supposed to keep track of which files are accessible, so it will only show matches that are available to each user. Sometimes locate seems to miss certain things though, so use find for more in-depth searches. Also see "type" and "file" commands ("which" is an older command if you don't have a shell that supports "type"). (Also try rpm -ql to see which files are in an RPM)
System Logging
Catchall for logs is /var/log/messages. Read religiously. Other log files go in /var/log:
"secure" deals with login failures and such
boot.log contains some of the information that flashes by on the screen when you boot up, also see "dmesg" which prints latest kernel messages (these should all go to /var/log/messages too)
wtmp is a binary log file for the "last" program (shows people who logged in recently)
cron tells you what's been run by cron
xferlog is for transfers with FTP
/var/log/httpd contains all your Apache logs
If installed, "logwatch" will email root with things it finds out of place.
syslog.conf controls the syslog facility (/var/log/messages, secure, and others). Restart syslog with HUP to re-read the configuration file.
Logrotate automatically rotates logs when run by cron, usual configuration is to rotate once a week. See /etc/logrotate.d/ and /etc/logrotate.conf and man pages for logrotate. If you add programs that don't put an entry in logrotate.d you should do so manually, to keep logfiles from growing. You might want to change the Apache setup so it doesn't throw away your logs after a month if you want long-term stats.
GUI Administration Tools
redhat-config-bind |
cover this in network services class |
redhat-config-date |
similar to dateconfig |
redhat-config-httpd |
cover this in network services class |
redhat-config-keyboard |
adjust keyboard mappings |
redhat-config-kickstart |
graphical KS configurator |
redhat-config-language |
adjust language settings |
redhat-config-mouse |
mouse settings, some overlap with redhat-config-xfree86 |
redhat-config-network |
This is one of the more advanced tools and is also referred to as "neat" . Support for multiple profiles, wireless connections, etc. |
redhat-config-nfs |
cover this in network services class |
redhat-config-packages |
see RPM section above |
redhat-config-printer |
see printer section |
redhat-config-printer-gui |
used for GUI version of r-c-printer |
redhat-config-proc |
modifies system tunable parameters in /etc/sysctl.conf |
redhat-config-rootpassword |
name gives it away |
redhat-config-securitylevel |
basic iptables firewall tool |
redhat-config-services |
nice tool, adjusts running services |
redhat-config-soundcard |
configures more recent sound cards |
redhat-config-users |
graphical user/group editor |
redhat-config-xfree86 |
X config tool for modern X servers, if you have problems you may need to rever to the old Xconfigurator, but it normally works |
redhat-logviewer |
basic log viewer program, pretty kewl |
redhat-switchmail |
switch between sendmailand postfix |
redhat-switch-printer |
switch between LPRng* and CUPS |
* = default
The Update Agent (up2date)
Run up2date by itself to register with RHN. Follow prompts, etc. Gets latest packages and installs deps. Has an automatic/nightly mode but documentation on that seems to be scarce. Packages that are downloaded are stored in /var/spool/up2date .
"up2date packagename" will update/install that given package from RHN.
You should always check for updates when you instlal new packages from the CD, which is why the "up2date packagename" method is handy.
Requires registration, only get one system for free, must fill out survey, etc.
You an also download updates from FTP servers instead of using up2date.
Subscribe to redhat-watch-list for notification of availability, or set RHN prefs to get email.
Documentation and Help Sources
man pages; use "man -k keyword" if you don't know page name (limited usefuleness)
Use "man <num> section" for other sections of man pages, like "man 1 crontab" vs. "man 5 crontab" etc. See "man man" for the section numbers.
Documentation CD, which is mostly the manuals.
Red Hat manuals at http://www.redhat.com/docs/manuals/linux/
I heartily recommend these manuals. They would make an excellent textbook for this RHCE study course. Remember the object is to learn the "Red Hat way"
/usr/share/doc/package-name/ -- all the original READMEs and such from the packages
info pages, basic info viewer is annoying but I recommend "pinfo" (not usually installed by default but is available on the CD or via up2date) Pinfo also does man pages. Info pages especially handy for GNU tools where the man pages are depracated.
Google! TriLUG! (These options, and HOWTOs. aren't often the "Red Hat way" so be careful for purposes of RHCE study)