linux chapter 11 compress backup software

Upload: christopher-david-belson

Post on 14-Apr-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    1/50

    Archiving, Compression, and

    Managing Software Packages

    Chapter Eleven

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    2/50

    Compressing Files

    Compressing files

    Useful way to use less space for rarely accessed data

    Makes files smaller before transmitting them over network

    gzip command Compress any file; best compression 60-70% of original size

    Lempel-Ziv Compression

    gzipv sample sample.gz

    -v verbose option

    zcat sample.gz to view compressed file contents

    gunzip command

    Uncompresses file compressed using gzip

    gunzipv sample.gz

    Alternative: gzipd sample.gz

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    3/50

    3

    The gzip Utility (continued)

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    4/50

    The gzip Utility (continued)

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    5/50

    The gzip Utility (continued)

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    6/50

    Compressing Files

    bzip2 command Compress any file; better compression than gzip

    BurrowsWheeler transform and Huffman coding

    bzip2v sample sample.bz2

    -v verbose option

    bzcat sample.bz2 to view compressed file contents

    bunzip2 command

    Uncompresses file compressed using gzip

    bunzip2v sample.bz2

    bzip2d sample.bz2

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    7/50

    The bzip2Utility (continued)

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    8/50

    The bzip2Utility (continued)

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    9/50

    System Backup

    System backup: process whereby files are copied toan archive

    Archive: location (file or device) that contains copy of

    files Typically created by a backup utility

    Should backup user files from home directories andany important system configuration files

    Possibly files used by system services as well Several backup utilities available

    tar, cpio, dump/restore, burning software

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    10/50

    System Backup (continued)

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    11/50

    Using tar for Archiving Files

    tar archive

    Tape Archive

    Single file that can contain other files anddirectory structure

    tar command

    Create tar archive Specify files to be included in backup archive

    on command line

    Writes data to file name or device

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    12/50

    The tar Utility (continued)

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    13/50

    The tar Utility (continued)

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    14/50

    Using tar for Archiving Files

    tar and compress an entire directorys contents

    tarzcvf backup.tar.gz *

    View contents of archive tarztvf backup.tar.gz *

    tar to a tape device

    tarcvf /dev/st0 *

    Extract and uncompress

    tarzxvf backup.tar.gz

    Extract from a tape device tarxvf /dev/st0

    Tarball archive and compressed .tar.gz or .tgz

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    15/50

    Using tar and cpio for Archiving Files

    (continued) cpio command

    Copy in and out

    Similar to tar

    Reads from STDIN channel for file names

    Writes data back to STDOUT Examples

    Archive

    find /homeu horvathe | cpiovocBO horvathe.cpio

    Extract

    cpiovicBI horvathe.cpio

    tar and cpio

    Help create incremental or multilevel backup

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    16/50

    The cpio Utility (continued)

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    17/50

    The cpio Utility (continued)

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    18/50

    The dump/restore Utility

    dump/restore: Used to back up files and

    directories to device or file on filesystem

    Works only with files on ext2 and ext3 filesystems

    Designed to backup entire filesystems to an

    archive

    /etc/dumpdates: file used to store information

    about incremental and full backups

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    19/50

    The dump/restore Utility

    (continued)

    Full backup: archiving all data on filesystem

    Incremental backup: backs up only data that

    has changed since last backup

    Can perform up to nine different incremental

    backups

    dump command: create archives for full or

    incremental backup

    restore command: extract archives created

    with dump

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    20/50

    The dump/restore Utility

    (continued)

    A sample back-up strategy

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    21/50

    The dump/restore Utility

    (continued)

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    22/50

    Burning Software

    tar, cpio, and dump utilities copy data to backupmedium in character-by-character or block-by-block

    format

    Typically used with tape, floppy, and hard disk media

    Disc burning software: used to write files to CD orDVD media

    Build CD or DVD filesystem, organize the data, and write it

    all to CD or DVD

    Ubuntu comes with k3b Disc Burner burning

    software

    Fedora comes with Brasero Disc Burner burning

    software

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    23/50

    Managing Packages

    Linux groups related files into packages for

    easier management

    Software package contains all files neededto install and use application

    Red Hat Package Manager format

    Abbreviated as rpm

    Debian Package Manager format

    Abbreviated as deb

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    24/50

    Managing Packages (continued)

    Debian package format

    Used by Debian Linux distributions

    .deb file extension

    dpkg old form for installing packages

    apt Advanced Packaging Tool

    dselect - utility manages Debian packages

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    25/50

    Synaptic Package Manager in

    Ubuntu

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    26/50

    Using rpm to Manage Software

    Packages rpm command-line utility maintains

    database listing all software packages

    installed on system Lists:

    Files included in each package

    Packages are dependent on other packages

    Other information

    rpm command

    Install new software packages

    Erase software acka es from s stem

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    27/50

    Using rpm to Manage Software

    Packages (continued) Name of package file includes version

    information

    Example gedit-2.4.0-3.i386.rpm

    Version 2.4.0

    Release code 3

    Platform i386

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    28/50

    Using rpm to Manage Software

    Packages (continued) Rpm command options fall into categories

    -q optionquery database and learn about packages

    -i or -U optioninstall or upgrade package -e optionerase (uninstall) rpm package

    -f option: together with q used to display the

    package to which a specific file belongs

    Install new rpm files either from: Linux CD-ROM

    Internet

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    29/50

    Using rpm to Manage Software

    Packages (continued) Install package zsh-4.2.0-1.i386.rpm

    rpm -uvh /tmp/zsh-4.2.0-1.i386.rpm

    Can use regular expression to specifypackage names

    rpm utility maintains internal database of

    keys

    Key is part of encryption information used

    to digitally sign rpm file

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    30/50

    Using rpm to Manage Software

    Packages (continued) Fedora keys located in /usr/share/rhn

    --import imports keys into rpm database

    Check for keys

    rpm --checksig -v packagefilename

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    31/50

    Installing Programs Using RPM

    Packages in RPM format have filenames that

    indicate hardware architecture for which the

    software was compiled

    End with .rpm extension

    To install an RPM package, use i option to

    rpm command

    Command used to install, query, and remove RPM

    packages

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    32/50

    Installing Programs Using RPM

    (continued)

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    33/50

    Installing Programs Using RPM

    (continued)

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    34/50

    Installing Programs Using RPM

    (continued) Most RPM packages are located on Internet Servers

    Called software repositories

    yum command: used to search Internet software

    repositories for RPM packages Installs dependent packages if necessary

    yum install packagename command

    yum update packagenamecommand

    KPackageKit: graphical utility for installing or updating

    packages

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    35/50

    Installing Programs Using RPM

    (continued)

    The KPackageKit utility

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    36/50

    alien

    Converts RPM to DEB Packages

    sudo aptitude install alien

    Download rpm

    sudo alien --scripts --to-deb avg75flm-r45-

    a0973.i386.rpm avg75flm_r45-1_i386.deb

    Coverts to deb generated

    Install Debian package

    sudo dpkg --install avg75flm_r45-1_i386.deb

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    37/50

    Repairing Package Manager

    sudo aptitude install -c

    Checks apt may need to be run if Synaptic

    package manager hangs sudo aptitude install --fix-missing

    sudo aptitude -f install

    Fix packages; even sudo dpkg --configure -a

    Attempts to install all partially installed packages

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    38/50

    APT Tools

    aptitude install package-name

    Installs a package

    aptitude reinstall package-name

    Reinstalls a package

    aptitude remove package-name

    Removes a package

    aptitude purge package-name

    Removes package and configuration files

    aptitude show packagename

    Displays information about the package, including dependencies.

    May also use apt-get for many commands

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    39/50

    APT Tools aptitude update

    Updates the list of available packages from the apt sources

    aptitude upgrade

    Upgrades installed packages to the most recent versions.

    aptitude safe-upgrade The safest way to upgrade is to use the action 'safe-upgrade'. The

    new action will upgrade a package only if it does not impact other

    packages, i-e: if it is necessary to add or remove a dependency

    package during upgrade, safe-upgrade won't upgrade

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    40/50

    APT Tools aptitude full-upgrade

    Upgrades installed packages to the most recent versions.

    aptitude will upgrade to the latest version of a package even if it is

    necessary to add or remove dependencies.

    aptitude clean

    Deletes packages in the APT cache.

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    41/50

    APT Tools

    apt-cache search keyword

    Searches for packages that match a keyword

    apt-cache depends packagename Display dependencies; packages that must be

    installed before this package can be used.

    aptitude search packagename

    Searches for packages have the packagename

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    42/50

    Repositories

    Sites where packages can be downloaded

    /etc/apt/sources.list

    # comment

    deb executable

    deb-src source code

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    43/50

    dpkg

    Monitors which software packages are installed

    Location of packages

    Dependencies

    Will not download packages from a repository

    dpkg --list packagename.deb

    Information about packages

    dpkg --install packagename.deb

    Install packages

    dpkg -- purge packagename

    Delete package and configuration files

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    44/50

    dpkg

    dpkg --status packagename Displays information about an installed

    package

    dpkg --search packagename

    Search for packages with a name

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    45/50

    Updating the System

    Automatically Download upgrades or security fixes for key

    operating system packages installed on system

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    46/50

    Software Updates in Ubuntu

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    47/50

    Updating the System

    Automatically Red Hat Network

    Download upgrades or security fixes for key

    operating system packages installed on system Subscribe to Red Hat Network service

    May be entitled to annual subscription as part of

    purchase

    Individuals can use for free

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    48/50

    Updating the System

    Automatically (continued) Red Hat Network

    Uses icon on Panel in GNOME or KDE to

    indicate status Check mark in blue circle

    Flashing exclamation point in red circle

    To register, double-click network alert icon on

    panel

    To configure, right-click alert icon

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    49/50

    Updating the System

    Automatically (continued) up2date utility

    Manage updated software

    Configure overall settings for Red HatNetwork

    System Tools then Red Hat Network on

    GNOME main menu Tabs

    General

    Retrieval/installation

    Package exceptions

    C ili S C d i t

  • 7/30/2019 Linux Chapter 11 Compress Backup Software

    50/50

    Compiling Source Code into

    Programs Procedure for compiling source code into binary

    programs standardized among most OSS developers

    Source files are typically stored in a .tar.gz file

    make command: looks for Makefile and it to compilethe source code into binary using compiler

    Makefile: contains most of the information and commands

    necessary to compile a program, as well as instructions for

    use of commented areas

    make install command: copies complied

    executable programs to correct location