Cover image for Ubuntu Hacks

Book description

Ubuntu Linux--the most popular Linux distribution on the planet--preserves the spirit embodied in the ancient African word ubuntu, which means both "humanity to others" and "I am what I am because of who we all are." Ubuntu won the Linux Journal Reader's Choice Award for best Linux distribution and is consistently the top-ranked Linux variant on DistroWatch.com. The reason this distribution is so widely popular is that Ubuntu is designed to be useful, usable, customizable, and always available for free worldwide.

Ubuntu Hacks is your one-stop source for all of the community knowledge you need to get the most out of Ubuntu: a collection of 100 tips and tools to help new and experienced Linux users install, configure, and customize Ubuntu. With this set of hacks, you can get Ubuntu Linux working exactly the way you need it to. Learn how to:

  • Install and test-drive Ubuntu Linux.

  • Keep your system running smoothly

  • Turn Ubuntu into a multimedia powerhouse: rip and burn discs, watch videos, listen to music, and more

  • Take Ubuntu on the road with Wi-Fi wireless networking, Bluetooth, etc.

  • Hook up multiple displays and enable your video card's 3-D acceleration

  • Run Ubuntu with virtualization technology such as Xen and VMware

  • Tighten your system's security

  • Set up an Ubuntu-powered server

Ubuntu Hacks will not only show you how to get everything working just right, you will also have a great time doing it as you explore the powerful features lurking within Ubuntu.

"Put in a nutshell, this book is a collection of around 100 tips and tricks which the authors choose to call hacks, which explain how to accomplish various tasks in Ubuntu Linux. The so called hacks range from down right ordinary to the other end of the spectrum of doing specialised things...More over, each and every tip in this book has been tested by the authors on the latest version of Ubuntu (Dapper Drake) and is guaranteed to work. In writing this book, it is clear that the authors have put in a lot of hard work in covering all facets of configuring this popular Linux distribution which makes this book a worth while buy." -- Ravi Kumar, Slashdot.org

