430 likes | 574 Views
Compression, backup, and software installation. Unit objectives Use compression utilities to compress and decompress files Perform system backups and view and extract archives Compile and install software packages from source code and use the Red Hat Package Manager. Topic A: Compression.
E N D
Compression, backup, and software installation Unit objectives • Use compression utilities to compress and decompress files • Perform system backups and view and extract archives • Compile and install software packages from source code and use the Red Hat Package Manager
Compression • Process in which files are reduced in size by a compression algorithm • Compression algorithm • Instructions used to reduce the contents of a file • Compress • Gzip • bzipw
The compress utility • Uses LZW algorithm • Average ratio: 40-50% • Files have .Z extension • compress –v samplefile sapmplefile2 • Compress both samplefile and samplefile2 • Replaces original files with .Z files
The compress utility • zcat • Used to view the contents of archive created with compress or gzip • zmore • Used to view page-by-page • uncompress • Decompresses files that were processed with compress • Also a filter for redirect from stout • who | compress –v >file.Z
GNU zip (gzip) • Algorithm varies slightly from that used by compress • Lempel-Ziv (LZ77) • Yields better compression • Typical ratio: 60-70% • zcat and zmore work on gzipped files • decompress with gunzip or gzip -d
Common options with gzip continued
The bzip2 utility • Uses a different algorithm from compress or gzip • Burrows-Wheeler Block Sort and huffman coding • zcat and zmore can’t be used • Average ratio: 50-75% • bzcat • Used to view the contents of archive created with bzip2 • bunzip2 • Used to decompress files
Importance of backup • Process of copying files to an archive • Archive • Location (file or device) that contains a copy of files • Typically created by a backup utility
Backup Media • Tapes, zip, flash, memory devices, optical, etc.
magnetic tape (mt) command • Used to control tape devices • mt –f /dev/st0 rewind
Planning a backup • Not all files need backing up • Back up user created files and configs • Not progams or temp files • After you select the files, use a utility to back them up
Backup utilities • tar • cpio • dump/restore • burning software
Tape archive (tar) • One of the oldest and most common backup utilities • Accepts options to determine the location of the archive and the action to perform on the archive
Common options with tar continued
Common options with tar, continued continued
Common Tar usage • tar –cvf /backup.tar * • Backs up current directory • Use –P for absolute paths • Limited to 255 characters • tar –tvf /backup.tar • See the files in the tar archive
Tarballs-Compressed archive • Tar does not do compression • Need to add compression to it • A gzip-compressed tar archive • Used for software distribution as well as backup • tar –zcvf /backup.tar.gz * • Creates a gziped tar archive • tar –zxvf /backup.tar.gz • Extract files from tar archive
The copy in/out (cpio) utility • Common backup utility • Options similar to tar with added features • Can back up device files and long filenames • Uses absolute pathnames by default • Use –O option to send list of files to archive • -I defines where to expand from
The dump/restore utility • Full backup • Archives an entire filesystem • Incremental backup • Archives only files modified since the last full backup • Works only with files on ext2 and ext3 filesystems
restore command • Extracts archives created with the dump command
Forms of software distribution • Binary program files • Pre-compiled to run on specific hardware • Source code • Must be compiled on the local architecture • RPM package • Uses Red Hat Package Management system
Source code • Independent of hardware platform • Procedure for compiling source code into binary programs is standardized among most open source developers • GNU C Compiler (gcc) • Used to compile source code into binary programs
Package manager • Defines a standard package format • Can be used to install, query, and remove packages • Red Hat Package Manager (RPM) • The most commonly used
Installing from source code • Uncompress and extract files • Run configure • Run make • Run make install
RPMs • Filenames indicate hardware architecture the software was compiled for • rpm command • Command used to install, query, and remove RPM packages
Removing packages • Use RPM command with –e option
Red Hat Package Manager • Graphical tool that may be used to install RPM packages available with the GNOME/KDE desktop environment
Unit summary • Compressed and decompressed files using compression utilities • Performed system backups and viewed and extracted archives • Compiled and installed software from source code and used the Red Hat Package Manager