Ubuntu Server Guide - Files.webiptek

Transcription

Ubuntu Server Guide

Ubuntu Server GuideCopyright 2016 Contributors to the documentAbstractWelcome to the Ubuntu Server Guide! It contains information on how to install and configure various server applicationson your Ubuntu system to fit your needs. It is a step-by-step, task-oriented guide for configuring and customizing yoursystem.Credits and LicenseThis document is maintained by the Ubuntu documentation team (https://wiki.ubuntu.com/DocumentationTeam). A list of contributors is below.This document is made available under the Creative Commons ShareAlike 3.0 License (CC-BY-SA).You are free to modify, extend, and improve the Ubuntu documentation source code under the terms of this license. All derivative works must bereleased under this license.This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE AS DESCRIBED IN THE DISCLAIMER.A copy of the license is available here: Creative Commons ShareAlike License1.Contributors to this document are: Members of the Ubuntu Documentation Project2 Members of the Ubuntu Server Team3 Contributors to the Community Help Wiki4 Other contributors can be found in the revision history of the serverguide5 and ubuntu-docs6 bzr branches available on Launchpad.1 https://creativecommons.org/licenses/by-sa/3.0/2 https://launchpad.net/ ubuntu-core-doc3 https://launchpad.net/ ubuntu-server4 https://help.ubuntu.com/community/5 https://bazaar.launchpad.net/ ubuntu-core-doc/serverguide/trunk/changes6 https://bazaar.launchpad.net/ ubuntu-core-doc/ubuntu-docs/trunk/changes

Table of Contents1. Introduction . 11. Support . 22. Installation . 31. Preparing to Install . 42. Installation . 63. Upgrading . 94. Advanced Installation . 105. Kernel Crash Dump . 193. Package Management . 251. Introduction . 262. dpkg . 273. Apt . 284. Aptitude . 305. Automatic Updates . 326. Configuration . 347. References . 364. Networking . 371. Network Configuration . 382. TCP/IP . 473. Dynamic Host Configuration Protocol (DHCP) . 514. Time Synchronisation with NTP . 545. Data Plane Development Kit . 575. DM-Multipath . 721. Device Mapper Multipathing . 732. Multipath Devices . 763. Setting up DM-Multipath Overview . 794. The DM-Multipath Configuration File . 835. DM-Multipath Administration and Troubleshooting . 956. Remote Administration . 1001. OpenSSH Server . 1012. Puppet . 1043. Zentyal . 1077. Network Authentication . 1111. OpenLDAP Server . 1122. Samba and LDAP . 1373. Kerberos . 1434. Kerberos and LDAP . 1515. SSSD and Active Directory . 1588. Domain Name Service (DNS) . 1631. Installation . 164iii

Ubuntu Server Guide2. Configuration .3. Troubleshooting .4. References .9. Security .10.11.12.13.14.15.16.1651711751761. User Management . 1772. Console Security . 1833. Firewall . 1844. AppArmor . 1915. Certificates . 1956. eCryptfs . 200Monitoring . 2021. Overview . 2032. Nagios . 2043. Munin . 208Web Servers . 2101. HTTPD - Apache2 Web Server . 2112. PHP - Scripting Language . 2183. Squid - Proxy Server . 2204. Ruby on Rails . 2235. Apache Tomcat . 225Databases . 2291. MySQL . 2302. PostgreSQL . 235LAMP Applications . 2381. Overview . 2392. Moin Moin . 2403. phpMyAdmin . 2424. WordPress . 244File Servers . 2461. FTP Server . 2472. Network File System (NFS) . 2513. iSCSI Initiator . 2534. CUPS - Print Server . 256Email Services . 2591. Postfix . 2602. Exim4 . 2683. Dovecot Server . 2714. Mailman . 2735. Mail Filtering . 279Chat Applications . 2861. Overview . 2872. IRC Server . 288iv

Ubuntu Server Guide3. Jabber Instant Messaging Server .17. Version Control System .1. Bazaar .2. Git .2902922932943. Subversion .4. References .18. Samba .1. Introduction .2. File Server .3. Print Server .4. Securing File and Print Server .5. As a Domain Controller .6. Active Directory Integration .19. Backups .1. Shell Scripts .2. Archive Rotation .3. Bacula .20. Virtualization .1. libvirt .2. Qemu .3. Cloud images and uvtool .4. Ubuntu Cloud .5. LXD .6. LXC .21. Control Groups .1. Overview .2. Filesystem .3. Delegation .4. Manager .5. Resources .22. Clustering .1. DRBD .23. VPN .1. OpenVPN .24. Other Useful Applications .1. pam motd .2. etckeeper .3. Byobu .A. Appendix .1. Reporting Bugs in Ubuntu Server Edition 404406407v

List of Tables2.1. Recommended Minimum Requirements . 45.1. Priority Checker Conversion . 735.2. DM-Multipath Components . 745.3. Multipath Configuration Defaults . 875.4. Multipath Attributes . 905.5. Device Attributes . 925.6. Useful multipath Command Options . 9817.1. Access Methods . 298vi

Chapter 1. IntroductionWelcome to the Ubuntu Server Guide!Here you can find information on how to install and configure various server applications. It is a step-by-step,task-oriented guide for configuring and customizing your system.This guide assumes you have a basic understanding of your Ubuntu system. Some installation details arecovered in Chapter 2, Installation [p. 3], but if you need detailed instructions installing Ubuntu pleaserefer to the Ubuntu Installation Guide1.A HTML version of the manual is available online at the Ubuntu Documentation website2.1 https://help.ubuntu.com/16.04/installation-guide/2 https://help.ubuntu.com1

Introduction1. SupportThere are a couple of different ways that Ubuntu Server Edition is supported: commercial support andcommunity support. The main commercial support (and development funding) is available from Canonical,Ltd. They supply reasonably- priced support contracts on a per desktop or per server basis. For moreinformation see the Ubuntu Advantage3 page.Community support is also provided by dedicated individuals and companies that wish to make Ubuntu thebest distribution possible. Support is provided through multiple mailing lists, IRC channels, forums, blogs,wikis, etc. The large amount of information available can be overwhelming, but a good search engine querycan usually provide an answer to your questions. See the Ubuntu Support4 page for more information.3 http://www.ubuntu.com/management4 http://www.ubuntu.com/support2

Chapter 2. InstallationThis chapter provides a quick overview of installing Ubuntu 16.04 LTS Server Edition. For more detailedinstructions, please refer to the Ubuntu Installation Guide1.1 https://help.ubuntu.com/16.04/installation-guide/3

Installation1. Preparing to InstallThis section explains various aspects to consider before starting the installation.1.1. System RequirementsUbuntu 16.04 LTS Server Edition supports three (3) major architectures: Intel x86, AMD64 and ARM. Thetable below lists recommended hardware specifications. Depending on your needs, you might manage withless than this. However, most users risk being frustrated if they ignore these suggestions.Table 2.1. Recommended Minimum RequirementsHard Drive SpaceInstall TypeCPURAMBase SystemAll Tasks InstalledServer (Standard)1 gigahertz512 megabytes1.5 gigabyte2.5 gigabytesServer (Minimal)300 megahertz256 megabytes1.5 megabytes2.5 gigabytesThe Server Edition provides a common base for all sorts of server applications. It is a minimalist designproviding a platform for the desired services, such as file/print services, web hosting, email hosting, etc.1.2. Server and Desktop DifferencesThere are a few differences between the Ubuntu Server Edition and the Ubuntu Desktop Edition. It should benoted that both editions use the same apt repositories, making it just as easy to install a server application onthe Desktop Edition as it is on the Server Edition.The differences between the two editions are the lack of an X window environment in the Server Edition andthe installation process.1.2.1. Kernel Differences:Ubuntu version 10.10 and prior, actually had different kernels for the server and desktop editions. Ubuntu nolonger has separate -server and -generic kernel flavors. These have been merged into a single -generic kernelflavor to help reduce the maintenance burden over the life of the release.When running a 64-bit version of Ubuntu on 64-bit processors you are not limited by memoryaddressing space.To see all kernel configuration options you can look through /boot/config-4.4.0-server. Also, LinuxKernel in a Nutshell2 is a great resource on the options available.2 http://www.kroah.com/lkn/4

Installation1.3. Backing Up Before installing Ubuntu Server Edition you should make sure all data on the system is backed up. SeeChapter 19, Backups [p. 321] for backup options.If this is not the first time an operating system has been installed on your computer, it is likely you willneed to re-partition your disk to make room for Ubuntu.Any time you partition your disk, you should be prepared to lose everything on the disk should you make amistake or something goes wrong during partitioning. The programs used in installation are quite reliable,most have seen years of use, but they also perform destructive actions.5

Installation2. InstallationThe basic steps to install Ubuntu Server Edition are the same as those for installing any operating system.Unlike the Desktop Edition, the Server Edition does not include a graphical installation program. The ServerEdition uses a console menu based process instead. Download the appropriate ISO file from the Ubuntu web site3. Boot the system from media (e.g. USB key) containing the ISO file. At the boot prompt you will be asked to select a language. From the main boot menu there are some additional options to install Ubuntu Server Edition. You caninstall a basic Ubuntu Server, check the CD-ROM for defects, check the system's RAM, boot from firsthard disk, or rescue a broken system. The rest of this section will cover the basic Ubuntu Server install. The installer asks which language it should use. Afterwards, you are asked to select your location. Next, the installation process begins by asking for your keyboard layout. You can ask the installer toattempt auto-detecting it, or you can select it manually from a list. The installer then discovers your hardware configuration, and configures the network settings usingDHCP. If you do not wish to use DHCP at the next screen choose "Go Back", and you have the option to"Configure the network manually". Next, the installer asks for the system's hostname. A new user is set up; this user will have root access through the sudo utility. After the user settings have been completed, you will be asked if you want to encrypt your home directory. Next, the installer asks for the system's Time Zone. You can then choose from several options to configure the hard drive layout. Afterwards you are askedwhich disk to install to. You may get confirmation prompts before rewriting the partition table or settingup LVM depending on disk layout. If you choose LVM, you will be asked for the size of the root logicalvolume. For advanced disk options see Section 4, “Advanced Installation” [p. 10]. The Ubuntu base system is then installed. The next step in the installation process is to decide how you want to update the system. There are threeoptions: No automatic updates: this requires an administrator to log into the machine and manually installupdates. Install security updates automatically: this will install the unattended-upgrades package, which willinstall security updates without the intervention of an administrator. For more details see Section 5,“Automatic Updates” [p. 32]. Manage the system with Landscape: Landscape is a paid service provided by Canonical to help manageyour Ubuntu machines. See the Landscape4 site for details.3 http://www.ubuntu.com/download/server/download4 http://landscape.canonical.com/6

Installation You now have the option to install, or not install, several package tasks. See Section 2.1, “PackageTasks” [p. 7] for details. Also, there is an option to launch aptitude to choose specific packages toinstall. For more information see Section 4, “Aptitude” [p. 30]. Finally, the last step before rebooting is to set the clock to UTC.If at any point during installation you are not satisfied by the default setting, use the "Go Back"function at any prompt to be brought to a detailed installation menu that will allow you to modify thedefault settings.At some point during the installation process you may want to read the help screen provided by theinstallation system. To do this, press F1.Once again, for detailed instructions see the Ubuntu Installation Guide5.2.1. Package TasksDuring the Server Edition installation you have the option of installing additional packages. The packages aregrouped by the type of service they provide. DNS server: Selects the BIND DNS server and its documentation. LAMP server: Selects a ready-made Linux/Apache/MySQL/PHP server. Mail server: This task selects a variety of packages useful for a general purpose mail server system. OpenSSH server: Selects packages needed for an OpenSSH server. PostgreSQL database: This task selects client and server packages for the PostgreSQL database. Print server: This task sets up your system to be a print server. Samba File server: This task sets up your system to be a Samba file server, which is especially suitable innetworks with both Windows and Linux systems. Tomcat Java server: Installs Apache Tomcat and needed dependencies. Virtual Machine host: Includes packages needed to run KVM virtual machines. Manually select packages: Executes aptitude allowing you to individually select packages.Installing the package groups is accomplished using the tasksel utility. One of the important differencesbetween Ubuntu (or Debian) and other GNU/Linux distribution is that, when installed, a package is alsoconfigured to reasonable defaults, eventually prompting you for additional required information. Likewise,when installing a task, the packages are not only installed, but also configured to provided a fully integratedservice.Once the installation process has finished you can view a list of available tasks by entering the following froma terminal prompt:tasksel --list-tasks5 https://help.ubuntu.com/16.04/installation-guide/7

InstallationThe output will list tasks from other Ubuntu based distributions such as Kubuntu and Edubuntu.Note that you can also invoke the tasksel command by itself, which will bring up a menu of thedifferent tas

The Server Edition provides a common base for all sorts of server applications. It is a minimalist design providing a platform for the desired services, such as file/print services, web hosting, email hosting, etc. 1.2. Server and Desktop Differences There are a few differences between the Ubuntu Server Edition and the Ubuntu Desktop Edition.