Table of Contents

  1. Ubuntu Hacks
    1. SPECIAL OFFER: Upgrade this ebook with O’Reilly
    2. Credits
      1. About the Authors
      2. Contributors
      3. Acknowledgments
        1. Jonathan
        2. Kyle
        3. Bill
    3. Preface
      1. Why Ubuntu Hacks?
      2. How to Use This Book
      3. How This Book Is Organized
      4. Conventions Used in This Book
      5. Using Code Examples
      6. Safari Enabled
      7. How to Contact Us
      8. Got a Hack?
    4. 1. Getting Started
      1. Hack #1. Test-Drive Ubuntu
        1. Downloading the Live CD
        2. Booting the CD
        3. Another Use for the Live CD
      2. Hack #2. Get Help
        1. Web-Based Documentation
        2. Interactive Help and Support
        3. Traditional Pay-per-Incident Support
      3. Hack #3. Make Live CD Data Persistent
        1. Set the Label on Your USB Memory Stick
        2. Boot the Live CD in Persistent Mode
        3. Testing Persistence
        4. How It Works
      4. Hack #4. Customize the Ubuntu Live CD
        1. Basic Requirements
          1. Add extra swap
          2. Install the tools
          3. Standard Live CD
        2. Prepare Original Image
        3. Set Up the Target Filesystem
        4. Apply Customizations
          1. Delete unnecessary packages
          2. Install additional packages
          3. Customize the home directory
        5. Unmount Customized Image
        6. Repack the Filesystem
        7. Build the ISO
        8. Burn and Boot
        9. More Information and Scripts
      5. Hack #5. Install Ubuntu
        1. System Requirements
        2. Preserving Your Existing Data
        3. Getting the Installation CD
        4. Installing Ubuntu
      6. Hack #6. Dual-Boot Ubuntu and Windows
        1. Preparation
        2. Installation
      7. Hack #7. Move Your Windows Data to Ubuntu
        1. Make Sure You Notify the Post Office
          1. Transfer Outlook into Thunderbird
          2. Transfer your Thunderbird mail to Ubuntu
        2. Are You Bringing the Browser?
        3. Your Stuff, Your Music
        4. Your Little Black Book
        5. Am I Forgetting Anything?
        6. You Could Just Hire a Mover
      8. Hack #8. Install Ubuntu on a Mac
        1. Reinstall Mac OS X
        2. Install Ubuntu
      9. Hack #9. Set Up Your Printer
        1. GNOME CUPS Manager
        2. CUPS Web Interface
        3. Share Local Printers
        4. Apply Print Quotas
      10. Hack #10. Install Ubuntu on an External Drive
        1. Set Up the Partitions
        2. Install GRUB
        3. Use chroot
        4. Tweak initrd
        5. Update GRUB
      11. Hack #11. Install from a Network Boot Server
        1. Prepare the PXE Boot Server
          1. Configure DHCP
          2. Configure TFTP
        2. Boot the Client
      12. Hack #12. Submit a Bug Report
        1. Getting Ready to File the Bug
        2. Creating a Malone Account
        3. Searching for Your Bug
        4. Filing Your Bug Report
      13. Hack #13. Use the Command Line
        1. Navigate the Filesystem
        2. Rename and Delete Files and Directories
        3. File Globs and Tab Completion
      14. Hack #14. Get Productive with Applications
        1. Office Suite
        2. Graphics and Photo Editor
        3. Web Browsing
        4. Email
        5. Instant Messaging
        6. Media Player
    5. 2. The Linux Desktop
      1. Hack #15. Get Under the Hood of the GNOME Desktop
        1. Configuration Nirvana: the Configuration Editor
        2. Scripting GConf
      2. Hack #16. Tweak the KDE Desktop
        1. Personal
        2. Hardware
        3. System Administration
      3. Hack #17. Switch to a Lighter Window Manager
        1. Generate Program Menus
        2. Change to Your New Window Manager
        3. Try XFCE
        4. Use Fluxbox
        5. Seek Enlightenment
        6. Other Window Managers
      4. Hack #18. Install Java
        1. Installing the Java Runtime Environment
        2. Confirming the Installation
      5. Hack #19. Search Your Computer
        1. Installing Beagle
        2. Starting beagled
        3. Using Beagle and deskbar-applet
      6. Hack #20. Access Remote Filesystems
      7. Hack #21. Tweak Your Desktop Like a Pro
        1. Get Icons on Your Desktop
        2. Get Organized with Tomboy
        3. Automatic Wallpaper Switching
        4. Getting a Pull-Down "Quake" Terminal
      8. Hack #22. Sync Your Palm PDA
        1. Configuring Palm Synchronization
        2. Configuring the Sync Conduits
        3. Add the Pilot Applet
      9. Hack #23. Sync Your Pocket PC
        1. Connecting the Pocket PC
        2. Testing the Connection
        3. Establish a Partnership
        4. Synchronize with Evolution
          1. Testing Multisync
          2. Syncing to the Pocket PC
        5. Install Pocket PC Software
        6. Accessing the Pocket PC's Filesystem
        7. Troubleshooting
      10. Hack #24. Customize the Right-Click Contextual Menu
        1. Easy-Access Templates
        2. Custom Scripts
      11. Hack #25. Download and Share Files with the Best P2P Software
        1. BitTorrent
          1. Command line
          2. GUI
        2. aMule and eDonkey2000
        3. LimeWire and Gnutella
        4. Other P2P Apps
      12. Hack #26. Make Your Own PDFs
        1. Installing CUPS-PDF
        2. Configuring CUPS for the PDF Printer
        3. Using Your New PDF Printer
      13. Hack #27. Blog with Ubuntu
        1. Installing Drivel
        2. Configuring and Using Drivel
    6. 3. Multimedia
      1. Hack #28. Install Multimedia Plug-ins
        1. Tweak Your Repository List
        2. Install General-Purpose Libraries and Tools
        3. Install Gstreamer Libraries
        4. Install Codecs of Ambiguous Legality
      2. Hack #29. Watch Videos
        1. Install MPlayer
        2. Use MPlayer
          1. DVD playback
          2. (S)VCD playback
          3. Streaming playback
          4. Troubleshooting
      3. Hack #30. Play DVDs
      4. Hack #31. Buy Songs at the iTunes Music Store
      5. Hack #32. Get a Grip on CD Ripping
        1. Install Grip
        2. Configure Ubuntu to Default to Grip
        3. Configure Grip
          1. Configure CD options
          2. Configure ripping options
          3. Configure encoding options
          4. Configure ID3 options
          5. Configure DiscDB options
        4. Rip a CD
      6. Hack #33. Burn CDs and DVDs
      7. Hack #34. Automate Audio CD Burning
        1. Use Serpentine
        2. Use K3b
      8. Hack #35. Rip and Encode DVDs
        1. Load Your DVD
        2. Configure Settings
        3. Queue and Rip
      9. Hack #36. Create a Video DVD
        1. Install tovid
        2. Convert the Video
        3. Create the XML File
        4. Create the DVD Filesystem Structure
        5. Burn the DVD
      10. Hack #37. Connect to a Digital Camera
        1. Import from a Non-USB-Storage-Device Camera
        2. Import from a USB-Storage-Device Camera
        3. Automatically Rotate Your Photos with gThumb
    7. 4. Mobile Ubuntu
      1. Hack #38. Put Your Laptop to Sleep
        1. Getting Some Sleep
        2. Testing ACPI Sleep
      2. Hack #39. Hibernate Your Laptop
        1. Configuring Hibernation
        2. Using Hibernation
      3. Hack #40. Prolong Your Battery Life
      4. Hack #41. Get Proprietary Wireless Cards Working
        1. Installing ndiswrapper and ndisgtk
        2. Wrapping the Windows Drivers
        3. Configuring the Adapter
      5. Hack #42. Roam Wirelessly
        1. Using Your Wireless Network Card
        2. NetworkManager and You
      6. Hack #43. Make Laptop Settings Roam with Your Network
        1. Install laptop-net
        2. Configure laptop-net Profiles
          1. Configure the offline profile
          2. Configure the default network profile
          3. Test your configuration
        3. Create Personal laptop-net Profiles
          1. Configure the patterns file
          2. Configure the after-select script
      7. Hack #44. Make Bluetooth Connections
        1. Pairing
        2. Manual Pairing
        3. Bluetooth File Transfer
        4. Connect to the Internet
      8. Hack #45. Expand Your Laptop
      9. Hack #46. Hotswap Your Laptop's Optical Drive
    8. 5. X11
      1. Hack #47. Configure Multibutton Mice
      2. Hack #48. Enable Your Multimedia Keyboard
        1. Assign GNOME Keyboard Shortcuts
        2. Hotkeys
          1. Understand Hotkeys configuration parsing
          2. Set keyboard type
          3. Customize predefined actions
          4. Create custom actions
          5. Test Hotkeys
          6. Onscreen display settings
        3. Start Hotkeys Automatically
      3. Hack #49. Configure a Touchpad
        1. Preparing Your X11 Configuration
        2. Installing qsynaptics
        3. Configuring the Touchpad with QSynaptics
      4. Hack #50. Connect Multiple Displays
        1. Grok the Xorg Conf File
          1. Section "Device"
          2. Section "Monitor"
          3. Section "Screen"
          4. Section "ServerLayout"
        2. Tracking Down X Errors
        3. Configure Xinerama
        4. Configure TwinView on nVidia
        5. Configuring MergedFB on ATI/Radeon
        6. Combining Methods
      5. Hack #51. Change the Ubuntu Splash Screen
      6. Hack #52. Enable 3-D Video Acceleration
        1. Measure Performance
        2. Identify Your Video Card
        3. Drivers
          1. nVidia
          2. ATI
          3. Matrox
      7. Hack #53. Make Your Fonts Pretty
        1. Fonts Are Not Created Equal
        2. Font Management with Defoma
        3. Onscreen Font-Rendering Preferences
          1. Screen resolution
          2. Smoothing
          3. Hinting
          4. Subpixel order
        4. Install Microsoft Core Fonts
        5. Install Macintosh and Windows TrueType Fonts
    9. 6. Package Management
      1. Hack #54. Manage Packages from the Command Line
        1. dpkg
        2. apt and Friends
          1. Lazy like a fox
      2. Hack #55. Manage Packages with Synaptic
        1. Reload the Package List
        2. Install Packages
        3. Update Packages
        4. Remove Packages
        5. Search for Packages
        6. Edit Preferences and Add Repositories
      3. Hack #56. Manage Packages with Adept
        1. Basic Adept Usage
        2. Receive Update Notifications Automatically
      4. Hack #57. Install and Remove Standalone .deb Files
        1. Install a .deb
        2. Remove a Package
      5. Hack #58. Search for Packages from the Command Line
        1. Search for Packages Based on Keywords
        2. Search for Packages Based on Files They Contain
      6. Hack #59. Install Software from Source
        1. Install Compiler Tools
        2. Get and Compile the Source
          1. Step 1: configure
          2. Step 2: compile
          3. Step 3: install
        3. Hacking the Hack
      7. Hack #60. Modify the List of Package Repositories
        1. Add and Remove Repositories
        2. Unofficial Repositories
      8. Hack #61. Cache Packages Locally with Apt-cacher
        1. Installing Apt-cacher
          1. Server setup
          2. Client setup
        2. Configuration Options
        3. Traffic Reports
        4. Hacking the Hack
      9. Hack #62. Create an Ubuntu Package
        1. Create Package Files
        2. Build the Package
        3. Update the Package
      10. Hack #63. Compile a Source Package
        1. Enable Source Repositories
        2. Install Package Build Tools
        3. Install Build Dependencies and Fetch the Source
        4. Apply Changes
        5. Build Binary Package
      11. Hack #64. Convert Non-Ubuntu Packages
        1. Convert Packages with Alien
        2. Solve Package-Conversion Problems
        3. Convert Ubuntu Packages to Other Formats
      12. Hack #65. Create Your Own Package Repository
        1. Anatomy of a Repository
        2. Getting Started
        3. Update the Repository
        4. Manage a Repository Without Shell Access
      13. Hack #66. Convert Debian to Ubuntu
        1. Perform the Conversion
        2. Mix Ubuntu and Debian
    10. 7. Security
      1. Hack #67. Limit Permissions with sudo
        1. /etc/sudoers Syntax
        2. Show It's Working
        3. Enable the root Account
      2. Hack #68. Manage Security Updates
        1. Ubuntu Update Policy
        2. Obtain Security Updates
        3. Automate Update Notifications
        4. Package Signatures
        5. Monitor Security Advisories
      3. Hack #69. Protect Your Network with a Firewall
        1. Initial Firewall Setup
        2. Initial Management-Machine Setup
          1. Create a firewall project
          2. Define a new firewall
          3. Add a host-specific policy
        3. Compile and Install the Policy
        4. Automatic Policy Startup
        5. Automatic Policy Installation
      4. Hack #70. Use an Encrypted Filesystem to Protect Your Data
        1. Kernel Setup
        2. Create an Encrypted Device
          1. Create a loopback disk image
          2. Set up the block device
        3. Unmounting
        4. Remounting
        5. Hacking the Hack
      5. Hack #71. Encrypt Your Email and Important Files
        1. Generate a GPG Key Pair
        2. Importing GPG Keys
        3. Signing a GPG Key
        4. Encrypting Files Using GPG
        5. Decrypting Files Using GPG
      6. Hack #72. Surf the Web Anonymously
        1. How Onion Routing Works
        2. Installing and Using Tor
        3. Other Apps
      7. Hack #73. Keep Windows Malware off Your System
    11. 8. Administration
      1. Hack #74. Edit Configuration Files
        1. Navigate Through the File
        2. Edit a Line
        3. Copy and Paste
        4. Undo
        5. Save and Exit
        6. Search and Replace
        7. Help
        8. Where to Learn More
      2. Hack #75. Manage Users and Groups
        1. Use the User Administration Tool
        2. Manage Users and Groups from the Command Line
      3. Hack #76. Mount Any Filesystem
        1. Add a Local Partition
        2. Mount the Filesystems
        3. Mount Network Filesystems
      4. Hack #77. Control Startup Services
        1. Services Administration Tool
        2. Command-Line Method
        3. Change the Runlevel
        4. Manually Start and Stop Services
        5. Disable Scripts from Starting
      5. Hack #78. Build Kernels the Ubuntu Way
        1. Get the Source
        2. Tools You Will Need
        3. Configuration Methods
        4. Configuring the Kernel
        5. Compiling and Packaging
        6. Install Your Kernel Package
        7. Rebooting and Testing
        8. Installing on Other Machines
        9. Install Multiple Copies of One Kernel Version
      6. Hack #79. Back Up Your System
        1. Get Simple Backup
        2. Configure Simple Backup
          1. Use recommended backup settings
          2. Use custom backup settings
        3. Configuring Custom Backup Settings
          1. Configure files to include
          2. Configure files to exclude
          3. Configure the backup destination
          4. Configure recurring backups
        4. Restore from Backup
      7. Hack #80. Clone an Installation
        1. Export the List of Installed Packages
        2. Prepare the Destination System
        3. Import the Package List
        4. Hacking the Hack
      8. Hack #81. Rescue an Unbootable System
        1. Boot into Rescue Mode
        2. Common Rescue Scenarios
          1. The system won't go past the boot menu, or the menu is missing
          2. The system goes past the boot menu but can't access the root filesystem
          3. The system boots and continues through part of the boot process, but hangs at a particular service
        3. Conclusion
      9. Hack #82. Check the Captain's Log
        1. View the Logs
      10. Hack #83. Mount Removable Devices with Persistent Names
      11. Hack #84. Mount Remote Directories Securely and Easily
      12. Hack #85. Make Videos of Your Tech-Support Questions
      13. Hack #86. Synchronize Files Across Machines
        1. The Problem with rsync
        2. Synchronize Files on Two Machines with Unison Using SSH
        3. Tweaking Your Profiles
        4. Changing the Location of Your Logfile Directory
        5. Further Information About Unison
    12. 9. Virtualization and Emulation
      1. Hack #87. Run Windows Applications
        1. Install Wine
        2. Configure Wine
        3. Install a Windows Application
        4. Run Windows Applications
        5. Working with Wine
        6. Running Other Windows Components
      2. Hack #88. Play Windows Games
        1. Run Blasts from the Past
        2. Run Current Windows Games with Cedega
        3. Run Google Earth with Wine
      3. Hack #89. Run Ubuntu Inside Windows
        1. Install coLinux
        2. Set Up the Debian Image
        3. Install Ubuntu
        4. Enabling SSH
        5. Running X11 Applications
      4. Hack #90. Use Xen to Host Virtual Machines
        1. Initial Host Installation
        2. Base Packages Required by Xen
        3. Obtain Xen3 Binary Distribution
        4. Extract Binary Distribution
        5. Configure GRUB Bootloader
        6. Xen Services
        7. Enable Networking
        8. Disable TLS Libraries
        9. Reboot
      5. Hack #91. Create an Ubuntu/Xen Virtual Machine
        1. Prepare VM Filesystems
          1. Root filesystem
          2. Swap filesystem
          3. Mount the root filesystem image
        2. Install Ubuntu into the Root Filesystem
        3. Configure the Virtual Machine
        4. Run Setup Within the VM Image
        5. Get Ready to Crank Up the VM
        6. Configure the VM in Xen
        7. Boot Your Virtual Machine
        8. Create Additional Guests
      6. Hack #92. Split Your Machine's Personality
        1. Installing VMware Server
        2. Running VMware Server
    13. 10. Small Office/Home Office Server
      1. Hack #93. Install and Configure an Ubuntu Server
        1. Minimal Installation
        2. Static Network Configuration
        3. UPS-Triggered Shutdown
      2. Hack #94. Build a File Server
        1. Enable Quota Support
        2. Install Samba
        3. Add Shares
        4. Share Printers
      3. Hack #95. Administer Your Server Remotely
        1. Configure SSH
        2. X11 Forwarding
        3. Configure Passwordless Authentication
        4. Copy Files Securely
      4. Hack #96. Build a Web Server
        1. Install Apache
        2. Install PHP
        3. Configure Dynamic Virtual Hosting
      5. Hack #97. Build an Email Server
        1. Postfix SMTP Server
        2. Reduce Spam with Greylisting
        3. Activity Reporting
        4. POP and IMAP Services
      6. Hack #98. Build a Caching Proxy Server
        1. Basic Squid Setup
        2. Proxy Traffic Reports
        3. Peering Proxies
      7. Hack #99. Build a DHCP Server
        1. Install the DHCP Daemon
        2. Basic Configuration
        3. Assign Addresses to Specific Hosts
        4. Hacking the Hack
      8. Hack #100. Build a Domain Name Server
        1. Understand DNS in 60 Seconds
        2. Authoritative and Recursive Lookups
        3. Install BIND9
        4. Create an Authoritative Forward Zone
        5. Firewall Rules
    14. About the Authors
    15. Colophon
    16. SPECIAL OFFER: Upgrade this ebook with O’Reilly