Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 10: Managing Software Packages and File Systems

Similar presentations


Presentation on theme: "Chapter 10: Managing Software Packages and File Systems"— Presentation transcript:

1 Chapter 10: Managing Software Packages and File Systems
The Complete Guide to Linux System Administration

2 Objectives Manage software packages that use the rpm format
Use Red Hat Network to update a Red Hat Linux or Fedora installation Manage and install new file systems The Complete Guide to Linux System Administration

3 Managing 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 Most popular data storage format for creating software packages The Complete Guide to Linux System Administration

4 Managing Packages (continued)
Debian package format Used by the Debian Linux distribution .deb file extension dselect utility manages Debian packages The Complete Guide to Linux System Administration

5 Managing Packages Graphically
Use graphical utility to change what is installed To start utility, enter 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 The Complete Guide to Linux System Administration

6 Managing Packages Graphically (continued)
The Complete Guide to Linux System Administration

7 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 packages from system The Complete Guide to Linux System Administration

8 Using rpm to Manage Software Packages (continued)
Name of package file includes version information Example gedit i386.rpm Version 2.4.0 Release code 3 Platform i386 The Complete Guide to Linux System Administration

9 Using 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 The Complete Guide to Linux System Administration

10 Using rpm to Manage Software Packages (continued)
Install package zsh i386.rpm rpm -uvh /tmp/zsh 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 The Complete Guide to Linux System Administration

11 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 The Complete Guide to Linux System Administration

12 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 The Complete Guide to Linux System Administration

13 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 The Complete Guide to Linux System Administration

14 Updating 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 The Complete Guide to Linux System Administration

15 Updating the System Automatically (continued)
Management and provisioning products within Red Hat network’s offering Must purchase Add capabilities to help keep systems secure and up to date The Complete Guide to Linux System Administration

16 Understanding the File System
During installation Partitions created ext3 or similar file system When you installed Linux, the installed program created a root file system in which the operating system files were stored. The root file system may have been created on several partitions-for example, one for the /boot directory, one for the /home directory, one for the /usr directory, and another as the root directory The Complete Guide to Linux System Administration

17 Reviewing File System Types
Collection of data structured in certain way so that it can be efficiently accessed Superblock Collection of information about file system as a whole Found in ext2 and ext3 The Complete Guide to Linux System Administration

18 The superblock contains details such as the
size of each block on the file system, the volume label, the date of the last integrity check, the amount of space reserved for the root user, and several other pieces of information. A duplicate copy of the superblock is stored at dozens of locations in a large file system. If a complete copy of the superblock cannot be found, the file system cannot be accessed. The Complete Guide to Linux System Administration

19 Reviewing 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 Instead, they place files at various points located throughout the entire area of the file system. Permit file to grow in size without being as likely to be broken into pieces Never need to defragment ext3 Journaling file system The Complete Guide to Linux System Administration

20 The ext3 file system is just like the ext2 file system except that ext3 is a journaling file
system: it stores information about each disk operation so that if an error occurs (such as the system being shut down), the file system does not become corrupted. This journaling adds a small amount of overhead, but is much better than risking file system corruption. The Complete Guide to Linux System Administration

21 Reviewing 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 The Complete Guide to Linux System Administration

22 Reviewing File System Types (continued)
You previously used the mount command to make a new file system such as a removable disk or CD-ROM drive accessible within Linux. Each file system must be mounted so that the kernel is aware of it and can prepare the correct resources to access information stored on that file system. Each file system must be mounted Mount command Without any parameters List of currently mounted file systems The Complete Guide to Linux System Administration

23 The Complete Guide to Linux System Administration
$ mount /dev/hda2 on / type ext3 (rw) none on /proc type proc (rw) usbdevfs on /proc/bus/usb type usbdevfs (rw) none on /dev/pts type devpts (rw,gid=5,mode=62 0) none on / dev/shm type tmpfs (rw) / dev/hdb2 on /usr type ext3 (rw) none on /proc/sys/ fs /binfmt _misc type binfmt misc (rw) /dev/fd0 on /mnt/floppy type vfat (rw,nosuid,nodev) The output of the mount command includes : Example first line /dev/hda2 on / type ext3 (rw) • The device where the file system is located (such as /dev / hda2, which refers to a hard disk partition) • The mount point for the file system (the path in the directory structure where the file system can be accessed, such as /) • The type of the file system (preceded by the word "type"); this indicates the format of data stored on the file system (ext3 is the type) • The options that apply to the file system ; The options are rw, indicating that the file system is mounted for both reading and writing of data The Complete Guide to Linux System Administration

