Title: Managing Software Packages and File Systems
1Managing Software Packages and File Systems
2Managing Packages
- Linux groups related files into packages for
easier management - Software package contains all files needed to
install and use application - Red Hat Package Manager format
- Abbreviated as rpm
- Debian Package Manager format
- Abbreviated as deb
3Managing Packages (continued)
- Debian package format
- Used by the Debian Linux distribution
- .deb file extension
- dpkg old form for installing packages
- apt Advanced Packaging Tool
- dselect - utility manages Debian packages
4Managing Packages Graphically
- Use graphical utility to change what is installed
- To start utility, enter Red-Hat
system-config-packages in terminal window - Select check box next to any category of packages
to add packages from category - Details link lists individual software packages
included in category
5Managing Packages Graphically (continued)
6Synaptic Package Manager in Ubuntu
7Using 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 packages from system
8Using 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
9Using rpm to Manage Software Packages (continued)
- Rpm command options fall into categories
- -q option?query database and learn about packages
- -i or -U option?install or upgrade package
- -e option?erase (uninstall) rpm package
- Options can be used in combination
- Install new rpm files either from
- Linux CD-ROM
- Internet
10Using 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 specify package
names - rpm utility maintains internal database of keys
- Key is part of encryption information used to
digitally sign rpm file
11Using 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
12Converting RPM to DEB Packages
- sudo apt-get install alien
- Download rpm
- student18_at_student18-desktop sudo alien
--scripts --to-deb avg75flm-r45-a0973.i386.rpm
avg75flm_r45-1_i386.deb - Coverts to deb generated
- Install Debian package
- student18_at_student18-desktop sudo dpkg --install
avg75flm_r45-1_i386.deb
13Repairing Package Manager
- sudo apt-get install -c
- Checks apt may need to be run if Synaptic
package manager hangs - sudo dpkg --configure -a
- Attempts to install all partially installed
packages
14APT Tools
- apt-get install package-name
- Installs a package
- apt-get remove package-name
- Removes a package
- --purge removes configuration files
- apt-cache search keyword
- Searches for packages that match a keyword
15Updating 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
16Updating 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
17Updating the System Automatically (continued)
- up2date utility
- Manage updated software
- Configure overall settings for Red Hat Network
- System Tools then Red Hat Network on GNOME main
menu - Tabs
- General
- Retrieval/installation
- Package exceptions
18Software Updates in Ubuntu
19Updating the System Automatically (continued)
- Management and provisioning products within Red
Hat networks offering - Must purchase
- Add capabilities to help keep systems secure and
up to date
20Understanding the File System
- During installation
- Partitions created
- ext3 or similar file system
21Reviewing File System Types
- File system
- Collection of data structured in certain way so
that it can be efficiently accessed - Superblock
- Collection of information about file system as a
whole meta data for file system - Found in ext2 and ext3
- View superblocks
- sudo dumpe2fs /dev/hdd1 grep -i superblock
22Reviewing File System Types (continued)
- ext2 and ext3 file systems
- Do not place files one after another filling up
each area of hard disk in order - Permit file to grow in size without being as
likely to be broken into pieces - Never need to defragment
- ext3
- Journaling file system
23Reviewing File System Types (continued)
- Other journaling file systems
- ReiserFS
- Journaling File System (JFS)
- Virtual file system model
- Used by kernel
- Separates file system type from operation program
wants to perform - Linux can support any new file system type for
which driver is available
24Reviewing File System Types (continued)
- Each file system must be mounted
- Mount command
- Without any parameters
- List of currently mounted file systems
25Checking File System Status
- Root file system becomes full
- Linux kernel can crash
- df command displays space usage information for
each file system that is currently mounted - If file system becomes full, must free space in
directories where file system is mounted
26df output
- Filesystem 1K-blocks Used
Available Use Mounted on - /dev/hdd1 8064524 3409880
4244992 45 / - varrun 517284 112
517172 1 /var/run - varlock 517284 4
517280 1 /var/lock - udev 517284 112
517172 1 /dev - devshm 517284 0
517284 0 /dev/shm - lrm 517284 18856
498428 4 /lib/modules/2.6.15-23-386/volatile
27Checking File System Status (continued)
- Immediately free space
- Look for large or numerous files in /tmp
directory that can be deleted - Look for large or numerous files in /var
subdirectories - Move system log file (/var/log/messages) to
another file system that isnt as full - See if any user subdirectories are using
unusually large amounts of disk space - Delete unused archive files
28Checking File System Status (continued)
- du utility lists size of directory and all its
subdirectories - du h shows file sizes in kilobytes
- Various graphical tools and system administration
scripts to check status of file systems - Hardware Browser
- KDiskFree
29File System Attributes
- ext3 file system assigns set of attributes to
each file - Not displayed by ls command
- lsattr command lists attributes of files in
directory - lsattr projectfile
- chattr command changes attributes of one or more
files - chattr i projectfile
- add attribute
- chattr -i projectfile
- remove attribute
30Checking File Systems
- fsck utility
- Checks integrity of file systems
- Usually pronounced fizz-check
- Can also repair minor file system problems
- Must be run on file system that is not mounted
- Example fsck /dev/hda1
- e2fsck -c /dev/hda1
- e2fsck 1.38 (30-Jun-2005)
- /dev/hda1 is mounted.
- WARNING!!! Running e2fsck on a mounted
filesystem may cause - SEVERE filesystem damage.
- Do not run on a mounted volume.
31Creating New File Systems
- Adding file system means
- Adding hard disk device to your system
- Making hard disk available to Linux by
- Formatting
- Mounting
32Using the fdisk Utility
- Modifications to partition table only effective
when you write changes to disk with w command to
exit fdisk - Example fdisk /dev/hdb
33Using the fdisk Utility (continued)
34Using the fdisk Utility (continued)
- Disk /dev/hdd 20.4 GB, 20490559488 bytes
- 255 heads, 63 sectors/track, 2491 cylinders
- Units cylinders of 16065 512 8225280 bytes
- Device Boot Start End Blocks
Id System - /dev/hdd1 1 1020
8193118 83 Linux - /dev/hdd2 1021 1151
1052257 82 Linux swap / Solaris - Command (m for help) n new partiion
- Command action
- e extended
- p primary partition (1-4)
- p - primary
- Partition number (1-4) 3
- First cylinder (1152-2491, default 1152)
- Using default value 1152
- Last cylinder or size or sizeM or sizeK
(1152-2491, default 2491) 500
35Using the fdisk Utility (continued)
- Command (m for help) t
- Partition number (1-4) 3
- Hex code (type L to list codes) l
- 0 Empty 1e Hidden W95 FAT1 80 Old
Minix be Solaris boot - 1 FAT12 24 NEC DOS 81 Minix
/ old Lin bf Solaris - 2 XENIX root 39 Plan 9 82 Linux
swap / So c1 DRDOS/sec (FAT- - 3 XENIX usr 3c PartitionMagic 83 Linux
c4 DRDOS/sec (FAT- - 4 FAT16 lt32M 40 Venix 80286 84 OS/2
hidden C c6 DRDOS/sec (FAT- - 5 Extended 41 PPC PReP Boot 85 Linux
extended c7 Syrinx - 6 FAT16 42 SFS 86 NTFS
volume set da Non-FS data - 7 HPFS/NTFS 4d QNX4.x 87 NTFS
volume set db CP/M / CTOS / . - 8 AIX 4e QNX4.x 2nd part 88 Linux
plaintext de Dell Utility - 9 AIX bootable 4f QNX4.x 3rd part 8e Linux
LVM df BootIt - a OS/2 Boot Manag 50 OnTrack DM 93
Amoeba e1 DOS access - b W95 FAT32 51 OnTrack DM6 Aux 94
Amoeba BBT e3 DOS R/O
36Using the fdisk Utility (continued)
- c W95 FAT32 (LBA) 52 CP/M 9f
BSD/OS e4 SpeedStor - e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a0 IBM
Thinkpad hi eb BeOS fs - f W95 Ext'd (LBA) 54 OnTrackDM6 a5
FreeBSD ee EFI GPT - 10 OPUS 55 EZ-Drive a6
OpenBSD ef EFI (FAT-12/16/ - 11 Hidden FAT12 56 Golden Bow a7
NeXTSTEP f0 Linux/PA-RISC b - 12 Compaq diagnost 5c Priam Edisk a8
Darwin UFS f1 SpeedStor - 14 Hidden FAT16 lt3 61 SpeedStor a9
NetBSD f4 SpeedStor - 16 Hidden FAT16 63 GNU HURD or Sys ab
Darwin boot f2 DOS secondary - 17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI
fs fd Linux raid auto - 18 AST SmartSleep 65 Novell Netware b8 BSDI
swap fe LANstep - 1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot
Wizard hid ff BBT - 1c Hidden W95 FAT3 75 PC/IX
- Hex code (type L to list codes) 83
- write out parition
- Command (m for help) w
37Formatting File Systems
- mke2fs command
- Formats partition
- Erasing all information on it
- Organizes space for data to be recorded
- Partition can be used by Linux
- Use -j option to add journaling
- For ext3
- Example mke2fs -j /dev/sdb2
38Formatting File Systems (continued)
- fdformat /dev/fd0 command
- Format 3.5-inch disks
- tune2fs utility
- Examine superblock of file system
- Make minor changes to file system parameters
- tune2fs -j /dev/hdd convert to a journaling
file system - tune2fs /ddv/hdd -c maximum mount counts
- tune2fs /ddv/hdd -i daymonthweek frequency
- Time before running automatic system check before
running automatic system check.
39Mounting New File Systems
- mount command
- To access file system
- Indicate
- Device on which file system is stored
- Directory where file system should be made
accessible in directory structure - Example mount -t ext3 /dev/sdb2 /archive
- Specify type and mount point
- umount /dev/sdb2 command
- Unmounts the partition
40Mounting New File Systems (continued)
- lostfound directory
- Placed in beginning of all new ext2 and ext3 file
systems - Indicates successful mounting
- File system cannot be in use when using umount
command
41Automating File System Mounting
- /etc/fstab configuration file
- Key to automounting file systems
- Contains one line for each file system to
automount - Add options when executing mount command
- Example mount -t ext3 -o defaults /dev/sdb2
/archive
42/etc/fstab
- /etc/fstab static file system information.
-
- ltfile systemgt ltmount pointgt lttypegt ltoptionsgt
ltdumpgt ltpassgt - proc /proc proc defaults
0 0 - /dev/hdd1 / ext3
defaults,usrquota,grpquota,errorsremount-ro 0
1 - /dev/hdd2 none swap sw
0 0 - /dev/hdc /media/cdrom0 udf,iso9660
user,noauto 0 0 - /dev/fd0 /media/floppy auto
rw,user,noauto 0 0 - ro read only, rw-read write
- user anyone may mount, nouser only root can
mount - Defaults rw,suid,dev,exec,auto,nouser,async
- auto mount automatically, noauto do not mount
automatically
43Using the autofs Mounting Service
- autofs service
- Daemon
- Watches for users to change to preconfigured
directories - Mounts needed file system in background
- Operated by script in /etc/rc.d/init.d directory
- /etc/auto.master lists directories to be
automounted
44Using the autofs Mounting Service (continued)
- autofs service
- Example
- Mounting /misc directory
- Create /etc/auto.misc file
- Contains options to use when autofs mounts file
system to /misc
45Managing Swap Space
- mkswap command
- Format partition set up using fdisk as swap space
- Example mkswap /dev/hda2
- swapon command activates swap space
46Setting Quotas on Disk Usage
- Disk quotas
- Limit on amount of hard disk space user or group
can use - Steps to create quota
- Enable quotas on file system
- Establish quota for users or groups
- Activate quota system
- Review current disk usage for file system
47Setting Quotas on Disk Usage (continued)
- ulimit command
- Part of bash shell
- Impose limits on actions of users
48Setting Quotas on Disk Usage (continued)
- sudo apt-get install quota
- Add usrquota and grpquota to partition that must
have quotas - /dev/hdd1 / ext3
defaults,usrquota,grpquota,errorsremount-ro 0
1 - sudo init 1 single user mode
- sudo mount / -o remount,rw
- remount to update options
- quotacheck -mavug
- quotaon /
- sudo touch /quota.user
- sudo touch /quota.group
- quotaon /dev/hdd1
49Quota Commands
- quota check quota for current users
- quotaon /mountpointname turn on quotas
- repquota report on quota utilization
- edquota u username set quota for user
- edqupta u t set grace period
50Using Networked File Systems
- Many Linux networks use networked file systems to
share data transparently over network - Use mount command to make directory on another
computer appear as part of local file system - Similar to idea of mapping a network drive in
Microsoft Windows
51Using Networked File Systems (continued)
- Networked file systems normally accessed using
- Network file system (NFS)
- sudo apt-get install nfs
- Server message block (SMB)
52Using Networked File Systems
- gedit /etc/exports
- /home/localfoldertoshare remote_host_ip(permission
s) - Specify who can access the localfoldertoshare and
what their permissions will be - gedit /etc/hosts.allow
- specifies services that remote host can use
- portmapremote_host_ip
- lockdremote_host_ip
- mountdremote_host_ip
- rquotadremote_host_ip
- statdremote_host_ip
- /etc/hosts.deny
- Deny all other hosts access to services
- ALLALL
53Using Networked File Systems
- remote_host_ip
- 192.168.240.100 single ip address
- all addresses
- 192.168.240.0/24 subnet
- Permissions
- ro read only, rw-read write
- root-squash no remote root level access to file
system - async,sync how files are updated asynchronously
or synchronously