Ubuntu Server Essentials - Abdelmonam Kouka - E-Book

Ubuntu Server Essentials E-Book

Abdelmonam Kouka

0,0
27,59 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

Ubuntu is a Debian-based Linux operating system built on top of the Debian architecture. It is used to make operating systems for multiple platforms, including phones, desktops, TVs and mobiles. It has made some serious progress in the realms of efficiency and user friendliness.
With evolving technology trends, demands on software have changed, with more and more skilled users. Over the past few years, services such as Facebook, Twitter, and push notifications on smartphones mean that users are used to being up to date with everything that happens all the time. With SignalR, the applications stay connected and will generate notifications when something happens either from the system or by other users. This provides new opportunities for the system administrators, to enter this new and exciting world of real-time application development.

This is a concise and a cost-friendly guide, packed with up-to-date essentials on Ubuntu Server fundamentals.
It will guide you through deploying and configuring Ubuntu servers in your office environments. You’ll start by installing Ubuntu Server, then move to the most useful aspect —the command-line interface inside it. You’ll extend your knowledge by learning how to administrate and configure Ubuntu Server. You will also see how to deploy services on Ubuntu Server and find out how to secure it. You’ll get to grips with the virtualization and cloud computing facilities provided by Ubuntu, and finally, you’ll gain some very useful tips.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 219

Veröffentlichungsjahr: 2015

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Table of Contents

Ubuntu Server Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. The Ubuntu Server Installation
Preparation before the installation
The latest Ubuntu release
System requirements
Additional resources
The manual installation
A simple installation from a CD
Upgrading from an old release
The advanced installation
Using RAID
Using LVM
The automated installation
The PXE process
The PXE installation procedure
Additional resources
Summary
2. Configuring and Administering Ubuntu Server
Administering using the command line
The package management for an Ubuntu Server
Package repositories
Package management utilities
The dpkg tool
The aptitude tool
The apt tools
Adding software collections using tasksel
The network configuration for an Ubuntu Server
The configuration files
The network utilities
Performing essential system administration tasks
Monitoring resources
Processes management
Scheduling the processes that need to be run
Summary
3. Deploying Servers on Ubuntu
Deploying an OpenSSH server
Installing the OpenSSH server
Configuring the OpenSSH server
Setting up a DNS server
The BIND installation
Ubuntu's BIND conventions
Configuring BIND
Zone file configuration
DNS redundancy
DNS testing
Turning on a web server
The LAMP Installation
Ubuntu's LAMP Conventions
Apache management and testing
apache2ctl
Stopping Apache gracefully
Diagnostic apache2ctl commands
Deploying an e-mail server
The MTA server
Installing Postfix
Managing Postfix

The MDA server
Filters and security for an e-mail server
Other facilities
Setting up a database server
The MySQL server
The Postgre server
Setting up a DHCP server
Installing DHCP
Ubuntu DHCP Conventions
Configuring DHCP
Installing a file server
The FTP server
The Samba server
Summary
4. Security with Ubuntu
The basic security settings
Managing users
User account administration
Password administration
Permission settings
File ownership
Configuring permissions
Applying quota to user accounts
Configuring administration tasks with sudo
Configuring the AppArmor tool
Advanced security configuration
SSH security enhancement
Configuring firewalls
Backuping and restoring
The principles of backup
Drive imaging
Database backups
Backup tools
Summary
5. Virtualization and Cloud Computing inside the Ubuntu Server
Virtualization
An introduction to virtualization
The benefits of virtualization
Different techniques of virtualization
Type 1 hypervisor
Type 2 hypervisor
An isolator
The different approaches towards virtualization
Paravirtualization
Full virtualization
KVM (Kernel-based Virtual Machine)
Prerequisites
Configuring the KVM networking
The KVM installation
Managing virtual machines
XenServer
Prerequisites
Installing XenServer
The networking concept in a XenServer environment
Managing virtual machines
An introduction to Docker
How Docker works
Installing Docker
Using Docker
Cloud computing for the Ubuntu Server
The ownCloud software
The technology used in ownCloud
The ownCloud server installation
CozyCloud
Installing CozyCloud on Ubuntu Server
Using CozyCloud
OpenStack
OpenStack tools
Juju
MAAS
Landscape
LXD
Snappy
The OpenStack setup
Installing OpenStack using DevStack
The manual installation
Summary
6. Tips and Tricks for Ubuntu Server
General tips
Ubuntu Server CLI tips and tricks
How to prevent server daemons from starting during installation
How to move or copy a directory
System resource limits
Running a command over and over
Troubleshooting tips
Customizing log rotation on Ubuntu Server
The main system log files
Checking opened files
Getting information from /proc
Recovering the root password under Ubuntu Server
Useful tools and utilities
NetHogs, a network monitoring tool
vnStat, a network monitoring tool
Tailing multiple files using multitail
The program cockpit – a remote manager for Ubuntu servers
Webmin: the famous system administration tool
Using the uvtool program and extending the use of Cloud images
Summary
Index