24 A useful method of interacting with removable disks that does not require you to first mount the disk is to use the mdir, mdel, and mcopy commands. These commands mirror the old MS-DOS commands dir, del, and copy. These commands mount the removable disk in the background and use "old fashioned“ drive letters on the command line. For example, to see the contents of a removable disk, insert the disk and enter mdir A: To copy a file from your home directory to the disk, enter mcopy ~/myfile A: These commands are all part of the mtools package, which is installed by default on Red Hat Linux and Fedora. The Complete Guide to Linux System Administration

25 Checking 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 The Complete Guide to Linux System Administration

26 The fields output by the df command, from left to right, are described in the following list:
• The device where the file system is stored; this is normally either a hard disk device name or a networked location (as in the last line of the sample output, which indicates a remote file system on the host named sundance) • The number of 1 KB blocks on the device. This indicates the file system's overall size. For example, in the sample output, the size of the three devices currently mounted are approximately 1 GB, 1 GB, and 2 GB, respectively. • The number of 1 KB blocks that are used on the device • The number of 1 KB blocks that are free on the device • The percentage of capacity reached so far (percentage full) for the device • The mount point for this device The Complete Guide to Linux System Administration

27 To display the data in gigabytes, use this command: $ df -B G
For example, to display the file system size and available space in megabytes, use this command: $ df -B M To display the data in gigabytes, use this command: $ df -B G The Complete Guide to Linux System Administration

28 Checking File System Status (continued)
If file system becomes full, must free space in directories where file system is mounted 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 isn’t as full See if any user subdirectories are using unusually large amounts of disk space Delete unused archive files The Complete Guide to Linux System Administration

29 Checking File System Status (continued)
du utility lists size of directory and all its subdirectories $ du -8 M /home/lizo Various graphical tools and system administration scripts to check status of file systems Hardware Browser KDiskFree The Complete Guide to Linux System Administration

30 The Complete Guide to Linux System Administration
Although you need to be very careful as you delete files, you rrught have to act quickly to respond to an overly full file system. The du (disk usage) utility can be a big help. The du utility lists the size of a directory and all its subdirectories. A few sample lines from the output of du are shown here: # du /home/lizo 22 ./public_html /Public/shell-programming /Public 2 ./Desktop/Autostart 2 . /Desktop/Trash 8 ./Desktop/Templates 13 /Desktop 1 /.kde/share/apps/kfm/tmp 1 / .kde/share/apps/kfm/bookmarks 6 /.kde/share/apps/kfm 1 / .kde /share/apps/kppp/Rules 1 / . kde/share/apps/kppp/Log 3 / .kde/share/apps/kppp 10 /.kde/share/apps 15 / .kde/share/config 1 /.kde/share/icons/mini 2 /.kde/share/icons 1 /.kde/share/applnk 1 /.kde/share /mimelnk 30 / .kde/share 31 / .kde 1 /archive 2337 /home/lizo The Complete Guide to Linux System Administration

31 File 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 chattr command changes attributes of one or more files The Complete Guide to Linux System Administration

32 To use this command, determine the code letter for the attributes you want to add or remove from a file. Use a plus sign ( + ) or minus sign ( - ), respectively, to add or remove those attributes. To assign the entire set of attributes for a file, use an equals sign. (The use of ( + ), ( - ), and ( = ) for chattr is very similar to their use as part of the chmod command.) You can add the -R option to make your action recursive to the contents of all subdirectories in the named directory if you are setting attributes for multiple files The Complete Guide to Linux System Administration

33 The Complete Guide to Linux System Administration

34 For example, to change the attributes of a file named timesheet to be immutable (unchange-able), you can use this command: # chattr +i timesheet To cause all files in a directory and its subdirectories to not have their atime field updated when they are accessed, you can use this command: # chattr -R +A * The Complete Guide to Linux System Administration

35 Checking File Systems fsck utility
Checks integrity of file systems (making certain that each inode is correctly linked to a file, that the blocks of each file can be found) 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 The Complete Guide to Linux System Administration

36 Creating New File Systems
Adding file system means Adding hard disk device to your system Making hard disk available to Linux by: Formatting Mounting The Complete Guide to Linux System Administration

37 Using 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 The Complete Guide to Linux System Administration

38 Using the fdisk Utility (continued)
The Complete Guide to Linux System Administration

39 Using the fdisk Utility (continued)
The Complete Guide to Linux System Administration

40 Formatting 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 The Complete Guide to Linux System Administration

