CPSC 665 Spring 2004 Basic System Administration
CPSC 665 Spring 2004 Basic System Administration. Nolan Flowers. Agenda. Operating Systems Red Hat Linux Solaris Sources for information O’reilly Books Unix Power Tools 2 nd edition Linux Administration Handbook. Topics Covered. Useful commands Useful files Installing software.
CPSC 665 Spring 2004 Basic System Administration
E N D
Presentation Transcript
CPSC 665 Spring 2004Basic System Administration Nolan Flowers
Agenda • Operating Systems • Red Hat Linux • Solaris • Sources for information • O’reilly Books Unix Power Tools 2nd edition • Linux Administration Handbook
Topics Covered • Useful commands • Useful files • Installing software
Commands • find • ls • grep • ifconfig • netstat • chmod • chown • chgrp • adduser
find • The Syntax for find is:
ls • Action: • Command to list files • Syntax: • ls -<parameters> • Commonly user parameters are: • -al list all long format (includes files that start with .) • -l list long format (doesn’t include . Files) • -ald list all long format directories
grep • Action: • Searches on a regular expression • Syntax: • grep <pattern> • ls’ best friend • ls –al | grep filename • Accepts wildcards
ifconfig • Action: • Gives status on network interfaces • Syntax: • Ifconfig (-a for unix) • Returns MAC address, interface status, netmask, broadcast address, number of received and transmitted packets, etc
netstat • Action: • Gives network status • Syntax: • netstat -<parameter> • Commonly used parameters • -nr lists routing table • -at lists active internet connections
chmod • Action: • Changes permissions on files or directories • Syntax: • chmod mode file (chmod 777 thisfile)
chown • Action: • Changes ownership of files or directories • Syntax: • chwon owner file (chown bubba thisfile)
chgrp • Action: • Changes group ownership of a file or directory • Syntax: • chgrp groupname file (chgrp staff thisfile) • chown and chgrp can be aggragated: • chown user:group file (chown bubba:staff thisfile)
adduser • Action: • command to add users • Syntax: • usage: adduser [-u uid [-o]] [-g group] [-G group,...] • [-d home] [-s shell] [-c comment] [-m [-k template]] • [-f inactive] [-e expire ] [-p passwd] [-M] [-n] [-r] name
Important Files • /etc/password • /etc/shadow • /etc/group
/etc/password • Sample /etc/password file bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin adm:x:3:4:adm:/var/adm:/sbin/nologin • One line per user each with seven fields • login name • Encrypted password (x indicates use of shadow file) • UID number • Default GID number • Full Name • Home directory • Login shell
/etc/shadow • Sample /etc/shadow file bin:*:12333:0:99999:7::: daemon:*:12333:0:99999:7::: adm:*:12333:0:99999:7::: • One line per user each with nine fields • login name • Encrypted password • Date of last password change • Minimum number of days between password changes • Maximum “ • Number of days in advance to warn about password expiration • Number of days after expiration that account is disabled • Account expiration date • Reserve field that is always empty
/etc/group • Sample /etc/group file wheel:*:10:root,joe,jim,john csstaff:*:100:bubba,sissy students:*:200:kim • One line per group each with four fields • Group name • Encrypted password (historical) • GID number • List of members, separated by a comma with no spaces
Pitfalls & Cautions • Make sure the shell exists before modifying /etc/password • Don’t set UID to 0. Convenient, but a really bad idea. • Start group IDs higher than 100.
Installing Software • wget • tar -xvfz • Dependencies • configure • make • make install
wget • ftp, scp and http are methods of transfering data. • wget <link> establishes the connection and transfers the file in one easy step • Example: unix % wget http://mirror.ehpg.net/apache/httpd/httpd-2.0.48.tar.gz This will retrieve the apache source to your local directory
tar • Most, if not all files come either tar’d or gzip (compressed) or both. • tar has no compression it is just a bundleing of files for ease of transfer. • To untar and uncompress at the same time use: • tar xvfz <filename> • x: extract • v: vervose • f: file • z: unzip
Dependencies • A majority of software depends on other software to compile and run. • C is needed to compile the software (make) • To run https, pops or imaps you need ssl • To have php query databases, … etc. • Some package managers check dependencies and download them as needed.
Configure • Configure is where you pass parameters to fine-tune your installation of the software. • Common parameters are: • Location (ie directories) • Security (openssl) • What modules to include
make • This builds the program. • That is, make would be executed, it would look for the first target in Makefile and do what the instructions said. • The expected end result would be to build an executable program.
make install • This again invokes make. • make finds the target install in Makefile and follows the directions to install the program. • Voila! Your program is compiled and installed.
Installing Software • cd ./apache_1.3.29 • ./configure \ • --prefix=/usr/local/apache \ • --enable-module=so \ • --enable-module=rewrite \ • --enable-shared=rewrite \ • --enable-module=setenvif \ • . . . <parameters deleted for brevity> • --enable-shared=log_agent \ • --enable-module=headers \ • --enable-shared=headers • make • make install
Installing Software • When make doesn’t • Things to consider when make fails: • Bad download of source code • Wrong parameters passed in configure • Things to remember: • Verify the checksum • Always do a ‘make clean’ prior to trying again
Check the logs • When a program is not running as expected, the first place to look is the log files. • Log files either explicitly state the nature of the error or give excellent clues • If you compiled from source double check your dependencies. Since so many parameters can be passed to configure, errors are easy to make.
Class Listserv • Class Listserv • 665-04@listserv.tamu.edu • Questions specifically for gold team • Only gold and platinum teams have access to read these e-mails • 665-04-gold@listserv.tamu.edu