Ubuntu Server Essentials

Ubuntu Server Essentials

Copyright © 2015 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: November 2015

Production reference: 1251115

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham B3 2PB, UK.

ISBN 978-1-78528-546-2

www.packtpub.com

Credits

Author

Abdelmonam Kouka

Reviewers

Dan Bishop

James A. Langbridge

Acquisition Editor

Larissa Pinto

Content Development Editor

Rashmi Suvarna

Technical Editors

Tejaswita Karvir

Vishal Mewada

Copy Editor

Vedangi Narvekar

Project Coordinator

Judie Jose

Proofreader

Safis Editing

Indexer

Hemangini Bari

Graphics

Kirk D'Penha

Production Coordinator

Melwyn Dsa

Cover Work

Melwyn Dsa

About the Author

Abdelmonam Kouka is a Tunisian computer engineer. He received his engineering diploma in computer science in 2007 from National School of Computer Sciences (ENSI), one of the best engineering schools in Tunisia. He received a master's degree in information security from the same school (ENSI) in 2009 and a master's degree in free and open source software from ISI/UVT in 2011. He received a master's degree in innovation management (the DICAMP.eu project) in 2014.

He was not just a student. In fact, after getting his engineering degree in 2007, in parallel to his master's marathon, he started working as a software developer in HR Access and then as a Zimbra consultant in another company. After that, he started to develop with Alcatel-Lucent as a Java/JEE developer to finish with Alcatel-Lucent as an IP/MPLS Expert. He left Alcatel-Lucent in December 2012 to launch, in partnership with his friend Ayed Akrout, his own startup named TAC-TIC (for more information, visit http://www.tac-tic.net/) that provides ICT services such as software development, open source consulting, and IP/MPLS engineering and support. He is also an Alcatel-Lucent University trainer who delivers advanced courses on IP platforms, fixed networks, and broadband access technologies.

While studying for engineering and during all of his professional experience, he was an open source activist; he was a member/co-founder of the Ubuntu-tn community, Sabily community, and the APOS association. He has also been a member of Linux Arabic Community, Arabeyes, CULLT, DFSA, and a lot of other open source clubs, associations, and initiatives.

He is also the author of Learning Zimbra Server Essentials, Packt Publishing, 2013.

I would like to give thanks and express my gratitude to my family; without their involvement, this book quite possibly would not have happened. A lot of thanks to my wife, Sonia, for her passion and patience with my late-night writing sessions. Also, a lot of thanks to my mother, Chadlia, and my brother, Iskander, for their encouragement and support during this work.

I dedicate this book to my lovely daughter, Mariem, whose smile is my source of inspiration.

Finally, to caffeine, my companion through many long nights of writing.

About the Reviewers