41 Formatting File Systems (continued)
fdformat command Format 3.5-inch disks gfloppy Graphical removable disk formatter tune2fs utility Examine superblock of file system Make minor changes to file system parameters Use tune2fs with the -l option (for "list") to show the superblock of a file system: # tune2fs -l /dev/hda1 I less The Complete Guide to Linux System Administration

42 Mounting 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: # mkdir /archive # mount -t ext3 /dev/sdb2 /archive This mount command says: mount a file system of type ext3 located on the device /dev/sdb2, and make it accessible at the directory /archive Now when you go to the /archive directory, you see a subdirectory called lost+found. The Complete Guide to Linux System Administration

43 Mounting New File Systems (continued)
lost+found 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 The Complete Guide to Linux System Administration

44 Using 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 The Complete Guide to Linux System Administration

45 Using Networked File Systems (continued)
Networked file systems normally accessed using Network file system (NFS) protocol Server message block (SMB) protocol A system administrator might tell you, for example, that you have access to a networked file system via NFS that is located on the server named glasgow in the directory /doc_archive. You decide to mount that file system on your computer in the subdirectory /glasgow_docs, which you have already created using mkdir. You can then mount the networked file system using this command, entering the password given to you by the administrator if prompted (a password is usually not needed) : # mount -t nfs glasgow:/doc_archive /glasgow_docs The Complete Guide to Linux System Administration

46 Automating 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 override any listed in /etc/fstab. Example: mount –t ext3 –o defaults /dev/sdb2 /archive The Complete Guide to Linux System Administration

47 Using 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 The Complete Guide to Linux System Administration

48 Using the autofs Mounting Service (continued)
autofs service Example: Mounting /misc directory / misc add this line to the /etc/auto.master file Create /etc/auto.misc file Contains options to use when autofs mounts file system to /misc The Complete Guide to Linux System Administration

49 it knows about the mount points it should watch for.
After making changes to the /etc/auto.master file , you must restart the autofs server so that it knows about the mount points it should watch for. Use this command the first time you add an entry to /etc/auto.master: # service autofs start Use this command if you add more mount points or remove mount points from the file / etc/ auto. master: # service autofs reload The Complete Guide to Linux System Administration

50 Managing Swap Space mkswap command
Format partition set up using fdisk as swap space Example # mkswap /dev/hda2 add a line to /etc/fstab to tell Linux how to activate the swap space at boot time /dev/hda3 swap swap defaults 0 0 Swap space is activated by the Swapon command within the system initialization scripts in /etc/rc.d The Complete Guide to Linux System Administration

51 Setting 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 by including the usrquota or grpquota option when the file system is mounted (for example, include it within the /etc/fstab file). Use the edquota command to establish quota for users or groups Activate quota system using the quotaon command. Review current disk usage for file system using the repquota command, or for a particular user or group using the quota command The Complete Guide to Linux System Administration

52 A similar feature lets you impose additional limits on the actions of users.
The ulimit command is part of the bash shell. By adding this command to a user's startup script (for example, in /home/nwells/.profile), you can limit the system resources that the user can access from that shell. Resources that you can control via the ulimit command include the number of processes running concurrently, the amount of virtual memory used, the amount of file system storage consumed, and the number of seconds of CPU time that can be used. To see the current state of these values use this command: $ ulimit -a You can change your own values using additional ulimit commands, so this method is not appropriate to restrict the activities of advanced users, but it is sufficient to set basic resource limits for regular users. As an example, the following command sets a limit on the file system space that can be consumed (new files created) by the shell to one megabyte (1024 blocks): $ ulimit -f 1024 Using disk quotas and the ulimit command is a type of file system accounting. These features let you control and monitor usage of file system resources by users. The Complete Guide to Linux System Administration

53 Summary Software packages are single files that contain all files and instructions needed to install application or collection of utilities RHN service permits automatic updating of operating system files over Internet Information about ext3 file system is stored in superblock etc/fstab file contains list of all file systems that system mounts at boot time The Complete Guide to Linux System Administration

54 Summary (continued) /df and du commands watch how disk space is being used fsck utility examines file system to see that contents have not been corrupted fdisk utility configures partition data on hard disk The Complete Guide to Linux System Administration

55 Summary (continued) Linux supports networked file systems
autofs service automatically mounts file systems whenever user enters named directory Disk quotas configured using edquota command The Complete Guide to Linux System Administration


Download ppt "Chapter 10: Managing Software Packages and File Systems"

Similar presentations


Ads by Google