Pro Ubuntu Server Administration teaches you advanced Ubuntu system building. After reading this book, you will be able to manage anything from simple file servers to multiple virtual servers to highavailability clusters. This is the capstone volume of the Apress Ubuntu trilogy that includes Beginning Ubuntu Linux, Third Edition and Beginning Ubuntu Server LTS Administration: From Novice to Professional, Second Edition . You will be able to make Ubuntu technology shine in a Fortune 500 environment and let Ubuntu server become the backbone of your infrastructure. Topics covered include Performance monitoring and optimization Highavailability clustering Advanced Lightweight Directory Access Protocol (LDAP) integrated networking What you’ll learn Monitor Ubuntu Server software and the hardware it is running on. Make Ubuntu Server fly by careful optimization. Learn how to craft highavailability clusters. Ease your way into largescale LDAP networking. Acquire the skills to adjust Ubuntu Server to the security needs of a Fortune 500 environment. Run your own Ubuntu application server. Who this book is for Anyone who administers Linux servers and wants to know enough about Ubuntu to make it fly. Apress 1430216220 1 Contents 6 Foreword 14 About the Author 16 About the Technical Reviewer 17 Introduction 18 CHAPTER 1: Performing an Advanced Ubuntu Server Installation 19 What's So Special About an Enterprise Installation? 19 Server Hardware 20 Connection to a SAN 20 Authentication Handling 21 Preparing for the Installation in a Network 21 Which RAID? 22 Choosing a File System 23 Installing Ubuntu Server 25 Starting the Installation 26 Creating a Software- Based RAID Solution 27 Creating LVM Logical Volumes on Top of a Software RAID Device 34 Completing the Installation 40 Post-Installation Tasks 42 Setting Up NIC Bonding 42 Setting Up Multipathing 44 Summary 46 CHAPTER 2: Using Ubuntu Server for System Imaging 47 Setting Up a Clonezilla Imaging Server 47 Setting Up Diskless Remote Boot in Linux 48 Installing the DRBL Software 49 Configuring the DRBL Software 50 Setting Up the DHCP Server 51 Completing Clonezilla Configuration 53 Configuring the Clients for Cloning 54 Setting Up the Server for Cloning 55 Cloning the Client 57 Summary 61 CHAPTER 3: Performance Monitoring 62 Interpreting What Your Computer Is Doing: top 62 CPU Monitoring with top 63 CPU Performance Monitoring 65 Memory Monitoring with top 66 Process Monitoring with top 67 Analyzing CPU Performance 68 Finding Memory Problems 74 Monitoring Storage Performance 82 Monitoring Network Performance 90 Performance Baselining 97 Summary 98 CHAPTER 4: Performance Optimization 99 Strategies for Optimizing Performance 99 About /proc and sysctl 99 Applying a Simple Test 101 CPU Tuning 103 Understanding CPU Performance 103 Optimizing CPU Performance 104 Tuning Memory 107 Understanding Memory Performance 107 Optimizing Memory Usage 108 Tuning Storage Performance 112 Understanding Storage Performance 112 Optimizing the I/O Scheduler 113 Optimizing Reads 114 Network Tuning 114 Tuning Kernel Parameters 114 Optimizing TCP/IP 116 Some Hints on Samba and NFS Performance Optimization 121 Generic Network Performance Optimization Tips 122 Summary 123 CHAPTER 5: Advanced File System Management 124 Understanding File Systems 124 Inodes and Directories 125 Superblocks, Inode Bitmaps, and Block Bitmaps 127 Journaling 129 Indexing 130 Optimizing File Systems 131 Optimizing Ext2/Ext3 131 Tuning XFS 139 What About ReiserFS? 143 Summary 145 CHAPTER 6: Network Monitoring 146 Starting with Nagios 146 Configuring Nagios 150 Location of the Configuration Files 150 The Master Configuration File: nagios.cfg 151 Creating Essential Nagios Configuration Files 153 Installing NRPE 167 Configuring NRPE on the Monitored Server 167 Configuring the Nagios Server to Use NRPE 169 Managing Nagios 170 Summary 174 CHAPTER 7: Creating an Open Source SAN 175 Preparing Your Open Source SAN 177 Hardware Requirements 177 Installing Required Software 177 Setting Up the Distributed Replicated Block Device 178 Accessing the SAN with iSCSI 183 Configuring the iSCSI Target 183 Configuring the iSCSI Initiator 187 Setting Up Heartbeat 189 Setting Up the Base Cluster from /etc/ha.d/ha.cf 189 Configuring Cluster Resources 194 Backing Up the Cluster Configuration 201 Configuring STONITH 205 Heartbeat Beyond the Open Source SAN 208 Summary 209 CHAPTER 8: Configuring OpenLDAP 210 Using the LDAP Directory 210 Introducing OpenLDAP 214 Configuring OpenLDAP 215 Installing OpenLDAP 215 Configuring the Server 216 Adding Information to the LDAP Database 228 Using ldapsearch to Verify Your Configuration 230 Using LDAP Management Commands 233 Modifying Entries in the LDAP Database 234 Deleting Entries from the LDAP Database 235 Changing a Password 235 Logging In to an LDAP Server 236 Configuring PAM for LDAP Authentication 236 Setting Up nsswitch.conf to Find LDAP Services 241 Testing LDAP Client Connectivity 243 Summary 243 CHAPTER 9: Integrating Samba 244 Setting Up Samba the Easy Way 244 Creating a Local Directory to Share 245 Applying Permissions to the Local Directory 245 Defining the Share 245 Creating a Samba User Account 248 Testing Access to the Share 248 Integrating Samba with LDAP 249 Preparing Samba to Talk to LDAP 249 Preparing LDAP to Work with Samba 249 Telling Samba to Use LDAP 251 Using Samba As a Primary Domain Controller 254 Changing the Samba Configuration File 254 Creating Workstation Accounts 256 Integrating Samba in Active Directory 257 Making Samba a Member of the Active Directory Domain 257 Using Kerberos to Make Samba a Member of Active Directory 258 Authenticating Linux Users on Windows with Winbind 258 Summary 260 CHAPTER 10: Configuring Ubuntu Server As a Mail Server 261 Understanding the Components of a Mail Solution 261 Configuring the Postfix MTA 262 Handling Inbound and Outbound Mail 263 Installing Postfix and Configuring the Initial Settings 268 Configuring Postfix Further 269 Managing Postfix Components 274 Configuring the Master Daemon 276 Configuring Global Settings 276 Configuring a Simple Postfix Mail Server 279 Tuning Postfix with Lookup Tables 281 Using Postfix Management Tools 285 Receiving E-mail Using IMAP or POP3 286 Fetching E-mail Using Cyrus IMAPd 287 Filtering Incoming E-mail with procmail 290 Getting E-mail with POP3 Using Qpopper 291 Summary 292 CHAPTER 11: Managing Ubuntu Server Security 293 Managing Cryptography 293 Introduction to SSL 294 Public and Private Keys 294 The Need for a Certificate Authority 295 Creating a Certificate Authority and Server Certificates 296 Securing Applications with AppArmor 302 AppArmor Components 302 Installing and Starting AppArmor 305 Creating and Managing AppArmor Profiles 306 Updating a Profile 311 Monitoring AppArmor's Status 311 Summary 314 CHAPTER 12: Configuring Ubuntu Server As a VPN Server 315 Installing and Configuring OpenVPN 315 VPN Networking 316 Generating Certificates 317 Configuring the VPN Server 325 Configuring a Linux VPN Client 328 Configuring Windows Clients 332 Summary 332 CHAPTER 13: Configuring Kerberos and NTP on Ubuntu Server 333 Configuring an NTP Time Server 333 How NTP Works 334 Customizing Your NTP Server 339 Understanding Kerberos 341 Installing and Configuring Kerberos 342 Configuring the Kerberos Server 344 Configuring Generic Kerberos Settings 344 Configuring the KDC Settings 351 Configuring the Kerberos Client 351 Configuring Simple Kerberos Applications 351 Logging In with Kerberos 352 Summary 353 CHAPTER 14: Ubuntu Server Troubleshooting 354 Identifying the Problem 355 Troubleshooting Tools 362 Working with init=/bin/bash 362 Rescue a Broken System 364 Working with a Knoppix Rescue CD 368 Common Problems and How to Fix Them 371 Grub Errors 372 No Master Boot Record 375 Partition Problems 376 LVM Logical Volume Problems 379 Kernel Problems 386 File System Problems 389 Lost Administrator Password 391 Summary 392 INDEX 393 A 393 B 393 C 394 D 397 E 397 F 398 G 398 H 399 I 399 J 400 K 400 L 400 M 401 N 402 O 403 P 404 Q 405 R 405 S 406 T 408 U 409 V 409 W 409 X 409 ISBN-13:,9781430216223 1430216220......Page 1 Contents......Page 6 Foreword......Page 14 About the Author......Page 16 About the Technical Reviewer......Page 17 Introduction......Page 18 What's So Special About an Enterprise Installation?......Page 19 Connection to a SAN......Page 20 Preparing for the Installation in a Network......Page 21 Which RAID?......Page 22 Choosing a File System......Page 23 Installing Ubuntu Server......Page 25 Starting the Installation......Page 26 Creating a Software- Based RAID Solution......Page 27 Creating LVM Logical Volumes on Top of a Software RAID Device......Page 34 Completing the Installation......Page 40 Setting Up NIC Bonding......Page 42 Setting Up Multipathing......Page 44 Summary......Page 46 Setting Up a Clonezilla Imaging Server......Page 47 Setting Up Diskless Remote Boot in Linux......Page 48 Installing the DRBL Software......Page 49 Configuring the DRBL Software......Page 50 Setting Up the DHCP Server......Page 51 Completing Clonezilla Configuration......Page 53 Configuring the Clients for Cloning......Page 54 Setting Up the Server for Cloning......Page 55 Cloning the Client......Page 57 Summary......Page 61 Interpreting What Your Computer Is Doing: top......Page 62 CPU Monitoring with top......Page 63 CPU Performance Monitoring......Page 65 Memory Monitoring with top......Page 66 Process Monitoring with top......Page 67 Analyzing CPU Performance......Page 68 Finding Memory Problems......Page 74 Monitoring Storage Performance......Page 82 Monitoring Network Performance......Page 90 Performance Baselining......Page 97 Summary......Page 98 About /proc and sysctl......Page 99 Applying a Simple Test......Page 101 Understanding CPU Performance......Page 103 Optimizing CPU Performance......Page 104 Understanding Memory Performance......Page 107 Optimizing Memory Usage......Page 108 Understanding Storage Performance......Page 112 Optimizing the I/O Scheduler......Page 113 Tuning Kernel Parameters......Page 114 Optimizing TCP/IP......Page 116 Some Hints on Samba and NFS Performance Optimization......Page 121 Generic Network Performance Optimization Tips......Page 122 Summary......Page 123 Understanding File Systems......Page 124 Inodes and Directories......Page 125 Superblocks, Inode Bitmaps, and Block Bitmaps......Page 127 Journaling......Page 129 Indexing......Page 130 Optimizing Ext2/Ext3......Page 131 Tuning XFS......Page 139 What About ReiserFS?......Page 143 Summary......Page 145 Starting with Nagios......Page 146 Location of the Configuration Files......Page 150 The Master Configuration File: nagios.cfg......Page 151 Creating Essential Nagios Configuration Files......Page 153 Configuring NRPE on the Monitored Server......Page 167 Configuring the Nagios Server to Use NRPE......Page 169 Managing Nagios......Page 170 Summary......Page 174 CHAPTER 7: Creating an Open Source SAN......Page 175 Installing Required Software......Page 177 Setting Up the Distributed Replicated Block Device......Page 178 Configuring the iSCSI Target......Page 183 Configuring the iSCSI Initiator......Page 187 Setting Up the Base Cluster from /etc/ha.d/ha.cf......Page 189 Configuring Cluster Resources......Page 194 Backing Up the Cluster Configuration......Page 201 Configuring STONITH......Page 205 Heartbeat Beyond the Open Source SAN......Page 208 Summary......Page 209 Using the LDAP Directory......Page 210 Introducing OpenLDAP......Page 214 Installing OpenLDAP......Page 215 Configuring the Server......Page 216 Adding Information to the LDAP Database......Page 228 Using ldapsearch to Verify Your Configuration......Page 230 Using LDAP Management Commands......Page 233 Modifying Entries in the LDAP Database......Page 234 Changing a Password......Page 235 Configuring PAM for LDAP Authentication......Page 236 Setting Up nsswitch.conf to Find LDAP Services......Page 241 Summary......Page 243 Setting Up Samba the Easy Way......Page 244 Defining the Share......Page 245 Testing Access to the Share......Page 248 Preparing LDAP to Work with Samba......Page 249 Telling Samba to Use LDAP......Page 251 Changing the Samba Configuration File......Page 254 Creating Workstation Accounts......Page 256 Making Samba a Member of the Active Directory Domain......Page 257 Authenticating Linux Users on Windows with Winbind......Page 258 Summary......Page 260 Understanding the Components of a Mail Solution......Page 261 Configuring the Postfix MTA......Page 262 Handling Inbound and Outbound Mail......Page 263 Installing Postfix and Configuring the Initial Settings......Page 268 Configuring Postfix Further......Page 269 Managing Postfix Components......Page 274 Configuring Global Settings......Page 276 Configuring a Simple Postfix Mail Server......Page 279 Tuning Postfix with Lookup Tables......Page 281 Using Postfix Management Tools......Page 285 Receiving E-mail Using IMAP or POP3......Page 286 Fetching E-mail Using Cyrus IMAPd......Page 287 Filtering Incoming E-mail with procmail......Page 290 Getting E-mail with POP3 Using Qpopper......Page 291 Summary......Page 292 Managing Cryptography......Page 293 Public and Private Keys......Page 294 The Need for a Certificate Authority......Page 295 Creating a Certificate Authority and Server Certificates......Page 296 AppArmor Components......Page 302 Installing and Starting AppArmor......Page 305 Creating and Managing AppArmor Profiles......Page 306 Monitoring AppArmor's Status......Page 311 Summary......Page 314 Installing and Configuring OpenVPN......Page 315 VPN Networking......Page 316 Generating Certificates......Page 317 Configuring the VPN Server......Page 325 Configuring a Linux VPN Client......Page 328 Summary......Page 332 Configuring an NTP Time Server......Page 333 How NTP Works......Page 334 Customizing Your NTP Server......Page 339 Understanding Kerberos......Page 341 Installing and Configuring Kerberos......Page 342 Configuring Generic Kerberos Settings......Page 344 Configuring Simple Kerberos Applications......Page 351 Logging In with Kerberos......Page 352 Summary......Page 353 CHAPTER 14: Ubuntu Server Troubleshooting......Page 354 Identifying the Problem......Page 355 Working with init=/bin/bash......Page 362 Rescue a Broken System......Page 364 Working with a Knoppix Rescue CD......Page 368 Common Problems and How to Fix Them......Page 371 Grub Errors......Page 372 No Master Boot Record......Page 375 Partition Problems......Page 376 LVM Logical Volume Problems......Page 379 Kernel Problems......Page 386 File System Problems......Page 389 Lost Administrator Password......Page 391 Summary......Page 392 B......Page 393 C......Page 394 E......Page 397 G......Page 398 I......Page 399 L......Page 400 M......Page 401 N......Page 402 O......Page 403 P......Page 404 R......Page 405 S......Page 406 T......Page 408 X......Page 409 Building on lessons taught in Beginning Ubuntu Server Administration, Sander van Vugt’s newest book Pro Ubuntu Server Administration teaches advanced Ubuntu system building. Topics covered include managing simple file servers, virtual servers, performance monitoring and optimization, high-availability clusters, and advanced LDAP integrated networking. Ubuntu continues to lead the market in Linux server deployments—it currently has ? of the market; which is a much larger share than both SUSE and Red Hat. This is a necessary title for system administrators that need intermediate-advanced networking techniques.