Ubuntu Server Cookbook

Book description

Arm yourself to make the most of the versatile, powerful Ubuntu Server with over 100 hands-on recipes

About This Book

  • Master the skills to setup secure and scalable web services with popular tools like Apache, Nginx, MySQL and HAProxy

  • Set up your own cloud with Open Stack and quickly deploy applications with Docker or LXD

  • Packed with clear, step-by-step recipes to let you protect you valuable data with your own chat servers, code hosting and collaboration tools.

  • Who This Book Is For

    Ubuntu Server Cookbook is for system administrators or software developers with a basic understanding of the Linux operating system who want to set up their own servers. You are not required to have in-depth knowledge or hands-on experience with Ubuntu, but you should know the basics commands for directory navigation, file management, and the file editing tool. An understanding of computer networks is advisable

    What You Will Learn

  • Set up high performance, scalable, and fault-tolerant back ends with web and database servers

  • Facilitate team communication with a real-time chat service and collaboration tools

  • Quickly deploy your applications to their own containers and scale your infrastructure as and when needed

  • Find out how to set up your own cloud infrastructure for your internal use or rent it to the public

  • Ensure quick and easy access for your users while also securing your infrastructure from intruders

  • Set up a high performance private network with a personal VPN server and centralized authentication system

  • Swiftly start a content streaming service

  • Set up network storage for private data and source code and say good bye to costly and unreliable cloud services

  • In Detail

    Ubuntu is one of the most secure operating systems and defines the highest level of security as compared other operating system. Ubuntu server is a popular Linux distribution and the first choice when deploying a Linux server. It can be used with a $35 Raspberry Pi to top-notch, thousand-dollar-per-month cloud hardware. Built with lists that there are 4 million + websites built using Ubuntu. With its easy-to-use package management tools and availability of well-known packages, we can quickly set up our own services such as web servers and database servers using Ubuntu.

    This book will help you develop the skills required to set up high performance and secure services with open source tools. Starting from user management and an in-depth look at networking, we then move on to cover the installation and management of web servers and database servers, as well as load balancing various services. You will quickly learn to set up your own cloud and minimize costs and efforts with application containers. Next, you will get to grips with setting up a secure real-time communication system. Finally, we’ll explore source code hosting and various collaboration tools. By the end of this book, you will be able to make the most of Ubuntu’s advanced functionalities.

    Style and approach

    This easy-to-follow guide contains a series of step-by-step recipes ranging from simple to complex. Each topic will start with basic introduction to each technology followed by a detailed step-by-step installation guide and then a detailed explanation of the approach taken during installation and the various advanced options available.

    Table of contents

    1. Ubuntu Server Cookbook
      1. Table of Contents
      2. Ubuntu Server Cookbook
      3. Credits
      4. About the Author
      5. www.PacktPub.com
        1. eBooks, discount offers, and more
          1. Why Subscribe?
      6. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Sections
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        5. Conventions
        6. Reader feedback
        7. Customer support
          1. Downloading the example code
          2. Downloading the color images of this book
          3. Errata
          4. Piracy
          5. Questions
      7. 1. Managing Users and Groups
        1. Introduction
        2. Creating a user account
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        3. Creating user accounts in batch mode
          1. Getting ready
          2. How to do it...
          3. How it works…
        4. Creating a group
          1. Getting ready
          2. How to do it...
          3. How it works…
          4. There's more…
          5. See also
        5. Adding group members
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
        6. Deleting a user account
          1. Getting ready
          2. How to do it...
          3. How it works…
          4. There's more…
          5. See also
        7. Managing file permissions
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
        8. Getting root privileges with sudo
          1. Getting ready
          2. How to do it...
          3. How it works…
          4. There's more…
            1. Setting password less sudo
            2. Other uses of sudo
          5. See also
        9. Setting resource limits with limits.conf
          1. Getting ready
          2. How to do it...
          3. How it works…
          4. There's more…
        10. Setting up public key authentication
          1. Getting ready
          2. How to do it...
          3. How it works…
            1. Working of SSH authentication
          4. There's more…
                1. Troubleshooting SSH connections
                2. SSH tools for the Windows platform
          5. See also
        11. Securing user accounts
          1. How to do it...
          2. How it works…
      8. 2. Networking
        1. Introduction
        2. Connecting to a network with a static IP
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
            1. IPv6 configuration
          5. See also
        3. Installing the DHCP server
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
        4. Installing the DNS server
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        5. Hiding behind the proxy with squid
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
            1. Access control list
            2. Set cache refresh rules
            3. Sarg – tool to analyze squid logs
            4. Squid guard
          5. See also
        6. Being on time with NTP
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        7. Discussing load balancing with HAProxy
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more …
          5. See also
        8. Tuning the TCP stack
          1. Getting ready…
          2. How to do it…
          3. How it works…
          4. See also
        9. Troubleshooting network connectivity
          1. Getting ready
          2. How to do it…
          3. There's more…
        10. Securing remote access with OpenVPN
          1. Getting ready…
          2. How to do it…
          3. How it works…
          4. There's more…
        11. Securing a network with uncomplicated firewall
          1. Getting ready
          2. How to do it…
          3. There's more…
          4. See also
        12. Securing against brute force attacks
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
        13. Discussing Ubuntu security best practices
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
      9. 3. Working with Web Servers
        1. Introduction
        2. Installing and configuring the Apache web server
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
            1. HTTP version 2 support
          5. See also
        3. Serving dynamic contents with PHP
          1. Getting ready
          2. How to do it…
          3. How it works…
            1. PHP settings
          4. There's more…
            1. Installing the LAMP stack
            2. Upgrading PHP under Ubuntu 14
        4. Hosting multiple websites with a virtual domain
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        5. Securing web traffic with HTTPS
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        6. Installing Nginx with PHP_FPM
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        7. Setting Nginx as a reverse proxy
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
            1. HAProxy and Varnish
          5. See also
        8. Load balancing with Nginx
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        9. Setting HTTPs on Nginx
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        10. Benchmarking and performance tuning of Apache
          1. Getting ready
          2. How to do it…
          3. There's more…
          4. See also
        11. Securing the web server
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        12. Troubleshooting the web server
          1. Getting ready
          2. How to do it…
            1. Web server not accessible
            2. Virtual host not accessible
            3. Access denied or forbidden errors
            4. Apache downloads .php files
      10. 4. Working with Mail Servers
        1. Introduction
        2. Sending e-mails with Postfix
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        3. Enabling IMAP and POP3 with Dovecot
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        4. Adding e-mail accounts
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
            1. Web console for virtual mailbox administration
          5. See also
        5. Mail filtering with spam-assassin
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        6. Troubleshooting the mail server
          1. Getting ready
          2. How to do it…
          3. See also
        7. Installing the Zimbra mail server
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
      11. 5. Handling Databases
        1. Introduction
        2. Installing relational databases with MySQL
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There’s more…
            1. Securing MySQL installation
          5. See also
        3. Storing and retrieving data with MySQL
          1. Getting ready
          2. How to do it…
          3. How it works…
        4. Importing and exporting bulk data
          1. How to do it…
          2. See also
        5. Adding users and assigning access rights
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There’s more…
            1. Removing user accounts
            2. Setting resource limits
          5. See also
        6. Installing web access for MySQL
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There’s more…
          5. See also
        7. Setting backups
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        8. Optimizing MySQL performance – queries
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There’s more…
            1. Sharding MySQL
          5. See also
        9. Optimizing MySQL performance – configuration
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There’s more…
            1. Percona configuration wizard
            2. MySQL table compression
          5. See also
        10. Creating MySQL replicas for scaling and high availability
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There’s more…
          5. See also
        11. Troubleshooting MySQL
          1. Getting ready
          2. How to do it…
          3. See also
        12. Installing MongoDB
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        13. Storing and retrieving data with MongoDB
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There’s more…
          5. See also
      12. 6. Network Storage
        1. Introduction
        2. Installing the Samba server
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
            1. Tools for personal file sharing
          5. See also
        3. Adding users to the Samba server
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        4. Installing the secure FTP server
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        5. Synchronizing files with Rsync
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        6. Performance tuning the Samba server
          1. Getting ready
          2. How to do it…
          3. How it works…
        7. Troubleshooting the Samba server
          1. How to do it…
            1. Checking network connectivity
            2. Checking the Samba service
            3. Checking Samba logs
            4. Checking Samba configuration
          2. See also
        8. Installing the Network File System
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
      13. 7. Cloud Computing
        1. Introduction
        2. Creating virtual machine with KVM
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        3. Managing virtual machines with virsh
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
            1. Easy cloud images with uvtool
          5. See also
        4. Setting up your own cloud with OpenStack
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        5. Adding a cloud image to OpenStack
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        6. Launching a virtual instance with OpenStack
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        7. Installing Juju a service orchestration framework
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        8. Managing services with Juju
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
      14. 8. Working with Containers
        1. Introduction
        2. Installing LXD, the Linux container daemon
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        3. Deploying your first container with LXD
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        4. Managing LXD containers
          1. Getting ready…
          2. How to do it…
          3. There's more…
          4. See also
        5. Managing LXD containers – advanced options
          1. How to do it…
          2. How it works…
        6. Setting resource limits on LXD containers
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        7. Networking with LXD
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        8. Installing Docker
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        9. Starting and managing Docker containers
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        10. Creating images with a Dockerfile
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        11. Understanding Docker volumes
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        12. Deploying WordPress using a Docker network
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        13. Monitoring Docker containers
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        14. Securing Docker containers
          1. How to do it…
          2. See also
      15. 9. Streaming with Ampache
        1. Introduction
        2. Installing the Ampache server
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        3. Uploading contents and creating catalogs
          1. Getting ready
          2. How to do it…
          3. How it works…
        4. Setting on-the-fly transcoding
          1. Getting ready
          2. How to do it…
        5. Enabling API access for remote streaming
          1. Getting ready
          2. How to do it…
          3. How it works…
        6. Streaming music with Ampache
          1. Getting ready
          2. How to do it…
      16. 10. Communication Server with XMPP
        1. Introduction
        2. Installing Ejabberd
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        3. Creating users and connecting with the XMPP client
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        4. Configuring the Ejabberd installation
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        5. Creating web client with Strophe.js
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        6. Enabling group chat
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        7. Chat server with Node.js
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
      17. 11. Git Hosting
        1. Introduction
        2. Installing Git
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        3. Creating a local repository with Git CLI
          1. Getting ready

          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        4. Storing file revisions with Git commit
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
        5. Synchronizing the repository with a remote server
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
            1. GitHub pages
          5. See also
        6. Receiving updates with Git pull
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        7. Creating repository clones
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        8. Installing GitLab, your own Git hosting
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        9. Adding users to the GitLab server
          1. Getting ready
          2. How to do it…
        10. Creating a repository with GitLab
          1. Getting ready
          2. How to do it…
        11. Automating common tasks with Git hooks
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
      18. 12. Collaboration Tools
        1. Introduction
        2. Installing the VNC server
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        3. Installing Hackpad, a collaborative document editor
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more
            1. Using Hackpad with Docker
          5. See also
        4. Installing Mattermost – a self-hosted slack alternative
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more …
          5. See also
        5. Installing OwnCloud, self-hosted cloud storage
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
      19. 13. Performance Monitoring
        1. Introduction
        2. Monitoring the CPU
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        3. Monitoring memory and swap
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        4. Monitoring the network
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
        5. Monitoring storage
          1. Getting ready
          2. How to do it…
        6. Setting performance benchmarks
          1. Getting ready
          2. How to do it…
          3. There's more…
            1. Graphing tools
            2. More options
          4. See also
      20. 14. Centralized Authentication Service
        1. Introduction
        2. Installing OpenLDAP
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        3. Installing phpLDAPadmin
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        4. Ubuntu server logins with LDAP
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        5. Authenticating Ejabberd users with LDAP
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
      21. Index

    Product information

    • Title: Ubuntu Server Cookbook
    • Author(s): Uday R. Sawant
    • Release date: June 2016
    • Publisher(s): Packt Publishing
    • ISBN: 9781785883064