Upload
others
View
0
Download
0
Embed Size (px)
Citation preview
Ten Cool Things To Do with Fedora Linux 14Just because Fedora is a serious operating system doesn’t mean it can’t be fun too. Here is a list of ten fun and useful things to do with Fedora:
1. Launch Fedora 14 live on your PC: Insert the live CD that comes with this book, reboot, and start using Fedora from nearly any PC. Fedora won’t touch the contents of your computer unless you tell it to. If you like Fedora, click the Install button to install Fedora to your hard disk. (See Chapter 2.)
2. Customize your Desktop: Not only does Linux support multiple desktop environ‑ments, including GNOME, KDE, Xfce, and Moblin, you can customize the look and feel of each desktop environment. (See Chapter 3.)
3. Run thousands of applications: From the offiical Fedora repository to a boatload of other repositories, you can choose from literally thousands of free applications, includ‑ing hundreds of games. (See Chapter 5.)
4. Get online: Get on the Internet using the Network Manager and then browse the Web, send e‑mail, chat, and even video conference. Share files using FTP or BitTorrent swarming network transfer software. (See Chapter 8.)
5. Manage music collections: Launch Rhythmbox to gather, organize, and play music from your hard disk, CDs, or network file systems. Try new ways for streaming audio and video. (See Chapter 7.)
6. Publish your ideas: Choose from dozens of publishing tools to create documents (OpenOffice.org Writer), hard‑copy page layouts (Scribus), and vector graphics (Inkscape). (See Chapter 6.)
7. Share an Internet connection, securely: Fedora can be set up as a router and a fire‑wall. With a home or small office LAN setup, you can use Fedora to share an Internet connection among multiple Linux, Windows, or Mac systems. Then set up a firewall in Fedora to protect your LAN from intruders. (See Chapters 13, 14, and 15.)
8. Run Windows applications, or Windows itself: By adding the wine software pack‑ages, you can run many Windows applications right from a Fedora desktop. (See Chapter 5.) Use virtualization to run Windows, Unix, or other versions of Linux on your same PC. (See Chapter 23.)
9. Create a home server: Learn to configure a mail server (Chapter 18), FTP server (Chapter 19), and Web server (Chapter 20). You can share printers, disks, and other resources to all your home computers.
10. Create presentations: Start up OpenOffice.org Impress to create presentations from scratch or using templates. Tailor presentations to display as slide shows, view on screen, or print on paper. (See Chapter 6.)
Christopher Negus
Eric Foster-Johnson
Fedora® Bible2011 Edition
Featuring Fedora® Linux® 14
Fedora® Bible 2011 Edition: Featuring Fedora® Linux® 14
Published by Wiley Publishing, Inc. 10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com
Copyright © 2011 by Wiley Publishing, Inc., Indianapolis, Indiana
Published simultaneously in Canada
ISBN: 978‑0‑470‑94496‑7ISBN: 978‑1‑118‑08569‑1 (ebk)ISBN: 978‑1‑118‑08573‑8 (ebk)ISBN: 978‑1‑118‑08570‑7 (ebk)
Manufactured in the United States of America
10 9 8 7 6 5 4 3 2 1
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per‑copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750‑8400, fax (978) 646‑8600. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748‑6011, fax (201) 748‑6008, or online at http://www.wiley.com/go/permissions.
Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or promotional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional ser‑vices. If professional assistance is required, the services of a competent professional person should be sought. Neither the publisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Web site is referred to in this work as a citation and/or a potential source of further information does not mean that the author or the publisher endorses the information the organization or website may provide or recommendations it may make. Further, readers should be aware that Internet websites listed in this work may have changed or disappeared between when this work was written and when it is read.
For general information on our other products and services please contact our Customer Care Department within the United States at (877) 762‑2974, outside the United States at (317) 572‑3993 or fax (317) 572‑4002.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be avail‑able in electronic books.
Library of Congress Control Number: 2011921771
Trademarks: Wiley and the Wiley logo are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in the United States and other countries, and may not be used without written permission. Red Hat and Fedora are trademarks or registered trademarks of Red Hat, Inc. Linux is a registered trademark of Linus Torvalds. All other trademarks are the property of their respective owners. Wiley Publishing, Inc. is not associated with any prod‑uct or vendor mentioned in this book.
As always, I dedicate this book to my wife, Sheree. This book would never have happened without her love and support.
— Christopher Negus
To Katya and Nalana — Eric Foster-Johnson
About the AuthorsChristopher Negus has been working with Unix systems, the Internet, and (most recently) Linux systems for more than two decades. During that time, Chris worked at AT&T Bell Laboratories, Unix System Laboratories, and Novell, helping to develop the Unix operating sys‑tem. Features from many of the Unix projects Chris worked on at AT&T have found their way into Red Hat Enterprise Linux, Fedora, and other Linux systems.
Chris is the author of all editions of what started out as the Red Hat Linux Bible, which because of the name changes of Red Hat’s Linux projects has evolved into the book you are holding. Most recently, Chris co‑authored multiple books in the Linux Toolbox series: Fedora Linux Toolbox, Ubuntu Linux Toolbox, Mac OS X UNIX Toolbox, SUSE Linux Toolbox, and BSD UNIX Toolbox (Wiley Publishing). Besides that, Chris authored the Linux Bible 2009 Edition and co‑wrote the Fedora Bible 2010 Edition, CentOS Bible, Linux Troubleshooting Bible, and Linux Toys II for Wiley Publishing. Chris also authored Live Linux CDs and co‑authored the Official Damn Small Linux Book, as part of the Negus Software Solutions Series.
Today, Chris works as a Linux instructor for Red Hat, Inc. and has achieved certification as a Red Hat Certified Engineer (RHCE) and Red Hat Certified Examiner (RHCX). At home, Chris enjoys spending time with his wife, Sheree, and his boys, Caleb and Seth. His hobbies include soccer, singing, and exercising with Sheree.
Eric Foster-Johnson is a veteran programmer who works daily with Linux, Mac OS X, Unix, Windows and other operating systems. By day, he writes enterprise Grails and Java software for ObjectPartners, a Minnesota consulting firm. He has authored and co‑authored a number of Linux and Unix titles, including the Fedora Bible 2010 Edition, Red Hat RPM Guide, Teach Yourself Linux, Teach Yourself Unix, and Perl Modules.
About the Technical EditorJohn Kennedy has worked as a Linux and/or Unix System Administrator since 1997. He has experience with Red Hat, SUSE, Debian, and Solaris. John’s life is almost 100% free of propri‑etary operating systems. He currently lives near Oxford, England with his wife, Michele, and son, Kieran. His daughter, Denise, lives in the United States.
Acquisitions EditorMary James
Project EditorLinda Harrison
Technical EditorJohn Kennedy
Production EditorRebecca Anderson
Copy EditorLuann Rouff
Editorial DirectorRobyn B. Siesky
Editorial ManagerMary Beth Wakefield
Freelancer Editorial ManagerRosemarie Graham
Marketing ManagerAshley Zurcher
Production ManagerTim Tate
Vice President and Executive Group PublisherRichard Swadley
Vice President and Executive PublisherBarry Pruett
Associate PublisherJim Minatel
Project Coordinator, CoverKatie Crocker
CompositorJeff Wilson, Happenstance Type‑O‑Rama
ProofreadersScott Klemp, Word One New York Carrie Hunter, Word One New York
IndexerJ & J Indexing
Cover DesignerMichael E. Trent
Cover ImageJoyce Haughey
Credits
ix
A special acknowledgment goes to the people at Red Hat, Inc. and members of the Fedora Project. Each version of Fedora gets better and better, becoming easier and easier to install. With Fedora 13 and 14 (new since the last edition of this book), the easy printer
set up stands out as one of the best features in Fedora for a long time.
Tasks that used to be hard, such as graphics configuration, virtualization, and package manage‑ment, have now, for the most part anyway, become ancient history. This is due to the work of thousands all over the world improving Fedora in particular and Linux in general.
At Wiley, we’d like to thank Linda Harrison, Mary James, Carol Long, Luann Rouff, and Rebecca Anderson. A special shout‑out goes to Sara Shlaer, who helped in so many ways on this book for many years.
John Kennedy provided a thorough technical editing pass and came up with many great sugges‑tions to improve this book.
Finally, a special thanks goes to those of you who bought this and earlier editions of the Fedora and Red Hat Linux Bibles. Go out and become a force for Linux in your work, home, and community.
xi
Preface .....................................................................................................................................xxxiii
Part I: Getting Started in Fedora . . . . . . . . . . . . . . . . . . . . . . . . . 1Chapter 1: An Overview of Fedora .................................................................................................3Chapter 2: Installing Fedora .........................................................................................................21Chapter 3: Getting Productive with the Desktop .........................................................................75Chapter 4: Using Linux Commands ........................................................................................... 103
Part II: Using Fedora . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149Chapter 5: Accessing and Running Applications ........................................................................151Chapter 6: Working in a Linux Office ........................................................................................203Chapter 7: Music, Video, and Images in Linux ........................................................................... 217Chapter 8: Using the Internet and the Web ................................................................................265
Part III: Administering Fedora . . . . . . . . . . . . . . . . . . . . . . . . . 305Chapter 9: Understanding System Administration .....................................................................307Chapter 10: Setting Up and Supporting Users ............................................................................363Chapter 11: Automating System Tasks .......................................................................................397Chapter 12: Backing Up and Restoring Files .............................................................................. 435Chapter 13: Computer Security Issues .......................................................................................467
Part IV: Fedora Network and Server Setup . . . . . . . . . . . . . . . . 523Chapter 14: Setting Up Network Connections ...........................................................................525Chapter 15: Connecting to the Internet......................................................................................577Chapter 16: Setting Up Printers and Printing.............................................................................607Chapter 17: Setting Up a File Server ........................................................................................... 619Chapter 18: Setting Up a Mail Server ......................................................................................... 655Chapter 19: Setting Up an FTP Server .......................................................................................683Chapter 20: Setting Up a Web Server .........................................................................................695Chapter 21: Setting Up a DHCP Server ...................................................................................... 745Chapter 22: Setting Up a MySQL Database Server .....................................................................759Chapter 23: Setting Up Virtual Servers ......................................................................................793
Appendix: About the Media .......................................................................................................809
Index .......................................................................................................................................... 811
xiii
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxiii
Part I: Getting Started in Fedora 1
Chapter 1: An Overview of Fedora . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3Introducing Fedora 14 ..........................................................................................................4What Is Linux? .....................................................................................................................5Linux’s Roots in Unix ...........................................................................................................6Common Linux Features ......................................................................................................7Primary Advantages of Linux ...............................................................................................9What Is Fedora? ..................................................................................................................10
Red Hat forms the Fedora Project .............................................................................10Red Hat shifts to Red Hat Enterprise Linux ..............................................................12Choosing between Fedora and Enterprise ................................................................12
Why Choose Fedora? ..........................................................................................................13New Features in Fedora 13 and 14 .....................................................................................15
Automatic print driver installation ...........................................................................16NetworkManager improvements ...............................................................................16Better support for small devices ................................................................................16
Getting Fedora Software and Spins ....................................................................................16RPMfusion.org third‑party software repository ........................................................16Getting custom Fedora spins .................................................................................... 17Creating your own spins ........................................................................................... 17
The Culture of Free Software ..............................................................................................18Summary ............................................................................................................................19
Chapter 2: Installing Fedora . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21Understanding Fedora Installation Media ..........................................................................22Using the Fedora 14 Live CD ..............................................................................................22Quick Installation...............................................................................................................24Detailed Installation Instructions .......................................................................................26
Choosing an installation method ..............................................................................27Install or upgrade? ..........................................................................................27From DVD, network, or hard disk? ................................................................28
Preparing for installation using the live CD ..............................................................30Displaying hardware information ................................................................... 31Testing your hardware ....................................................................................32
xiv
Contents
Beginning the installation .........................................................................................33Running Fedora Firstboot .........................................................................................39Going forward after installation ................................................................................ 41
Special Installation Procedures ...........................................................................................42Alternatives for starting installation..........................................................................42
Booting installation from hard disk ................................................................42Booting installation from a USB device ...........................................................43Booting installation using PXE .......................................................................44Booting installation using boot.fedoraproject.org ...........................................45
Installing from other media ......................................................................................45Beginning installation .....................................................................................45Setting up an HTTP, FTP, or NFS install server ..............................................46
Starting a VNC install ...............................................................................................48Performing a kickstart installation ...........................................................................48
Creating the kickstart file ...............................................................................49Installing the kickstart file ..............................................................................53Booting a kickstart installation .......................................................................53
Special Installation Topics ..................................................................................................54Setting up to dual‑boot Linux and Windows ............................................................54
Resizing your Windows partitions ..................................................................54Using Windows partitions from Linux ...........................................................56
Partitioning your disks .............................................................................................58Partitioning with Disk Setup during installation ............................................58Partitioning with fdisk ....................................................................................62Tips for creating partitions ..............................................................................63
Installing Fedora on an Intel‑based Mac ...................................................................65Before installing Fedora on your Mac ..............................................................65Installing Fedora ............................................................................................66
Using the GRUB boot loader .....................................................................................67Temporarily changing boot options ................................................................68Permanently changing boot options ...............................................................69Adding a new GRUB boot image .....................................................................70
Troubleshooting Installation ...............................................................................................71Spinning Your Own Fedora Install or Live Media .............................................................73Summary ............................................................................................................................ 74
Chapter 3: Getting Productive with the Desktop . . . . . . . . . . . . . . . . . . .75Logging in to Fedora .........................................................................................................76Getting Familiar with the Desktop .....................................................................................78
Touring your desktop ...............................................................................................79Getting more desktop space with virtual workspaces ...............................................79
Using the GNOME Desktop ...............................................................................................80Launching applications from the top bar ..................................................................80Switching windows from the bottom bar ..................................................................81Browsing files ...........................................................................................................81
xv
Contents
Customizing the desktop ..........................................................................................83Modifying the GNOME panels .......................................................................84Adding an application launcher ......................................................................84Adding an applet .............................................................................................85Adding another panel .....................................................................................86Adding a drawer .............................................................................................86Changing panel properties ..............................................................................87
Using the Metacity window manager ........................................................................87Switching to another user .........................................................................................88Exiting GNOME .......................................................................................................88
Switching Desktop Environments ......................................................................................89Using the KDE Desktop .....................................................................................................89
Launching applications ............................................................................................. 91Switching windows from the bottom bar ..................................................................92Using virtual desktops ..............................................................................................92Managing files with Dolphin and Konqueror ...........................................................92
Working with files ..........................................................................................93Searching for files with Dolphin and kfind .....................................................94Using Konqueror .............................................................................................95
Customizing the KDE desktop ..................................................................................95Adding widgets .........................................................................................................95
Adding widgets to the panel ...........................................................................96Adding widgets to the desktop ........................................................................96
Using the Xfce Desktop Environment ................................................................................96Using the Moblin Desktop ..................................................................................................97Using the MeeGo Desktop ..................................................................................................97Running 3D Accelerated Desktop Effects ...........................................................................98Troubleshooting Your Desktop ..........................................................................................99
GUI doesn’t work at startup ......................................................................................99Tuning your video card and monitor ...................................................................... 101Getting more information ....................................................................................... 101
Summary .......................................................................................................................... 101
Chapter 4: Using Linux Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103Understanding the Shell ...................................................................................................104The Shell Interface ............................................................................................................104
Checking your login session ...................................................................................105Checking directories and permissions ....................................................................106Checking system activity ........................................................................................108Exiting the shell ......................................................................................................109
Using the Shell in Linux ...................................................................................................109Locating commands ............................................................................................... 110Rerunning commands ............................................................................................ 113
Command‑line editing .................................................................................. 113Command‑line completion ........................................................................... 116Command‑line recall .................................................................................... 117
xvi
Contents
Connecting and expanding commands .................................................................. 119Piping commands ......................................................................................... 119Sequential commands ...................................................................................120Background commands ................................................................................120Expanding commands ..................................................................................120Expanding arithmetic expressions ................................................................121
Using shell environment variables .........................................................................121Common shell environment variables ...........................................................121Setting your own environment variables .......................................................123
Managing background and foreground processes ...................................................124Starting background processes .....................................................................125Moving commands to the foreground and background ...............................126
Configuring your shell ............................................................................................127Setting your prompt ......................................................................................128Adding environment variables ......................................................................129Adding aliases ...............................................................................................130
Working with the Linux File System ................................................................................130Creating files and directories ..................................................................................132
Using metacharacters and operators .............................................................134Using file‑matching metacharacters ..............................................................134Using file‑redirection metacharacters ............................................................136Understanding file permissions ....................................................................136
Moving, copying, and deleting files ........................................................................138Using Text Editors ............................................................................................................139
Using the vi text editor ...........................................................................................140Starting with vi .............................................................................................140Moving around the file .................................................................................. 143Searching for text .......................................................................................... 143Using numbers with commands ...................................................................144
Using graphical text editors and notepads ..............................................................144Working with Virtual Terminals ...................................................................................... 145
Switching terminals with the screen program ........................................................146Summary .......................................................................................................................... 147
Part II: Using Fedora 149
Chapter 5: Accessing and Running Applications . . . . . . . . . . . . . . . . . . 151Getting and Installing Software Packages .........................................................................152
Downloading and installing applications with yum ...............................................153Configuring yum (/etc/yum.conf) ................................................................154Adding yum repositories (/etc/yum.repos.d/) ...............................................156Running yum to download and install RPMs ...............................................157Using yum to install packages locally ...........................................................158Using yum for listing packages .....................................................................159Removing packages with yum ......................................................................159Using the yum‑utils package .........................................................................160
xvii
Contents
Getting Fedora software updates ............................................................................160Being alerted to available updates .................................................................160Getting manual updates with yum ............................................................... 161
Managing RPM Packages .................................................................................................. 162Using the PackageKit Add/Remove window ........................................................... 162Using the rpm command ........................................................................................164
Verifying rpm package integrity ................................................................... 165Installing with rpm .......................................................................................166Upgrading packages with rpm ......................................................................168Freshening packages with rpm .....................................................................169Removing packages with rpm .......................................................................169Querying packages with rpm ........................................................................ 170Verifying installed packages with rpm .......................................................... 173
Using RPM in rescue mode ..................................................................................... 174Using Software in Different Formats ................................................................................ 174
Understanding software package names and formats ............................................. 175Using different archive and document formats ....................................................... 177Building and installing from source code ............................................................... 179
Installing software in SRPM format .............................................................. 179Installing software in tar.gz or tar.bz2 formats ..............................................180
Using Fedora to Run Applications .................................................................................... 181Finding common desktop applications in Linux ....................................................183Investigating your desktop ......................................................................................185Starting applications from a menu ..........................................................................185Starting applications from a Run Application window ............................................185Starting applications from GNOME Do ..................................................................186Starting applications from a Terminal window .......................................................187Running remote X applications ...............................................................................188
Traditional method to run remote X applications .........................................189Launching a remote X application .................................................................190Using user‑based security .............................................................................192Using SSH to run remote X applications .......................................................193
Running Microsoft Windows and DOS Applications .......................................................194Running DOS applications .....................................................................................195
Using mtools .................................................................................................195Using DOSBox ..............................................................................................196
Running Microsoft Windows applications in Linux ...............................................197Running Windows Applications with WINE ..........................................................198
Assigning drive letters...................................................................................199Installing applications in WINE ...................................................................200Launching applications .................................................................................200Tuning and configuring WINE ..................................................................... 201Finding more Windows applications for WINE ............................................202
Summary ..........................................................................................................................202
xviii
Contents
Chapter 6: Working in a Linux Office . . . . . . . . . . . . . . . . . . . . . . . . . . . 203Running the OpenOffice.org Suite ...................................................................................203Using Writer .....................................................................................................................207Other Office Applications .................................................................................................207
AbiWord .................................................................................................................207KOffice ....................................................................................................................208TextMaker...............................................................................................................208GNUmeric ..............................................................................................................208
Displaying PDF Files .......................................................................................................208Using Traditional Linux Publishing Tools ........................................................................209
Creating Documents in Groff or LaTeX................................................................... 210Text processing with Groff ............................................................................ 210Formatting and printing documents with Groff ........................................... 211Text processing with TeX/LaTeX ..................................................................212Creating and formatting a LaTeX document .................................................212
Creating DocBook documents ................................................................................212Doing Page Layout with Scribus .......................................................................................213Working with Graphics .................................................................................................... 214
Manipulating images with GIMP ............................................................................ 214Taking screen captures ........................................................................................... 214Creating vector graphic images with Inkscape .......................................................215
Using Scanners Driven by SANE ...................................................................................... 216Summary .......................................................................................................................... 216
Chapter 7: Music, Video, and Images in Linux . . . . . . . . . . . . . . . . . . . . 217Understanding Multimedia and Legal Issues in Linux ..................................................... 217Extending Freedom to Codecs ......................................................................................... 218Listening to Music in Linux .............................................................................................. 219
Configuring a sound card .......................................................................................221Sound card features ......................................................................................221Detecting your sound card driver .................................................................223Adjusting sound levels ..................................................................................224Setting your sound card to record .................................................................225
Choosing audio players ...........................................................................................225Automatically playing CDs ....................................................................................226Playing and managing music with Rhythmbox .....................................................227Playing music with XMMS Audio Player ................................................................230
Using the Equalizer .......................................................................................232Using the Playlist Editor ................................................................................232
Using ogg123, mpg321, and play command‑line players ........................................233Using MIDI audio players .......................................................................................234Converting audio files with SoX .............................................................................235Extracting and encoding music ..............................................................................236
Extracting music CDs with Sound Juicer ......................................................236Extracting and encoding music CDs from commands ..................................238
xix
Contents
Creating your own music CDs ................................................................................239Creating audio CDs with cdrecord ................................................................239Creating audio and data CDs with K3b ........................................................240Creating audio and data CDs with Brasero ................................................... 242
Viewing TV, Video Conferencing, and Using Webcams ................................................. 243Watching TV with tvtime ....................................................................................... 243
Getting a supported TV card .........................................................................244Starting tvtime .............................................................................................. 245Selecting channels in tvtime .........................................................................246
Video conferencing and VOIP with Ekiga ...............................................................246Getting a supported webcam ........................................................................246Running Ekiga .............................................................................................. 247
Taking webcam videos and snapshots with Cheese ................................................248Playing Video ...................................................................................................................249
Examining laws affecting video and Linux .............................................................250Understanding video content types ........................................................................251Watching video with Xine ......................................................................................252
Using Xine ....................................................................................................254Creating playlists with Xine ..........................................................................254Xine tips ........................................................................................................255
Using Totem movie player ......................................................................................256Using a Digital Camera ....................................................................................................257
Displaying images in Fedora ...................................................................................258Using your camera as a storage device ....................................................................259
Playing Games on Linux...................................................................................................260Jumping into Linux gaming ....................................................................................261Basic Linux gaming information .............................................................................263
Summary ..........................................................................................................................263
Chapter 8: Using the Internet and the Web . . . . . . . . . . . . . . . . . . . . . . 265Overview of Internet Applications and Commands ..........................................................265Browsing the Web ............................................................................................................267
Browsing the Web with Firefox...............................................................................268Setting up Firefox ...................................................................................................272
Setting preferences ........................................................................................272Extending Firefox ......................................................................................... 274Changing Firefox themes .............................................................................. 276Securing Firefox ............................................................................................ 276Tips for using Firefox ....................................................................................277
Browsing the Web with Chrome ............................................................................. 278Installing Chromium .................................................................................... 279Running Chromium ...................................................................................... 279
Using text‑based Web browsers ..............................................................................280Communicating with E‑mail ............................................................................................281
Using Evolution e‑mail ...........................................................................................282Setting Evolution preferences ........................................................................284
xx
Contents
Receiving, composing, and sending e‑mail ...................................................284Using Evolution to manage your schedule and contacts ................................285Connecting to Microsoft Exchange servers ...................................................285
Thunderbird mail client ..........................................................................................286Text‑based mail programs ......................................................................................287Mail readers and managers .....................................................................................288
Mutt mail reader ...........................................................................................288Mail reader ....................................................................................................288
Participating in Newsgroups .............................................................................................289Instant Messaging .............................................................................................................289
Instant messaging with Pidgin ...............................................................................289Using other instant message clients ........................................................................ 291
Sharing Files with BitTorrent ............................................................................................ 291Using Remote Login, Copy, and Execution ......................................................................292
Getting files with FTP .............................................................................................292Using the lftp command ...............................................................................293Using the ncftp command .............................................................................295Using the gFTP window................................................................................297
Getting files with wget ............................................................................................299Downloading a single file ..............................................................................299Downloading a file with user name and password .......................................300Downloading a whole website .......................................................................300Continuing a download ................................................................................301
Using ssh for remote login/remote execution ..........................................................301Using scp for remote file copy .................................................................................302Using the “r” commands: rlogin, rcp, and rsh .........................................................302
Summary ..........................................................................................................................303
Part III: Administering Fedora 305
Chapter 9: Understanding System Administration . . . . . . . . . . . . . . . . . 307Using the root user Account .............................................................................................308Becoming the Super User: The su Command ...................................................................308Learning About Administrative GUI Tools, Commands, Configuration Files,
and Log Files ............................................................................................................... 310Using graphical administration tools ...................................................................... 310Administrative commands ...................................................................................... 314Administrative configuration files .......................................................................... 314Administrative log files ........................................................................................... 318Using other administrative logins ........................................................................... 318
Understanding administrative logins ............................................................ 319Using sudo to assign administrative privilege ............................................... 319Using PolicyKit for assigning administrative privilege .................................. 321
Administering Your Linux System ....................................................................................322
xxi
Contents
Configuring Hardware .....................................................................................................322Checking your hardware ........................................................................................323Managing hardware with the DeviceKit .................................................................323Configuring modules .............................................................................................. 324
Listing loaded modules ................................................................................. 324Loading modules ..........................................................................................325Removing modules .......................................................................................326
Managing File Systems and Disk Space ............................................................................326Mounting file systems .............................................................................................329
Supported file systems ..................................................................................330Using the fstab file to define mountable file systems .....................................332Using the mount command to mount file systems ........................................334Using the umount command to unmount a file system ................................337
Using the mkfs command to create a file system ....................................................338Adding a hard disk .................................................................................................339Using RAID disks ...................................................................................................341Checking system space ...........................................................................................343
Checking disk space with Disk Usage Analyzer ............................................343Displaying system space with df ...................................................................343Checking disk usage with du ........................................................................345Finding disk consumption with find ............................................................345
Monitoring System Performance .......................................................................................346Watching computer usage with System Monitor .....................................................346Monitoring CPU usage with top ............................................................................347Monitoring power usage on laptop computers ........................................................348
Using the GNOME Power Manager applet ....................................................349Using apm to enter suspend mode ................................................................350Using acpi_listen to monitor ACPI events .....................................................350
Fixing Your System with the FirstAidKit .......................................................................... 351Choosing Software Alternatives ........................................................................................352
Selecting Java alternatives .......................................................................................352Selecting mail alternatives ......................................................................................352Using mail alternatives ...........................................................................................353
Using Security Enhanced Linux .......................................................................................353Types and roles in SELinux ....................................................................................354Users in SELinux .................................................................................................... 355Policies in SELinux ................................................................................................. 355Tools in SELinux.....................................................................................................356Using SELinux in Fedora .......................................................................................356Getting SELinux ....................................................................................................357Checking whether SELinux is on ............................................................................357Checking SELinux status ........................................................................................358Working with SELinux on a server .........................................................................360Learning more about SELinux ................................................................................361
Summary ..........................................................................................................................361
xxii
Contents
Chapter 10: Setting Up and Supporting Users . . . . . . . . . . . . . . . . . . . . 363Creating User Accounts ....................................................................................................363
Adding users with useradd .....................................................................................364Adding users with the Account Information dialog ................................................369Adding users with User Manager ............................................................................ 370
Setting User Defaults ........................................................................................................373Supplying initial login scripts ................................................................................. 376Supplying initial .bashrc and .bash_profile files ..................................................... 376Supplying an initial .tcshrc file ...............................................................................377Configuring system‑wide shell options ...................................................................378
Configuring system‑wide bash options .........................................................378Configuring system‑wide tcsh options ..........................................................378
Setting system profiles ............................................................................................378Adding user accounts to servers .............................................................................379
Creating Portable Desktops ..............................................................................................380Providing Support to Users ..............................................................................................381
Creating a technical support mailbox .....................................................................382Resetting a user’s password.....................................................................................382
Modifying Accounts .........................................................................................................383Modifying user accounts with usermod .................................................................383Modifying user accounts with User Manager ..........................................................386
Deleting User Accounts ....................................................................................................387Deleting user accounts with userdel .......................................................................387Deleting user accounts with User Manager .............................................................388
Checking Disk Quotas .....................................................................................................388Using quota to check disk usage .............................................................................389
Editing the /etc/fstab file ...............................................................................389Creating quota files .......................................................................................390Creating a quota startup script .....................................................................390Turning on the quota startup script .............................................................. 391Creating quota rules .....................................................................................392Updating quota settings ................................................................................393Checking quotas ...........................................................................................393
Using du to check disk use .....................................................................................393Removing temp files automatically .........................................................................394
Sending Mail to All Users .................................................................................................394Summary ..........................................................................................................................396
Chapter 11: Automating System Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . 397Understanding Shell Scripts .............................................................................................397
Executing and debugging shell scripts....................................................................398Understanding shell variables .................................................................................399
Special shell variables ...................................................................................400Parameter expansion in bash ........................................................................401
Performing arithmetic in shell scripts .....................................................................402
xxiii
Contents
Using programming constructs in shell scripts ......................................................403The “if...then” statements ..............................................................................403The case command ......................................................................................406The “for...do” loop .........................................................................................407The “while...do” and “until...do” loops ..........................................................408
Some useful external programs ..............................................................................409The general regular expression parser (grep) ................................................409Remove sections of lines of text (cut) ............................................................409Translate or delete characters (tr) .................................................................. 410The Stream Editor (sed) ................................................................................ 410
Trying some simple shell scripts ............................................................................. 411A simple telephone list .................................................................................. 411A simple backup script.................................................................................. 412
Initializing the System ...................................................................................................... 413Starting init............................................................................................................. 413
Starting Up and Shutting Down the System ..................................................................... 416Starting run‑level scripts ........................................................................................ 416Understanding run‑level scripts ............................................................................. 416Understanding what startup scripts do ................................................................... 419Changing run‑level script behavior ........................................................................420Reorganizing or removing run‑level scripts ............................................................422Adding run‑level scripts .........................................................................................423Managing xinetd services .......................................................................................425Manipulating run levels ..........................................................................................426
Determining the current run level ................................................................426Changing to a shutdown run level ................................................................426
Scheduling System Tasks .................................................................................................. 427Using at.allow and at.deny ...................................................................................... 427Specifying when jobs are run ................................................................................. 427Submitting scheduled jobs ......................................................................................428Viewing scheduled jobs ..........................................................................................429Deleting scheduled jobs ..........................................................................................429Using the batch command ......................................................................................430Using the cron facility .............................................................................................430
Modifying scheduled tasks with crontab ...................................................... 432Understanding cron files ............................................................................... 433
Summary ..........................................................................................................................434
Chapter 12: Backing Up and Restoring Files . . . . . . . . . . . . . . . . . . . . . . 435Making a Simple Backup Archive ..................................................................................... 435
Doing a simple backup with déjà‑dup ....................................................................436Doing a simple backup with rsync .........................................................................438
Backing up files locally .................................................................................439Backing up files remotely ..............................................................................440
Choosing Backup Tools ....................................................................................................441
xxiv
Contents
Selecting a Backup Strategy ..............................................................................................442Full backup.............................................................................................................442Incremental backup ................................................................................................443Disk mirroring ........................................................................................................443Network backup .....................................................................................................443
Selecting a Backup Medium..............................................................................................444Magnetic tape .........................................................................................................445
Using ftape tools for magnetic tape ...............................................................445Testing the magnetic tape drive ....................................................................446
Writable DVD and CD drives .................................................................................446Getting cdrecord for writable DVDs ..............................................................446Writing to DVDs ...........................................................................................447Writing CD or DVDs with growisofs ............................................................450
Backing Up to a Hard Drive ............................................................................................. 451Backing Up Files with dump ............................................................................................452Automating Backups with cron ........................................................................................454Restoring Backed‑Up Files ................................................................................................456
Restoring an entire file system ................................................................................457Configuring Amanda for Network Backups ......................................................................458
Creating Amanda directories ..................................................................................459Creating the amanda.conf file .................................................................................459Creating a disklist file .............................................................................................461Adding Amanda network services ..........................................................................462
On the Amanda server ..................................................................................462On each Amanda client .................................................................................463
Performing an Amanda backup ..............................................................................463Using the pax Archiving Tool ...........................................................................................464Summary ..........................................................................................................................465
Chapter 13: Computer Security Issues . . . . . . . . . . . . . . . . . . . . . . . . . . 467Linux Security Checklist ..................................................................................................467Using Password Protection ............................................................................................... 470
Choosing good passwords ...................................................................................... 470Using a shadow password file ................................................................................. 471
Breaking encrypted passwords .....................................................................472Checking for the shadow password file .........................................................472
Securing Linux with the iptables Firewall ........................................................................ 474Using the Firewall Configuration window .............................................................. 474Configuring an iptables firewall ............................................................................. 476
Turning on iptables .......................................................................................477Creating iptables firewall rules ..................................................................... 478Understanding iptables .................................................................................485Enhancing your iptables firewall ...................................................................487
Controlling Access to Services with TCP Wrappers .........................................................488Checking Log Files ...........................................................................................................490
xxv
Contents
Understanding the rsyslogd service ........................................................................491Redirecting logs to a loghost with rsyslogd ...................................................491Understanding the messages log file .............................................................493
Tracking log messages with logwatch .....................................................................494Using the Secure Shell Package ........................................................................................495
Starting the SSH service .........................................................................................495Using the ssh, sftp, and scp commands ..................................................................496Using ssh, scp, and sftp without passwords ............................................................498
Securing Linux Servers.....................................................................................................499Understanding attack techniques ...........................................................................500Protecting against denial‑of‑service attacks ............................................................501
Mailbombing .................................................................................................501Spam relaying ...............................................................................................502Smurf amplification attack ............................................................................503
Protecting against distributed DOS attacks ............................................................504Protecting against intrusion attacks ........................................................................508
Evaluating access to network services ...........................................................508Disabling network services ...........................................................................509
Securing servers with SELinux ............................................................................... 510Scanning for security problems with OpenSCAP ................................................... 511Protecting Web servers with certificates and encryption ....................................... 511
Symmetric cryptography............................................................................... 511Public‑key cryptography ...............................................................................512Secure Sockets Layer ....................................................................................512
Managing Identities with FreeIPA .................................................................................... 519Setting up the FreeIPA server ..................................................................................520Setting up FreeIPA clients .......................................................................................521
Summary ..........................................................................................................................521
Part IV: Fedora Network and Server Setup 523
Chapter 14: Setting Up Network Connections . . . . . . . . . . . . . . . . . . . . 525Connecting to the Network with NetworkManager ..........................................................526
Connecting to a wireless network ...........................................................................527Connecting to a wired network ..............................................................................529Using the NetworkManager command line ............................................................529Setting up a virtual private network connection ..................................................... 531
Understanding Local Area Networks ................................................................................532Planning, getting, and setting up LAN hardware ....................................................533
LAN equipment ............................................................................................534LAN equipment setup ...................................................................................535
Configuring TCP/IP for your LAN ..........................................................................535Identifying other computers (hosts and DNS) ...............................................539Adding Windows computers to your LAN ....................................................540
xxvi
Contents
Setting Up a Wireless LAN ...............................................................................................542Understanding wireless networks ...........................................................................542Choosing wireless hardware ...................................................................................544
Selecting wireless LAN cards ........................................................................545Loading nonfree drivers ................................................................................545Selecting antennas ........................................................................................546
Getting wireless drivers ..........................................................................................548Installing wireless Linux software ..........................................................................550Configuring the wireless LAN ................................................................................ 551
Configuring the wireless interface ................................................................552Checking your wireless connection .............................................................. 555
Setting wireless extensions .....................................................................................557Understanding Internet Protocol Addresses .....................................................................558
IP address classes....................................................................................................559Understanding netmasks ........................................................................................560Classless Inter‑Domain Routing ..............................................................................560Getting IP addresses ...............................................................................................562
Troubleshooting Your LAN ...............................................................................................563Did Linux find your Ethernet driver at boot time? ..................................................563Can you reach another computer on the LAN? .......................................................563Is your Ethernet connection up? .............................................................................564Troubleshooting a wireless LAN .............................................................................566
Checking wireless settings ............................................................................566Checking TCP/IP ..........................................................................................568Adapting to poor reception ...........................................................................569Using debugging tools ..................................................................................569
Watching LAN traffic with Wireshark ....................................................................570Starting Wireshark ........................................................................................570Capturing Ethernet data ...............................................................................571Interpreting captured Ethernet data .............................................................. 574
Summary ..........................................................................................................................575
Chapter 15: Connecting to the Internet . . . . . . . . . . . . . . . . . . . . . . . . . 577Connecting Your LAN to the Internet ..............................................................................577Setting Up Linux as a Router ............................................................................................578
Configuring the Linux router .................................................................................579Selecting IP addresses ...................................................................................579Enabling forwarding and masquerading .......................................................579
Configuring network clients ...................................................................................581Configuring a Virtual Private Network Connection .........................................................583
Understanding IPsec ...............................................................................................584Using IPsec protocols ..............................................................................................584Using IPsec in Fedora .............................................................................................585Configuring an OpenVPN Server ...........................................................................586
Before configuring OpenVPN .......................................................................587Creating a public key infrastructure .............................................................587
xxvii
Contents
Creating the OpenVPN server configuration.................................................590Creating the OpenVPN client configuration ................................................. 591Enhancing OpenVPN security with eurephia ...............................................592
Setting Up Linux as a Proxy Server .................................................................................592Starting the squid daemon ......................................................................................593Using a simple squid.conf file .................................................................................595Modifying the Squid configuration file ...................................................................596
Configuring access control in squid.conf ......................................................597Configuring caching in squid.conf ...............................................................599Configuring port numbers in squid.conf ......................................................600
Debugging Squid ....................................................................................................601Checking the squid.conf file .........................................................................601Checking Squid log files ...............................................................................601Using the top command ................................................................................602
Setting Up Proxy Clients ..................................................................................................602Configuring Firefox to use a proxy .........................................................................603Configuring other browsers to use a proxy .............................................................604
Summary ..........................................................................................................................604
Chapter 16: Setting Up Printers and Printing . . . . . . . . . . . . . . . . . . . . . 607Common Unix Printing Service .......................................................................................608Setting Up Printers ...........................................................................................................608
Using the Printer Configuration window ................................................................609Configuring local printers............................................................................. 610Configuring remote printers ........................................................................612
Using Printing Commands ............................................................................................... 614Using lpr to print ....................................................................................................615Listing status with lpc ............................................................................................ 615Removing print jobs with lprm............................................................................... 616
Configuring Print Servers................................................................................................. 616Configuring a shared CUPS printer ........................................................................ 616Configuring a shared Samba printer ....................................................................... 617
Understanding smb.conf for printing ............................................................ 618Summary .......................................................................................................................... 618
Chapter 17: Setting Up a File Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . 619Goals of Setting Up a File Server ...................................................................................... 619Setting Up an NFS File Server ..........................................................................................620
Sharing NFS file systems ........................................................................................ 621Using the NFS Server Configuration window ............................................... 621Configuring the /etc/exports file ................................................................... 624Exporting the shared file systems ................................................................. 627Starting the nfsd daemons ............................................................................628
Using NFS file systems ...........................................................................................628Manually mounting an NFS file system ........................................................629
xxviii
Contents
Automatically mounting an NFS file system .................................................630Using autofs to mount NFS file systems on demand .....................................633
Unmounting NFS file systems ................................................................................634Setting Up a Samba File Server .........................................................................................635
Getting and installing Samba..................................................................................636Configuring a simple Samba server ........................................................................636Configuring Samba with SWAT ..............................................................................639
Turning on SWAT ........................................................................................640Starting with SWAT ......................................................................................640Creating global Samba settings in SWAT ......................................................640Configuring shared directories with SWAT ..................................................645Checking your Samba setup with SWAT ......................................................647
Working with Samba files and commands ............................................................647Editing the smb.conf file ...............................................................................647Adding Samba users......................................................................................648Starting the Samba service ............................................................................649Testing your Samba permissions ...................................................................650Checking the status of shared directories .....................................................650
Setting up Samba clients ........................................................................................650Using Samba shared directories from Linux ................................................650
Troubleshooting your Samba server ........................................................................652Basic networking in place? ............................................................................652Samba service running? ................................................................................652Firewall or SELinux restricting access? .........................................................653User passwords working? ..............................................................................654
Summary ..........................................................................................................................654
Chapter 18: Setting Up a Mail Server . . . . . . . . . . . . . . . . . . . . . . . . . . . 655Introducing SMTP and sendmail ...................................................................................... 655Installing and Running sendmail .....................................................................................656
Starting sendmail....................................................................................................657Other programs ......................................................................................................658Logging performed by sendmail .............................................................................659
Configuring sendmail.......................................................................................................660Getting a domain name ..........................................................................................661Configuring basic sendmail settings (sendmail.mc) ...............................................661Defining outgoing mail access ...............................................................................665Configuring virtual servers .....................................................................................667Configuring virtual users .......................................................................................667Adding user accounts .............................................................................................668Starting sendmail and generating database files .....................................................669Redirecting mail .....................................................................................................670
The .forward file ........................................................................................... 670The aliases file...............................................................................................671
Introducing Postfix ..........................................................................................................672