Dan Bishop is a systems administrator living and working in York, UK. He has extensive experience managing Ubuntu servers in personal as well as professional contexts, ranging from home office to enterprise. Apart from providing consultancy services to independent clients, he has forged a career in some of the top universities in the UK. Currently, he works at the University of York, developing a range of services that run on Ubuntu servers. In his spare time, Dan loves to travel the world, and he regularly volunteers as a special constable with the police.

James A. Langbridge does not like talking about himself in the third person, but he will try anyway. James was born in Singapore, and he followed his parents to several countries before settling down in Nantes, France, where he lives with his partner and their two children.

James is an author and embedded systems consultant. He has worked for more than 15 years on industrial, military, mobile telephony, and aviation security systems. He works primarily on low-level development, creating bootloaders or optimizing routines in assembly and making the most of small processors. When not on contract, James trains engineers to work with embedded systems and Linux. He enjoys making new gizmos, much to the dismay of his partner.

James wrote his first computer program at the age of six, and he has never stopped tinkering ever since. He began by using Apple IIs, ZX80s, and ZX81s, moved on to BBC Micros and the Amiga, and finally had no other option but to use PCs. He has been using Linux almost exclusively since 1995 and has no intention of changing. He has been using Ubuntu since 2006 as well as other flavors.

www.PacktPub.com

Support files, eBooks, discount offers, and more

For support files and downloads related to your book, please visit www.PacktPub.com.

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.

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 PacktCopy and paste, print, and bookmark contentOn demand and accessible via a web browser

Free access for Packt account holders

If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view 9 entirely free books. Simply use your login credentials for immediate access.

Preface

Ubuntu Server Essentials is a practical, hands-on guide that provides you with a clear step-by-step process to install and manage an Ubuntu Server, which will help you take advantage of the real power that is behind Ubuntu without being an expert in it.

This fast-paced book is for administrators who wish to discover the essentials of the latest version of the Ubuntu Server. The purpose of this book is to guide the readers so that they can deploy and configure Ubuntu servers in their office environments. First of all, we will start by explaining how to install the Ubuntu Server. Then, we will move on to cover the most useful aspect of the command-line interface that comes with it. Meanwhile, we will have a look at how to administrate and configure an Ubuntu Server. This knowledge will be extended with the help of a chapter dedicated to this topic. After that, we will discuss how to deploy services on an Ubuntu Server and secure it. Before finishing, we will discover the virtualization and Cloud computing facilities provided by Ubuntu. Finally, we will explore some very useful tips related to an Ubuntu Server.

What this book covers

Chapter 1, The Ubuntu Server Installation, serves as an Ubuntu Server installation guide.

Chapter 2, Configuring and Administering Ubuntu Server, provides the necessary knowledge and tools that are required to manage an Ubuntu Server.

Chapter 3, Deploying Servers on Ubuntu, allows users to easily set up and deploy a set of frequently used services, such as e-mail, the Web, DNS, and so on.

Chapter 4, Security with Ubuntu, serves as a security guide for the Ubuntu Server.

Chapter 5, Virtualization and Cloud Computing inside the Ubuntu Server, provides the knowledge needed to work with virtualization and Cloud computing.

Chapter 6, Tips and Tricks for Ubuntu Server, contains some of the most useful tips and tricks that every Ubuntu administrator needs.

What you need for this book

To use this book, you need only basic knowledge Linux OS and a cup of coffee.

Who this book is for

This book is intended for system administrators who are familiar with the fundamentals of the Linux operating system and are looking for a fast-paced guide on Ubuntu. Those familiar with the older versions of Ubuntu will also find this book useful. Basic knowledge of Linux administration is assumed. By the end of this book, readers will have a good understanding of working with the latest version of Ubuntu and exploring the new features of Ubuntu Server administration.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "We can include other contexts through the use of the include directive."

A block of code is set as follows:

