Creating a Bootable Ubuntu Server Flash Drive (Linux)
Total Page:16
File Type:pdf, Size:1020Kb
|||||||||||||||||||| |||||||||||||||||||| |||||||||||||||||||| Mastering Ubuntu Server Get up to date with the finer points of Ubuntu Server using this comprehensive guide Jay LaCroix BIRMINGHAM - MUMBAI |||||||||||||||||||| |||||||||||||||||||| Mastering Ubuntu Server Copyright © 2016 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: July 2016 Production reference: 1210716 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78528-452-6 www.packtpub.com |||||||||||||||||||| |||||||||||||||||||| Credits Author Project Coordinator Jay LaCroix Kinjal Bari Reviewers Proofreader David Diperna Safis Editing Robert Stolk Indexer Acquisition Editor Hemangini Bari Prachi Bisht Graphics Content Development Editor Kirk D'Penha Trusha Shriyan Production Coordinator Technical Editor Shantanu N. Zagade Vishal K. Mewada Cover Work Copy Editor Shantanu N. Zagade Madhusudan Uchil |||||||||||||||||||| |||||||||||||||||||| About the Author Jay LaCroix is an open-source enthusiast, specializing in Linux. He is passionate about Linux and its long-term adoption, and has been using Linux since 2002. Jay currently works as a DevOps Engineer for SolvIT Inc, and he holds a masters degree in Information Systems Technology Management from Capella University. During the course of his studies, he's obtained several certifications, including Linux+, LPIC-2, and SUSE Certified Linux Professional, among others. In addition to a great career working with Linux technologies, Jay also has a YouTube channel, available at LearnLinux.tv, where he posts instructional tutorial videos demonstrating how to utilize Linux and open-source technologies. When not practicing with technology, Jay enjoys photography, music, classic video-games and writing. He has also written Linux Mint Essentials and Mastering Linux Network Administration, also published by Packt Publishing. |||||||||||||||||||| |||||||||||||||||||| Acknowledgments First and foremost, I would like to thank Randy Schapel at Mott Community College for conducting a Linux class back in 2002 that was responsible for creating a life-long addiction for me. During a time where Linux wasn't nearly as popular as it is today, that class spring-boarded my career and passion. In addition, I would also like to thank Packt Publishing for the wonderful opportunity I've been given, to share my knowledge with others. I never would've thought I'd be a published author, but here I am. It's hard to believe, but this is my third book, and writing it has been an incredibly enjoyable experience. I would like to thank Prachi Bisht for the opportunity of writing this book in particular, and Trusha Shriyan for supporting me as it was being written. In addition, I would also like to thank James Jones for introducing me to writing for Packt in the first place, back in 2014. I would also like to thank everyone else I've worked with at Packt, who have all been very supportive. I would like to thank my best friend Krys for being there for me, Jim for his help and support, my two sons Alan and Johnny for being great kids, and my family on the Sherman side for not only being amazing, but also very supportive. I would like to thank the team at Security Inspection for being an amazing group of people to work with. Last but certainly not least, I would like to thank my readers for their continued support as well as all my viewers and subscribers on my Youtube channel. It's a pleasure and an honor to create content to help you all advance your careers. |||||||||||||||||||| |||||||||||||||||||| About the Reviewers David Diperna is a Linux system administrator who graduated from Oakland University with degrees in computer science and psychology. His work consists of multiple projects in different areas of Linux, but his main focus is on monitoring and logging solutions. Currently, he is working towards the CompTIA Linux+ and AWS sysops certifications and plans to complete his master's degree in computer science. I'd like to thank Packt Publishing for the opportunity and Jay for his support. Robert Stolk is an IT professional and has been working in the IT business for 18 years. He lives in the city of Rotterdam in the Netherlands. He has experience as a Unix/Linux engineer, storage manager, technical application manager, and functional application manager in the area of ISPs, post office, (mobile) telecommunication, energy, hospitals, tax office, and banking. He has fair knowledge of and uses the following Linux distributions at home and professionally: Ubuntu, Debian, RedHat, and CentOS. Currently, he works for Olgreen in Almere, the Netherlands, as a technical specialist. On his current project, he is the functional application manager of mobile applications. |||||||||||||||||||| |||||||||||||||||||| www.PacktPub.com eBooks, discount offers, and more Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub. com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details. At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks. TM https://www2.packtpub.com/books/subscription/packtlib Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books. Why subscribe? • Fully searchable across every book published by Packt • Copy and paste, print, and bookmark content • On demand and accessible via a web browser |||||||||||||||||||| |||||||||||||||||||| |||||||||||||||||||| |||||||||||||||||||| Table of Contents Preface v Chapter 1: Deploying Ubuntu Server 1 Setting up our lab 2 Determining your server's role 3 Obtaining Ubuntu Server 4 Deciding between 32-bit and 64-bit installations 6 Creating a bootable Ubuntu Server flash drive (Windows) 7 Creating a bootable Ubuntu Server flash drive (Linux) 10 Creating a bootable Ubuntu Server flash drive (Mac) 13 Planning the partition layout 16 Installing Ubuntu Server 18 Installing Ubuntu Server (Raspberry Pi) 37 Summary 39 Chapter 2: Managing Users 41 Understanding when to use root 42 Creating and removing users 43 Understanding the /etc/passwd and /etc/shadow files 49 Distributing default configuration files with /etc/skel 53 Switching between users 54 Managing groups 56 Managing passwords and password policies 59 Configuring administrator access with sudo 63 Setting permissions on files and directories 67 Summary 74 [ i ] |||||||||||||||||||| |||||||||||||||||||| Table of Contents Chapter 3: Managing Storage Volumes 75 Viewing disk usage 76 Adding additional storage volumes 80 Partitioning and formatting volumes 84 Mounting and unmounting storage volumes 87 Understanding the /etc/fstab file 89 Managing swap 94 Utilizing LVM volumes 97 Using symbolic and hard links 106 Summary 109 Chapter 4: Connecting to Networks 111 Setting the hostname 112 Managing network interfaces 114 Assigning static IP addresses 118 Understanding Linux name resolution 122 Understanding Network Manager 124 Getting started with OpenSSH 125 Getting started with SSH key management 129 Simplifying SSH connections with a ~/.ssh/config file 133 Summary 134 Chapter 5: Managing Software Packages 135 Understanding Linux package management 136 Installing and removing software 138 Searching for packages 142 Managing software repositories 144 Keeping your server up to date 149 Backing up and restoring packages 156 Making use of aptitude 157 Installing Snap packages 160 Summary 163 Chapter 6: Controlling and Monitoring Processes 165 Showing running processes with the ps command 166 Managing jobs 171 Killing misbehaving processes 174 Utilizing htop 176 Managing system processes 179 Monitoring memory usage 184 Scheduling tasks with Cron 188 Understanding load average 190 Summary 193 [ ii ] |||||||||||||||||||| |||||||||||||||||||| Table of Contents Chapter 7: Managing Your Ubuntu Server Network 195 Planning your IP address scheme 195 Serving IP addresses with isc-dhcp-server 199 Setting up name resolution (DNS) with bind 204 Creating a secondary DNS server 211 Setting up an Internet gateway 215 Keeping your system clock in sync with NTP 217 Summary 220 Chapter 8: Accessing and Sharing Files 221 File server considerations 221 Sharing files with Windows users using Samba 223 Setting up NFS shares 229 Transferring files with rsync 233 Transferring files with SCP 238 Mounting remote filesystems with SSHFS 241