zone "localhost" { type master; file "/etc/bind/db.local"; allow-transfer { 192.168.1.2; }; also-notify { 192.168.1.2; }; }; zone "127.in-addr.arpa" { type master; file "/etc/bind/db.127"; allow-transfer { 192.168.1.2; }; also-notify { 192.168.1.2; }; };

Any command-line input or output is written as follows:

sudo ln -s /etc/phppgadmin/apache.conf /etc/apache2/sites-available/phppgadminsudo a2ensite phppgadminsudo apache2ctl graceful

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Then, go to the Settings of the machine and select the System tab."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail <[email protected]>, and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from http://www.packtpub.com/sites/default/files/downloads/4800OS_ColoredImages.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at <[email protected]> with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at <[email protected]>, and we will do our best to address the problem.

Chapter 1. The Ubuntu Server Installation

This chapter will cover how to install Ubuntu Server by using different methods. We will have a look at how to install Ubuntu Server in the manual and automated mode by using a simple or an advanced installation.

To reach this goal, we will follow this plan:

Preparation before the installationThe manual installationThe automated installation

Preparation before the installation

In this section, we will take a quick look at the latest Ubuntu Server release news and then, we will make a list of all the system requirements.

The latest Ubuntu release

Canonical, the company that produces Ubuntu, releases a new version every 6 months. Each release has a code with a YY.ZZ pattern, where YY is the year and ZZ is the month.

I started writing this book just after Ubuntu 15.04 (Vivid Vervet) was released on April 23, 2015. Currently, there are two major releases—the LTS one that was released last year (LTS stands for long-term support), which is version 14.04, and the latest version 15.04. It is not a big deal if you choose either of these two versions to perform the tasks in the coming chapters, since it will make no difference. So, we decided to use the latest version as a reference for our samples, especially because the next LTS release will be based on it. (Note that only the LTS releases are supported for 5 years by Canonical, and the non-LTS releases have a support of only 9 months. That's why we normally choose the LTS versions for Ubuntu Server deployments.) When there is a notable difference between these two versions, we will mention it.

Now, let's take a look at some information related to the latest version:

It uses Linux kernel 3.19, which brings a lot of improvements in terms of performance as well as network facilities for both servers and cloud.15.04 is the first Ubuntu version that features LXD.It uses the latest versions of OpenStack, LXC (Linux Containers), LXD, Juju, libvirt, QEMU, Open vSwitch, Ceph, cloud-init, Docker, and HA-related package updates.It replaced the service manager and the standard boot upstart with systemd.

Note

The upstart boot still exists under Ubuntu. You can use it by opening the GRUB boot menu, choosing Advanced options for Ubuntu, and then clicking on Ubuntu, with Linux (upstart).

If you would like to switch permanently to the upstart boot, you can install the upstart-sysv package, which will remove ubuntu-standard and systemd-sysv.

System requirements

System requirements depend on the services that may need to be deployed in the future and installed on the server. For demonstration/test purposes, we need a minimal configuration of 300 MHz CPU, 192 MB of RAM, and a 1.5 GB hard disk. This light configuration allows us to deploy Ubuntu Server on an old computer or even a little virtual machine. This limited footprint is basically due to the absence of the X Windows System (graphic interface), which is not needed in a server environment.

In a production environment, you should be careful about your actual needs in terms of resources (the CPU, RAM, and hard disk) and the estimation growth of those needs. To do this, you need to make a good measure of dimensions based on the services that you are going to deploy.

In the case of the samples in this book, we will use the 64-bit version of Ubuntu Server 15.04, and we will install it on a virtual box machine that has 1 GB of RAM and 2 TB of hard disk.

Tip

Note that if you are using a used computer/server, you should back up your data before installing or upgrading Ubuntu. Partitioning tools used in the installation process are reliable and can be used for many years without any problems in general, but sometimes, they can perform catastrophic actions.

Additional resources

This book comprises only the essentials. It contains exactly what you need to know to perform a specific task. If you need more information about and an in-depth understanding of Ubuntu, you can have a look at the official documentation by visiting https://help.ubuntu.com.

You should download the CD image according to your system architecture. The whole list exists at http://releases.ubuntu.com/15.04/.

The manual installation

In this section, we will have a look at how to install Ubuntu Server manually, either from the CD or the USB key. Here, we will only cover the installation from the CD; the same procedure applies for the installation from the USB key. In the latter case, you should configure your computer (using the BIOS interface) to boot from USB.

There is another way to manually install Ubuntu Server, which is via network, but since we will see this procedure in depth in the next Automated installation section, we will not cover it here.

A simple installation from a CD

The procedure for installing Ubuntu from a CD is the same as that for most of the Linux distributions. So, if you are familiar with this, you can save time and move directly to the next section. If you are a newbie in this field, please follow this section closely, since the next sections (advanced installation and automated installation) will be based on this. Note that for Ubuntu Server edition, there is no graphical environment like the one in the desktop edition. So, you will need to use only the keyboard and not the mouse. The stepwise procedure to install Ubunto from CD is as follows:

First of all, download the installation CD image that matches your CPU architecture from the download page at http://releases.ubuntu.com/15.04/ and burn it on to an empty CD.Secondly, verify that your server BIOS is configured to boot on a CD-ROM drive; if this isn't the case, take care that you change it.Insert your CD in to the CD-ROM drive and boot it.Just after the boot process starts, you will be asked to select the installation language. Choose the one that you want. Don't worry if you choose some other language by mistake. You will soon learn how to change the settings.Now, you will get the following interface:

You can see a lot of options that cater to your needs:

If you just press the Enter key when selecting the default Install Ubuntu Server option, you will start the installation process.The second option, Multiple server install with MAAS, will be covered later in the chapter when talking about virtualization and cloud.Some people prefer starting with the third option, Check disk for defects, to verify that the burn process of the ISO file on the CD was done correctly.The fourth option, Test memory, is very helpful, especially when your server starts crashing and you suspect a RAM-related problem.You can use the fifth option, Boot from first hard disk, to bypass the boot from the CD in case you forgot it by mistake in the CD-ROM driver.Finally, the last option, Rescue a broken system, turns a CD into a rescue disk that is useful for backup and recovery.In most of the cases, all that you need to do is launch the installation by pressing the Enter key when selecting the default Install Ubuntu Server option, but there are some cases where you need some special options, either because of some specific hardware-related need of your machine, or because you need to customize the kernel parameters of the server for future use. For this purpose, Ubuntu gives you a lot of possibilities via the bottom menu on the boot splash screen, which can be accessed via the function keys.If you press F1, you will see an interactive help screen with documentation for the rest of the options.If you accidentally chose the wrong language at the time of booting, press F2 to change it. The boot screen will automatically choose a keyboard mapping based on your language.If you want a different mapping (for example, in my case, I am preparing screenshots for this book in English but I am using a French keyboard), press F3 to choose from a list of keyboard mapping options. The boot screen also has a lot of great accessibility options.The F4 key displays a list of installation modes from which you can choose to install Ubuntu Server by using an OEM installation, a minimal system, and a minimal virtualization guest. The OEM installation is available for manufacturers. The minimal virtualization guest gives you an easy way to install a virtualized version of Ubuntu.The F5 key shows an accessibility menu that allows you to choose a high-contrast screen, a screen magnifier, a screen reader, a braille terminal, keyboard modifiers, and even an on-screen keyboard.The real power and control over the boot process is available once you press the F6 key. Here, you can see a menu of the common arguments that help the CD boot on difficult hardware. If you press the Esc key, you will move from this menu to the boot prompt. You can type extra kernel boot parameters that you might need for your hardware, as shown in the following screenshot:
Just after launching the installation process, you will be asked to choose the language of the installation procedure, which will be the default language of the server that you wish to install. Select the one that you want by using the up/down arrow keys on your keyboard and then press the Enter