Ubuntu Server Overview: Difference between revisions
Lsokolowski1 (talk | contribs) mNo edit summary |
Lsokolowski1 (talk | contribs) mNo edit summary |
||
Line 11: | Line 11: | ||
{{Can I use your material}} | {{Can I use your material}} | ||
== Introduction | == Introduction == | ||
* Overview | * Overview | ||
* Installation | * Installation | ||
Line 18: | Line 18: | ||
* Package Management | * Package Management | ||
=== Overview | === Overview === | ||
Ubuntu | Ubuntu | ||
* For '''all people''' - usable even by ''disabled'' (anyhow) | * For '''all people''' - usable even by ''disabled'' (anyhow) | ||
Line 24: | Line 24: | ||
* So my modified custom version of it's logo is.. (-; | * So my modified custom version of it's logo is.. (-; | ||
=== Overview Con't - ..like that! | === Overview Con't - ..like that! === | ||
[[File:UbuServ.png|500px]] | [[File:UbuServ.png|500px]] | ||
== Installation | == Installation == | ||
* '''Instant''' Ubuntu VMs | * '''Instant''' Ubuntu VMs | ||
** multipass.run | ** multipass.run | ||
Line 54: | Line 54: | ||
--> | --> | ||
== Ubuntu Server Edition | == Ubuntu Server Edition == | ||
* Ubuntu '''versions''' | * Ubuntu '''versions''' | ||
* Available '''support''' | * Available '''support''' | ||
Line 60: | Line 60: | ||
* Maintenance policy and '''life cycle''' | * Maintenance policy and '''life cycle''' | ||
=== Ubuntu versions | === Ubuntu versions === | ||
* Every '''Oct''' and '''Apr''', each year | * Every '''Oct''' and '''Apr''', each year | ||
* Funny codenames: Focal, '''Beaver''', Tahr, etc | * Funny codenames: Focal, '''Beaver''', Tahr, etc | ||
Line 66: | Line 66: | ||
* Choice between ''long-stable'' and ''features-full'' | * Choice between ''long-stable'' and ''features-full'' | ||
=== Available support | === Available support === | ||
* '''features-full''' - ATM: 21.04 and 21.10 | * '''features-full''' - ATM: 21.04 and 21.10 | ||
** standard '''9 months''', no long-term, same EoL(9m) | ** standard '''9 months''', no long-term, same EoL(9m) | ||
Line 76: | Line 76: | ||
--> | --> | ||
=== LTS and standard edition | === LTS and standard edition === | ||
* '''Releases''' | * '''Releases''' | ||
** wiki.ubuntu.com/Releases | ** wiki.ubuntu.com/Releases | ||
Line 84: | Line 84: | ||
** ubuntu.com/advantage | ** ubuntu.com/advantage | ||
=== Maintenance policy and life cycle | === Maintenance policy and life cycle === | ||
* ''$ ua status'' | * ''$ ua status'' | ||
* debs, snaps, images, containers | * debs, snaps, images, containers | ||
Line 90: | Line 90: | ||
** ubuntu.com/about/release-cycle | ** ubuntu.com/about/release-cycle | ||
== Ubuntu and Hardware | == Ubuntu and Hardware == | ||
* Checking '''compatibility''' with Ubuntu | * Checking '''compatibility''' with Ubuntu | ||
* Available kernels and supported '''architectures''' | * Available kernels and supported '''architectures''' | ||
=== Checking compatibility with Ubuntu | === Checking compatibility with Ubuntu === | ||
* follows the requirements of the Linux kernel and the GNU tool-sets | * follows the requirements of the Linux kernel and the GNU tool-sets | ||
* wiki.ubuntu.com/'''HardwareSupport''' | * wiki.ubuntu.com/'''HardwareSupport''' | ||
Line 107: | Line 107: | ||
--> | --> | ||
=== Available kernels and supported architectures | === Available kernels and supported architectures === | ||
[[File:UbuSuppArch.png|800px]] | [[File:UbuSuppArch.png|800px]] | ||
* help.ubuntu.com/lts/installation-guide/s390x/ch02s01.html | * help.ubuntu.com/lts/installation-guide/s390x/ch02s01.html | ||
== Package Management | == Package Management == | ||
* '''Dpkg''' VS '''apt-get''' VS '''snap'''(''snapcraft.io'') | * '''Dpkg''' VS '''apt-get''' VS '''snap'''(''snapcraft.io'') | ||
* Available '''sources''' | * Available '''sources''' | ||
Line 120: | Line 120: | ||
* '''Distribution''' Upgrades | * '''Distribution''' Upgrades | ||
=== Examples | === Examples === | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
# 'dpkg' VS 'apt' (or apt-get) VS 'snap' | # 'dpkg' VS 'apt' (or apt-get) VS 'snap' | ||
Line 145: | Line 145: | ||
--> | --> | ||
=== Exercises | === Exercises === | ||
Install | Install | ||
# '''MariaDB''' via 'apt' command | # '''MariaDB''' via 'apt' command | ||
Line 152: | Line 152: | ||
#* wget http://de.archive.ubuntu.com/ubuntu/pool/universe/n/nodejs/nodejs_10.19.0~dfsg-3ubuntu1_amd64.deb | #* wget http://de.archive.ubuntu.com/ubuntu/pool/universe/n/nodejs/nodejs_10.19.0~dfsg-3ubuntu1_amd64.deb | ||
=== Sources | === Sources === | ||
* Main - ''/etc/apt/sources.list'' | * Main - ''/etc/apt/sources.list'' | ||
* Custom - ''/etc/apt/sources.list.d'' | * Custom - ''/etc/apt/sources.list.d'' | ||
Line 174: | Line 174: | ||
** packaging.ubuntu.com/html/packaging-new-software.html | ** packaging.ubuntu.com/html/packaging-new-software.html | ||
=== Automatic Updates | === Automatic Updates === | ||
* If installed via ''snap'' - enabled by default (but slower run and separated form the rest of the server) | * If installed via ''snap'' - enabled by default (but slower run and separated form the rest of the server) | ||
* <syntaxhighlight lang="bash">sudo apt install unattended-upgrades</syntaxhighlight> | * <syntaxhighlight lang="bash">sudo apt install unattended-upgrades</syntaxhighlight> | ||
Line 182: | Line 182: | ||
** Config - ''/etc/apticron/apticron.conf'' | ** Config - ''/etc/apticron/apticron.conf'' | ||
=== Distro Upgrades | === Distro Upgrades === | ||
* To go for the '''next big ver''', especially LTS | * To go for the '''next big ver''', especially LTS | ||
** ''sudo do-release-upgrade'' | ** ''sudo do-release-upgrade'' | ||
Line 191: | Line 191: | ||
** will be called by '''do-release-upgrade''' | ** will be called by '''do-release-upgrade''' | ||
== Networking | == Networking == | ||
* Network Configuration | * Network Configuration | ||
* TCP/IP, IPv4 and IPv6 | * TCP/IP, IPv4 and IPv6 | ||
Line 198: | Line 198: | ||
* '''DPDK''' | * '''DPDK''' | ||
=== Network Configuration | === Network Configuration === | ||
* Ethernet Interfaces - '''eno1''', '''enp0s25''' or kernel style '''eth#''' | * Ethernet Interfaces - '''eno1''', '''enp0s25''' or kernel style '''eth#''' | ||
** ''$ ip a'' | ** ''$ ip a'' | ||
Line 212: | Line 212: | ||
--> | --> | ||
==== IP Addressing | ==== IP Addressing ==== | ||
* '''Temporary''' assignment - '''ip''' command | * '''Temporary''' assignment - '''ip''' command | ||
** ''$ sudo ip addr add 10.102.66.200/24 dev enp0s25; ip link set dev enp0s25 up/down'' | ** ''$ sudo ip addr add 10.102.66.200/24 dev enp0s25; ip link set dev enp0s25 up/down'' | ||
Line 218: | Line 218: | ||
** use '''netplan''' config file and then ''$ sudo netplan apply'' | ** use '''netplan''' config file and then ''$ sudo netplan apply'' | ||
==== Name Resolution | ==== Name Resolution ==== | ||
* '''DNS''' Client Configuration - symlink with netplan | * '''DNS''' Client Configuration - symlink with netplan | ||
** ''/etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf'' | ** ''/etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf'' | ||
Line 229: | Line 229: | ||
** '''netplan''' doesn't support hooks by deafult, like it was with '''ifupdown''' | ** '''netplan''' doesn't support hooks by deafult, like it was with '''ifupdown''' | ||
=== DHCP server | === DHCP server === | ||
* Configuration | * Configuration | ||
** '''Manual''' allocation (MAC address) | ** '''Manual''' allocation (MAC address) | ||
Line 239: | Line 239: | ||
** ''/etc/default/isc-dhcp-server'' | ** ''/etc/default/isc-dhcp-server'' | ||
=== Time sync | === Time sync === | ||
* '''timedatectl''' or '''timesyncd''' - they are part of '''systemd''' | * '''timedatectl''' or '''timesyncd''' - they are part of '''systemd''' | ||
* also '''chrony''' - ''chronyd'' and ''chronyc'' | * also '''chrony''' - ''chronyd'' and ''chronyc'' | ||
Line 246: | Line 246: | ||
** support for '''NTS'''(Network Time Security) | ** support for '''NTS'''(Network Time Security) | ||
=== DPDK | === DPDK === | ||
* ''Data Plane Development Kit'' | * ''Data Plane Development Kit'' | ||
* '''libraries''' and '''drivers''' for fast packet processing | * '''libraries''' and '''drivers''' for fast packet processing | ||
Line 262: | Line 262: | ||
--> | --> | ||
== Remote Administration | == Remote Administration == | ||
* OpenSSH Server | * OpenSSH Server | ||
* OpenLDAP Server | * OpenLDAP Server | ||
Line 268: | Line 268: | ||
* Kerberos | * Kerberos | ||
=== OpenSSH Server | === OpenSSH Server === | ||
Tools for the '''remote control''' of '''networked''' computers and '''transfer of data''' between | Tools for the '''remote control''' of '''networked''' computers and '''transfer of data''' between | ||
* replaced insecured telnet and rcp | * replaced insecured telnet and rcp | ||
Line 285: | Line 285: | ||
--> | --> | ||
=== OpenLDAP Server | === OpenLDAP Server === | ||
Lightweight Directory Access Protocol | Lightweight Directory Access Protocol | ||
* for querying and modifying a X.500-based directory service running over TCP/IP | * for querying and modifying a X.500-based directory service running over TCP/IP | ||
Line 310: | Line 310: | ||
--> | --> | ||
=== Samba and LDAP | === Samba and LDAP === | ||
* Samba 4 is best integrated with its own LDAP server in '''AD''' mode | * Samba 4 is best integrated with its own LDAP server in '''AD''' mode | ||
* The '''NT4''' mode - deprecated | * The '''NT4''' mode - deprecated | ||
More about Samba - later on.. (-; | More about Samba - later on.. (-; | ||
=== Kerberos | === Kerberos === | ||
'''Network authentication system''' based on the principal of a '''trusted third party''' | '''Network authentication system''' based on the principal of a '''trusted third party''' | ||
* '''Principal''' - users, computers, and services provided by servers | * '''Principal''' - users, computers, and services provided by servers | ||
Line 347: | Line 347: | ||
--> | --> | ||
== Domain Name Service (DNS) | == Domain Name Service (DNS) == | ||
* Maps '''IPs''' with '''FQDN'''(''fully qualified domain names'') | * Maps '''IPs''' with '''FQDN'''(''fully qualified domain names'') | ||
* Configuration - '''name server''' | * Configuration - '''name server''' | ||
Line 369: | Line 369: | ||
--> | --> | ||
== Security | == Security == | ||
* User Management | * User Management | ||
* Console Security | * Console Security | ||
Line 378: | Line 378: | ||
* SSSD | * SSSD | ||
=== User Management | === User Management === | ||
* '''root''' disabled by default | * '''root''' disabled by default | ||
** enabling - ''$ sudo passwd'' | ** enabling - ''$ sudo passwd'' | ||
Line 389: | Line 389: | ||
* Good password | * Good password | ||
==== Good password | ==== Good password ==== | ||
* ''$ chage -l username'' | * ''$ chage -l username'' | ||
** '''min''' passw lenght | ** '''min''' passw lenght | ||
Line 396: | Line 396: | ||
* '''Good passw''' - [[Debian_exercises#Good_Password | Exercise]] | * '''Good passw''' - [[Debian_exercises#Good_Password | Exercise]] | ||
=== Console Security | === Console Security === | ||
* dis ''ctrl+alt+del'' | * dis ''ctrl+alt+del'' | ||
** ''$ sudo systemctl mask ctrl-alt-del.target ; sudo systemctl daemon-reload'' | ** ''$ sudo systemctl mask ctrl-alt-del.target ; sudo systemctl daemon-reload'' | ||
Line 402: | Line 402: | ||
** extensions - '''sentry''' over '''fail2ban'''(denyhosts, sshblacklist, etc) | ** extensions - '''sentry''' over '''fail2ban'''(denyhosts, sshblacklist, etc) | ||
=== Firewall | === Firewall === | ||
* '''Netfilter''' subsystem from Linux kernel | * '''Netfilter''' subsystem from Linux kernel | ||
** managed with ''iptables'' | ** managed with ''iptables'' | ||
Line 416: | Line 416: | ||
--> | --> | ||
=== AppArmor | === AppArmor === | ||
* '''Linux Security Module''' implementation of name-based mandatory access controls | * '''Linux Security Module''' implementation of name-based mandatory access controls | ||
* installed and loaded by default | * installed and loaded by default | ||
Line 437: | Line 437: | ||
--> | --> | ||
=== Certificates | === Certificates === | ||
* '''public-key''' cryptography | * '''public-key''' cryptography | ||
* public key '''encrypts''', private key '''decrypts''' | * public key '''encrypts''', private key '''decrypts''' | ||
Line 455: | Line 455: | ||
--> | --> | ||
=== OpenVPN | === OpenVPN === | ||
* Virtual Private Networking (VPN) | * Virtual Private Networking (VPN) | ||
* flexible, reliable and secure - originates from SSL/TLS VPN stacks | * flexible, reliable and secure - originates from SSL/TLS VPN stacks | ||
Line 472: | Line 472: | ||
--> | --> | ||
=== SSSD | === SSSD === | ||
* System Security Services Daemon | * System Security Services Daemon | ||
* '''Collection of daemons''' that handle: | * '''Collection of daemons''' that handle: | ||
Line 489: | Line 489: | ||
--> | --> | ||
== Web Servers | == Web Servers == | ||
* '''HTTPD''' - Apache2 Web Server | * '''HTTPD''' - Apache2 Web Server | ||
** '''LAMP''' - Linux, Apache, MySQL, Perl/Python/PHP | ** '''LAMP''' - Linux, Apache, MySQL, Perl/Python/PHP | ||
Line 514: | Line 514: | ||
--> | --> | ||
== Databases | == Databases == | ||
* MySQL, MariaDB | * MySQL, MariaDB | ||
* PostgreSQL | * PostgreSQL | ||
=== MySQL, MariaDB | === MySQL, MariaDB === | ||
* Fast, multi-threaded, multi-user, and robust '''db server''' | * Fast, multi-threaded, multi-user, and robust '''db server''' | ||
* Preferred for '''higher performance''' requirements | * Preferred for '''higher performance''' requirements | ||
Line 529: | Line 529: | ||
* Commands: ''mysgl ; mysqld ; mysqldump ; mysqltuner'' | * Commands: ''mysgl ; mysqld ; mysqldump ; mysqltuner'' | ||
=== PostgreSQL | === PostgreSQL === | ||
* Preferred for its attention to standards conformance, features, and '''extensibility''' | * Preferred for its attention to standards conformance, features, and '''extensibility''' | ||
* '''Hybrid''' of relational and OOP approaches | * '''Hybrid''' of relational and OOP approaches | ||
Line 538: | Line 538: | ||
* Package with docs: ''postgresql-doc-12'' | * Package with docs: ''postgresql-doc-12'' | ||
== Wiki Applications | == Wiki Applications == | ||
* ''Moin Moin'' | * ''Moin Moin'' | ||
** advanced, easy to use and extensible '''WikiEngine''' with a large community of users | ** advanced, easy to use and extensible '''WikiEngine''' with a large community of users | ||
Line 547: | Line 547: | ||
** uses simple '''markup''' language - yet stil supports pure html | ** uses simple '''markup''' language - yet stil supports pure html | ||
== File Servers | == File Servers == | ||
* '''FTP''' Server | * '''FTP''' Server | ||
** '''downloading''' files between computers | ** '''downloading''' files between computers | ||
Line 576: | Line 576: | ||
--> | --> | ||
== Email Services | == Email Services == | ||
* '''Postfix''' | * '''Postfix''' | ||
** '''default''' ''Mail Transfer Agent'' (MTA) in Ubuntu | ** '''default''' ''Mail Transfer Agent'' (MTA) in Ubuntu | ||
Line 591: | Line 591: | ||
* Mail '''Filtering''' - modules like ''dovecot-sieve, dovecot-antispam'' | * Mail '''Filtering''' - modules like ''dovecot-sieve, dovecot-antispam'' | ||
== Version Control System | == Version Control System == | ||
* '''Bazaar''' - free software sponsored by Canonical | * '''Bazaar''' - free software sponsored by Canonical | ||
** doc.bazaar.canonical.com/migration/en/why-switch-to-bazaar.html | ** doc.bazaar.canonical.com/migration/en/why-switch-to-bazaar.html | ||
Line 602: | Line 602: | ||
** distributed, fast, efficient, compressed | ** distributed, fast, efficient, compressed | ||
== Windows Networking | == Windows Networking == | ||
Sharing network resources with Windows computers | Sharing network resources with Windows computers | ||
* Samba '''File''' Server | * Samba '''File''' Server | ||
Line 617: | Line 617: | ||
* ''Likewise Open'' - old, depricated, insecure | * ''Likewise Open'' - old, depricated, insecure | ||
== Backups | == Backups == | ||
* '''Shell Scripts''' | * '''Shell Scripts''' | ||
** Archive Rotation | ** Archive Rotation | ||
Line 623: | Line 623: | ||
* '''Rsnapshot''' | * '''Rsnapshot''' | ||
=== Shell Scripts | === Shell Scripts === | ||
* File - ''backup.sh'' | * File - ''backup.sh'' | ||
** ''$ tar czf "/mnt/backup/$hostname-$day.tgz" "/home /var/spool/mail /etc /root /boot /opt"'' | ** ''$ tar czf "/mnt/backup/$hostname-$day.tgz" "/home /var/spool/mail /etc /root /boot /opt"'' | ||
Line 642: | Line 642: | ||
--> | --> | ||
=== Bacula | === Bacula === | ||
* Backup, restore, and verify data across our network | * Backup, restore, and verify data across our network | ||
* '''Cross-platform''', supports - Lin, Win, MacOS | * '''Cross-platform''', supports - Lin, Win, MacOS | ||
Line 680: | Line 680: | ||
--> | --> | ||
=== Rsnapshot | === Rsnapshot === | ||
* '''rsync-based''' filesystem snapshot utility | * '''rsync-based''' filesystem snapshot utility | ||
* '''incremental''' and '''scheduled''' backups of local and remote filesystems | * '''incremental''' and '''scheduled''' backups of local and remote filesystems | ||
Line 694: | Line 694: | ||
--> | --> | ||
== Virtualization and Cloud Computing | == Virtualization and Cloud Computing == | ||
* libvirt | * libvirt | ||
* JeOS and vmbuilder - depricated, EoL | * JeOS and vmbuilder - depricated, EoL | ||
Line 716: | Line 716: | ||
--> | --> | ||
=== libvirt | === libvirt === | ||
* Used to '''interface''' with different virtualization technologies | * Used to '''interface''' with different virtualization technologies | ||
* '''kvm-ok''' - checks if our hardware supports the necessary virtualization extensions for KVM | * '''kvm-ok''' - checks if our hardware supports the necessary virtualization extensions for KVM | ||
Line 742: | Line 742: | ||
** '''Sharing files''' between Host <=> Guest | ** '''Sharing files''' between Host <=> Guest | ||
=== Quemu and KVM | === Quemu and KVM === | ||
* machine '''emulator''' | * machine '''emulator''' | ||
** can run operating systems and programs for one machine on a different machine | ** can run operating systems and programs for one machine on a different machine | ||
Line 765: | Line 765: | ||
--> | --> | ||
=== VirtualBox | === VirtualBox === | ||
x86 and AMD64/Intel64 virtualization - enterprise and home use | x86 and AMD64/Intel64 virtualization - enterprise and home use | ||
* lots of features | * lots of features | ||
Line 775: | Line 775: | ||
* guest-additions (mostly for GUIs) | * guest-additions (mostly for GUIs) | ||
=== VMware | === VMware === | ||
Not only virtualization | Not only virtualization | ||
* '''Platform''' for applications | * '''Platform''' for applications | ||
Line 783: | Line 783: | ||
<!-- anywhere, anytime, any employee --> | <!-- anywhere, anytime, any employee --> | ||
=== EC2 | === EC2 === | ||
Amazon Elastic Compute Cloud (Amazon EC2) | Amazon Elastic Compute Cloud (Amazon EC2) | ||
* humongous '''web service''', mostly for '''developers''' | * humongous '''web service''', mostly for '''developers''' | ||
Line 801: | Line 801: | ||
--> | --> | ||
=== Containers - lxd, lxc | === Containers - lxd, lxc === | ||
* '''lxd''' - like ''libvirt'' | * '''lxd''' - like ''libvirt'' | ||
** ''lightervisor'' - lightweight container '''hypervisor''' | ** ''lightervisor'' - lightweight container '''hypervisor''' | ||
Line 830: | Line 830: | ||
--> | --> | ||
== Other | == Other == | ||
* Keeping /etc under Version Control System | * Keeping /etc under Version Control System | ||
* Block Device Replication | * Block Device Replication | ||
=== Tools | === Tools === | ||
* byobu | * byobu | ||
* etckeeper | * etckeeper | ||
Line 842: | Line 842: | ||
* Puppet | * Puppet | ||
==== Byobu | ==== Byobu ==== | ||
* xterm multiplexor | * xterm multiplexor | ||
** acts as a wrapper to '''screen''' or '''tmux'''(default) | ** acts as a wrapper to '''screen''' or '''tmux'''(default) | ||
Line 856: | Line 856: | ||
--> | --> | ||
==== etckeeper | ==== etckeeper ==== | ||
* industry best practice | * industry best practice | ||
* stores the contents of ''/etc'' in '''VCS repo''' (default is GIT) | * stores the contents of ''/etc'' in '''VCS repo''' (default is GIT) | ||
Line 871: | Line 871: | ||
--> | --> | ||
==== munin | ==== munin ==== | ||
* networked '''resource monitoring''' tool | * networked '''resource monitoring''' tool | ||
* helps analyze '''resource''' trends and '''performance''' issues | * helps analyze '''resource''' trends and '''performance''' issues | ||
Line 883: | Line 883: | ||
--> | --> | ||
==== nagios | ==== nagios ==== | ||
Monitoring of | Monitoring of | ||
* '''Network''' | * '''Network''' | ||
Line 906: | Line 906: | ||
Implementing effective application monitoring with Nagios allows your organization to quickly detect application, service, or process problems, and take action to eliminate downtime for your application users. Nagios provides tools for monitoring of applications and application state – including Windows applications, Linux applications, UNIX applications, and Web applications. | Implementing effective application monitoring with Nagios allows your organization to quickly detect application, service, or process problems, and take action to eliminate downtime for your application users. Nagios provides tools for monitoring of applications and application state – including Windows applications, Linux applications, UNIX applications, and Web applications. | ||
--> | --> | ||
==== pam_motd | ==== pam_motd ==== | ||
After logging shows the informative Message Of The Day (MOTD) | After logging shows the informative Message Of The Day (MOTD) | ||
* ''landscape-common'' - displaying core system data: cpu, memory, disk space, etc | * ''landscape-common'' - displaying core system data: cpu, memory, disk space, etc | ||
Line 916: | Line 916: | ||
--> | --> | ||
==== Puppet | ==== Puppet ==== | ||
* '''cross platform framework''' enabling system admins to perform common '''tasks''' using code | * '''cross platform framework''' enabling system admins to perform common '''tasks''' using code | ||
** installing new software, checking file permissions, updating user accounts, etc | ** installing new software, checking file permissions, updating user accounts, etc | ||
Line 928: | Line 928: | ||
--> | --> | ||
=== Block Device Replication | === Block Device Replication === | ||
Ubuntu HA - '''DRBD''' | Ubuntu HA - '''DRBD''' | ||
* Distributed Replicated Block Device (DRBD) | * Distributed Replicated Block Device (DRBD) | ||
Line 942: | Line 942: | ||
--> | --> | ||
== THE END | == THE END == | ||
Summary - '''''Ubuntu''''' | Summary - '''''Ubuntu''''' | ||
* Try it and have '''fun'''! (-; | * Try it and have '''fun'''! (-; |
Revision as of 10:31, 19 September 2025
- title
- Ubuntu Server Overview Training Course
- author
- Lukasz Sokolowski
Ubuntu Server Overview
Ubuntu Server Overview Training Materials
Copyright Notice
Copyright © 2004-2025 by NobleProg Limited All rights reserved.
This publication is protected by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise.
Introduction
- Overview
- Installation
- Ubuntu Server Edition
- Ubuntu and Hardware
- Package Management
Overview
Ubuntu
- For all people - usable even by disabled (anyhow)
- Connects people (opensource) - no matter what race, age, path, etc
- So my modified custom version of it's logo is.. (-;
Overview Con't - ..like that!
Installation
- Instant Ubuntu VMs
- multipass.run
- cloud-init.io
- multipass.run
- Manual
- ATM actual LTS Release Notes
- Automated
- maas.io
Ubuntu Server Edition
- Ubuntu versions
- Available support
- LTS vs standard edition
- Maintenance policy and life cycle
Ubuntu versions
- Every Oct and Apr, each year
- Funny codenames: Focal, Beaver, Tahr, etc
- Every 2y, stable and long support ver(for 5y)
- Choice between long-stable and features-full
Available support
- features-full - ATM: 21.04 and 21.10
- standard 9 months, no long-term, same EoL(9m)
- long-stable - ATM: 20.04.x, 18.04.x, 16.04.x, 14.04.x
- Long-Term Support 5y, EoL for 10y
LTS and standard edition
- Releases
- wiki.ubuntu.com/Releases
- ESM - Extended Security Maintenance
- Extendable subscription
- for LTS only, for 5y - free(private) or paid(enterprise)
- ubuntu.com/advantage
Maintenance policy and life cycle
- $ ua status
- debs, snaps, images, containers
- Version cycle
- ubuntu.com/about/release-cycle
Ubuntu and Hardware
- Checking compatibility with Ubuntu
- Available kernels and supported architectures
Checking compatibility with Ubuntu
- follows the requirements of the Linux kernel and the GNU tool-sets
- wiki.ubuntu.com/HardwareSupport
- ubuntu.com/certified
- wiki.ubuntu.com/Hardware_probe
- hwinfo, hw-probe, hwdata
sudo -E hw-probe -all -upload
- $ discover
Available kernels and supported architectures
- help.ubuntu.com/lts/installation-guide/s390x/ch02s01.html
Package Management
- Dpkg VS apt-get VS snap(snapcraft.io)
- Available sources
- Adding new sources
- Alternative packet management systems (RPM, Yums, etc...) and dependencies
- Aptitude
- Automatic Updates
- Distribution Upgrades
Examples
# 'dpkg' VS 'apt' (or apt-get) VS 'snap'
sudo apt install mc
sudo snap install hello
sudo dpkg -i package_name.deb
# updating the index of packages
sudo apt update
# upgrading packages
sudo apt upgrade
# removing
sudo apt remove subversion*
# aptitude - menu-driven text-based front-end to 'apt'
sudo aptitude
Exercises
Install
- MariaDB via 'apt' command
- postgresql with 'snap'
- with 'dpkg' add nodejs
Sources
- Main - /etc/apt/sources.list
- Custom - /etc/apt/sources.list.d
- Adding new - manually, via commands
- mongoDB example
# Import the public key
wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -
# Creates a list file
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
# Refreshing the list
sudo apt update
RPM, Yum, etc
"Yes we can" - but don't!
- Doable but can have serious dependency issues
- It is always better to do it from sources instead and then make a deb package
- packaging.ubuntu.com/html/packaging-new-software.html
Automatic Updates
- If installed via snap - enabled by default (but slower run and separated form the rest of the server)
sudo apt install unattended-upgrades
- Config - /etc/apt/apt.conf.d/50unattended-upgrades
- Enabling - /etc/apt/apt.conf.d/20auto-upgrades
- Automatic email when updates available - sudo apt install apticron
- Config - /etc/apticron/apticron.conf
Distro Upgrades
- To go for the next big ver, especially LTS
- sudo do-release-upgrade
- we should do it at least once in 5y, before the end of support for LTS
- To fully update existing release
- sudo apt-get dist-upgrade
- might be helpful, but does remove or install new things
- will be called by do-release-upgrade
Networking
- Network Configuration
- TCP/IP, IPv4 and IPv6
- Dynamic Host Configuration Protocol (DHCP) - server
- Time Synchronisation with NTP - depricated
- DPDK
Network Configuration
- Ethernet Interfaces - eno1, enp0s25 or kernel style eth#
- $ ip a
- $ sudo lshw -class network
- netplan config - match, set-name keys
- $ netplan info; netplan get all
- $ sudo ethtool eth3
IP Addressing
- Temporary assignment - ip command
- $ sudo ip addr add 10.102.66.200/24 dev enp0s25; ip link set dev enp0s25 up/down
- via DHCP or static IP
- use netplan config file and then $ sudo netplan apply
Name Resolution
- DNS Client Configuration - symlink with netplan
- /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf
- Static Hostnames - /etc/hosts
- Name Service Switch Configuration - /etc/nsswitch.conf
- Bridging - more advanced config, bridges: in /etc/netplan
- scenario1 - setting up a bridge with multiple network interfaces, then using a firewall to filter traffic between two network segments
- scenario2 - using bridge on a system with one interface to allow virtual machines direct access to the outside network
- networkd-dispatcher - for pre-up, post-up, etc. hook scripts
- netplan doesn't support hooks by deafult, like it was with ifupdown
DHCP server
- Configuration
- Manual allocation (MAC address)
- Dynamic allocation (address pool) - from scope(range)
- Automatic allocation - permanent assignment
- $ sudo apt install isc-dhcp-server
- Important related files
- /etc/dhcp/dhcpd.conf
- /etc/default/isc-dhcp-server
Time sync
- timedatectl or timesyncd - they are part of systemd
- also chrony - chronyd and chronyc
- supports GPSD
- gpsd.gitlab.io/gpsd/hardware.html
- support for NTS(Network Time Security)
- supports GPSD
DPDK
- Data Plane Development Kit
- libraries and drivers for fast packet processing
- provide the EAL(Environment Abstraction Layer)
- hides the details of the environment and provides a standard programming interface
- Common use cases
- special solutions for instance network function virtualization
- advanced high-throughput network switching
- OpenVswitch-DPDK - built in client lib (openvswitch-switch-dpdk)
Remote Administration
- OpenSSH Server
- OpenLDAP Server
- Samba and LDAP
- Kerberos
OpenSSH Server
Tools for the remote control of networked computers and transfer of data between
- replaced insecured telnet and rcp
- ssh client calls sshd server via authenticated session
- secure and encrypted connection - plain passw, public key, Kerberos tickets
- clients: ssh, scp, etc
- packages: openssh-client, openssh-server
- configs: /etc/ssh/sshd_config
- commands: ssh-keygen -t rsa -b 4096 ; ssh-copy-id username@remotehost ; ssh-import-id <username-on-remote-service>
OpenLDAP Server
Lightweight Directory Access Protocol
- for querying and modifying a X.500-based directory service running over TCP/IP
- Accesses directories
- directory - tree of data entries (DIT)
- entry - set of attributes, has unique identifier(DN)
- DN is based on RDN and it's parent entry's DN
- attribute - key and value(s), defined in objectClass(special attr)
- schema - consists of attrs and objectClasses
- Main config files: /etc/ldap/slapd.d ; /etc/ldap/schema
- Commands: ldapwhoami ; ldapadd ; ldapsearch ; ldappasswd ; ldapmodify
- Additional configs: add_content.ldif ; uid_index.ldif ; logging.ldif ; changerootpw.ldif
Samba and LDAP
- Samba 4 is best integrated with its own LDAP server in AD mode
- The NT4 mode - deprecated
More about Samba - later on.. (-;
Kerberos
Network authentication system based on the principal of a trusted third party
- Principal - users, computers, and services provided by servers
- Instances - service and special administrative principals
- Realms - domain or group our hosts and users belong to, uppercase, defult is DNS domain
- Key Distribution Center(KDC) - database, authentication, ticket granting; each realm >= 1 KDC
- Ticket Granting Ticket(TGT) - issued by the Authentication Server(AS), encrypted in user’s passw
- Ticket Granting Server(TGS) - issues service tickets to clients upon request
- Tickets - confirm the identity of user and service requested by the user
- Keytab Files - extracted from the KDC db, contain the encryption key for a service or host
Domain Name Service (DNS)
- Maps IPs with FQDN(fully qualified domain names)
- Configuration - name server
- $ sudo apt install bind9 dnsutils
- Common cases: caching nameserver, primary server, secondary server
- Can be all of them in the same time
- Config files
- global DNS options - /etc/bind/named.conf.options
- for our zones - /etc/bind/named.conf.local
- default (localhost, its reverse, root hints) - /etc/bind/named.conf.default-zones
- More here: ubuntu.com/server/docs/service-domain-name-service-dns
Security
- User Management
- Console Security
- Firewall
- AppArmor
- Certificates
- OpenVPN
- SSSD
User Management
- root disabled by default
- enabling - $ sudo passwd
- sudo - accountability, granular control
- group sudo, config /etc/sudoers
- Commands: adduser ; deluser ; chown ; chmod ; passwd ; addgroup ; delgroup
- Files: /home/username ; /etc/skel ; /etc/passwd ; /etc/group
- Remove/rename /home/username/.ssh/authorized_keys
- External user db auth - centralized (ldap, openid, cas, etc)
- Good password
Good password
- $ chage -l username
- min passw lenght
- passw expiration
- periodically forcing to change passw
- Good passw - Exercise
Console Security
- dis ctrl+alt+del
- $ sudo systemctl mask ctrl-alt-del.target ; sudo systemctl daemon-reload
- ssh captcha - libpam-captcha
- extensions - sentry over fail2ban(denyhosts, sshblacklist, etc)
Firewall
- Netfilter subsystem from Linux kernel
- managed with iptables
- Frontend tools can simplify it
- ufw - simple firewall config tool
- IP masquerading - private machine can access Internet through masquerade-machine
- doable via both: iptables and ufw
- Other tools - shorewall (advanced firewall)
- Logs - rules must come before terminating
AppArmor
- Linux Security Module implementation of name-based mandatory access controls
- installed and loaded by default
- uses profiles of an application to determine what files and permissions the application requires
- some packages will install their own profiles
- additional apparmor-profiles package
Certificates
- public-key cryptography
- public key encrypts, private key decrypts
- app traffic - with SSL(Secure Socket Layer) or TLS(Transport Layer Security)
- Example - apache with https
- Certificate - distributes public key and org
- digitally signed by CA(Certification Authority)
- self-signed (not recommended for prod envi)
- tools: openssl
- $ openssl genrsa -des3 -out server.key 2048
OpenVPN
- Virtual Private Networking (VPN)
- flexible, reliable and secure - originates from SSL/TLS VPN stacks
- Allows to set up a Public Key Infrastructure (PKI)
- uses SSL/TLS certificates for authentication
- and key exchange between the VPN server and clients
- routed or bridged VPN mode
- uses either UDP or TCP, default port 1194 (configurable) covers all communication
- support for all systems - Lin distros, OS X, Win, OpenWRT based WLAN routers, etc
SSSD
- System Security Services Daemon
- Collection of daemons that handle:
- authentication, authorization, and user and group information from a variety of network sources
- Its core supports - Active Directory, LDAP, Kerberos
- Provides PAM and NSS modules to integrate remote sources
- Allows remote users to login and be recognized as valid users, including group membership
- Allow for disconnected operation - cached when network failure, etc
Web Servers
- HTTPD - Apache2 Web Server
- LAMP - Linux, Apache, MySQL, Perl/Python/PHP
- Apache extensions like Tomcat, Kafka, etc
- PHP(5/7/8) - Scripting Language
- ATM, php8.1 - faster, more reliable, plenty of features (like JIT, Union Types, etc)
- Squid - Proxy Server
- full-featured web proxy cache server app
- caching SSL, DNS lookups, transparent caching
- caching protocols - ICP, HTCP, CARP, WCCP
- Ruby on Rails - open source web framework
- for developing database backed web applications
- optimized for sustainable productivity of the programmer
- lets the programmer to write code by favouring convention over configuration
- Nodejs based stacks like MEAN or MERN
Databases
- MySQL, MariaDB
- PostgreSQL
MySQL, MariaDB
- Fast, multi-threaded, multi-user, and robust db server
- Preferred for higher performance requirements
- Intended for mission-critical, heavy-load production systems and mass-deployed software
- Oracle took MySQL - here came MariaDB (-;
- Even faster, more performant and fully open-source
- DB engines - transparent to the end user
- MyISAM - fulltext data type, favours read-only workload, lacks journaling, locking only whole table
- InnoDB - ACID compliant, reliable transactions, locking on row level, journaled(more reliable data recovery)
- Commands: mysgl ; mysqld ; mysqldump ; mysqltuner
PostgreSQL
- Preferred for its attention to standards conformance, features, and extensibility
- Hybrid of relational and OOP approaches
- Streaming Replication
- continuously ships and applies the WAL XLOG records (Write-Ahead Log)
- keeps standby servers current
- Commands: psql ; postgresql
- Package with docs: postgresql-doc-12
Wiki Applications
- Moin Moin
- advanced, easy to use and extensible WikiEngine with a large community of users
- it is about collaboration on easily editable web pages
- MediaWiki
- php based collaboration and documentation platform
- powers Wikipedia and thousands of other websites, companies and organizations
- uses simple markup language - yet stil supports pure html
File Servers
- FTP Server
- downloading files between computers
- also uploading, but insecure - depricated
- Network File System (NFS)
- allows a system to share directories and files with others over a network
- locals use less disk space, same home dir on all machines, less removable medias
- CUPS - Print Server
- Common UNIX Printing System - freely available, portable printing layer
- uses Internet Printing Protocol (IPP), while supports large range of printers
- supports PostScript Printer Description (PPD) and auto-detection of network printers
Email Services
- Postfix
- default Mail Transfer Agent (MTA) in Ubuntu
- fast and secure, with flexibility in administration, compatible with the MTA sendmail
- Exim4
- Message Transfer Agent (MTA) developed at the University of Cambridge
- originally for Unix, can be installed in place of sendmail
- Dovecot Server
- Mail Delivery Agent, written with security primarily in mind
- It supports the major mailbox formats: mbox or Maildir, serves as IMAP or POP3
- Mailman
- open source program for managing electronic mail discussions and e-newsletter lists
- powerful, easy to install and maintain - all the Ubuntu mailing lists are using it
- Mail Filtering - modules like dovecot-sieve, dovecot-antispam
Version Control System
- Bazaar - free software sponsored by Canonical
- doc.bazaar.canonical.com/migration/en/why-switch-to-bazaar.html
- Subversion - based on CVS, improved a lot, centralized
- subversion.apache.org
- CVS Server - good(?) old grandpa (-;
- Mercurial - like git, but with more freedom (-:
- www.mercurial-scm.org
- GIT - "the stupid content tracker"
- distributed, fast, efficient, compressed
Windows Networking
Sharing network resources with Windows computers
- Samba File Server
- Facilitates sharing of files, folders, volumes
- Samba Print Server
- extends CUPS to share printers with Win cli
- Securing a Samba File and Print Server
- Identifying via file permissions, group policies, Kerberos authentication service
- needs additional package - libpam-winbind
- Samba as a Domain Controller - configured to appear as a WinNT4-style
- centralizes user and machine credentials, can work as PDC or BDC
- Samba Active Directory Integration
- Sharing vital information about the computers and users of the network - LDAP, MAD
- Likewise Open - old, depricated, insecure
Backups
- Shell Scripts
- Archive Rotation
- Bacula
- Rsnapshot
Shell Scripts
- File - backup.sh
- $ tar czf "/mnt/backup/$hostname-$day.tgz" "/home /var/spool/mail /etc /root /boot /opt"
- $ chmod u+x backup.sh
- one time - $ sudo ./backup.sh
- periodically - $ sudo crontab -e
# m h dom mon dow command 0 0 * * * bash /usr/local/bin/backup.sh
- restoring - $ cd / ; sudo tar -xzvf /mnt/backup/host-Monday.tgz
- Archive Rotation
- Rotating NFS Archives - grandfather-father-son rotation scheme (monthly-weekly-daily)
Bacula
- Backup, restore, and verify data across our network
- Cross-platform, supports - Lin, Win, MacOS
- Several components and services involved
- Director - main service, controls all the rest
- Console - pure text and GUI
- File(Client) - on each backed up machine, unswers to Director
- Storage - storage and recovery of data to the physical media
- Catalog - maintaining the file indexes and volume databases
- Monitor(only GUI so far) - monitoring of the Director, File and Storage daemons
Rsnapshot
- rsync-based filesystem snapshot utility
- incremental and scheduled backups of local and remote filesystems
- extensive use of hard links - low disk space used
- when remotely - needs SSH without password (OpenSSH)
Virtualization and Cloud Computing
- libvirt
- JeOS and vmbuilder - depricated, EoL
- packer.io - an alternative
- Quemu and KVM
- VirtualBox
- VMware
- EC2
- Containers - lxd, lxc
- Eucalyptus - old, replaced with OpenStack
libvirt
- Used to interface with different virtualization technologies
- kvm-ok - checks if our hardware supports the necessary virtualization extensions for KVM
- Virtual Machine Management - virsh, multipass, uvt, virt-*, openstack
- system and session scope
- migration - offline, live, postcopy
- Device Passthrough vs Hotplug
- can access Qemu monitor
- Huge Pages - allocation, usage
- Apparmor isolation
- Sharing files between Host <=> Guest
Quemu and KVM
- machine emulator
- can run operating systems and programs for one machine on a different machine
- Mostly used as virtualizer with KVM kernel components
- utilizes the virtualization technology of the hardware to virtualize guests
- Upgrading the machine type
- Usage for microvms
VirtualBox
x86 and AMD64/Intel64 virtualization - enterprise and home use
- lots of features
- backed by Oracle and huge community
- high performance
- open source via GPL2
- runs on Win, Lin, Mac, Sol
- offers guests in above and also OS/2, OpenBSD
- guest-additions (mostly for GUIs)
VMware
Not only virtualization
- Platform for applications
- multi-cloud (Telco, etc)
- Networking, security
- Workspace - any-*
EC2
Amazon Elastic Compute Cloud (Amazon EC2)
- humongous web service, mostly for developers
- provides secure, resizable compute capacity in the cloud
- complete control of computing resources
- supports macOS
- Intel, AMD, and Arm-based processors
- ATM: 25 regions and 81 availability zones globally
Containers - lxd, lxc
- lxd - like libvirt
- lightervisor - lightweight container hypervisor
- creates and administers "containers" on a local system
- LXD API deals with ‘remotes’
- uses LXC under the covers
- commands: lxd init ; lxc launch ; lxc image list(info) ; lxc exec ; lxc config ; lxc-remote
- lxc - like QEMU
- Containers are a lightweight virtualization - an enhanced chroot, no full virtualization
- Do not emulate hardware, share the same operating system as the host
- similar to Solaris zones or BSD jails
- implementations in Linux - vserver and OpenVZ ("fathers" of containers)
- commands: lxc-create ; lxc-ls ; lxc-start(stop) ; lxc-info ; lxc-destroy ; lxc-attach
Other
- Keeping /etc under Version Control System
- Block Device Replication
Tools
- byobu
- etckeeper
- munin
- nagios
- pam_motd
- Puppet
Byobu
- xterm multiplexor
- acts as a wrapper to screen or tmux(default)
- multiple shells in one terminal
- more user-friendly
etckeeper
- industry best practice
- stores the contents of /etc in VCS repo (default is GIT)
- integrates with APT
- automatic commits of changes in packages
sudo apt install etckeeper
munin
- networked resource monitoring tool
- helps analyze resource trends and performance issues
- plug and play
- no need to configure - default inst. provides a lot of graphs
nagios
Monitoring of
- Network
- overloaded data links or network connections, routers, switches, etc
- availability, uptime and response time - all in a variety of visual representations and reports
- Server - for Win and Lin
- supports agent-based and agentless monitoring
- above 5000 different addons from community
- Application - Win, Lin, UNIX, Web
- detects application, service, or process problems
- takes action to eliminate downtime for our application users
pam_motd
After logging shows the informative Message Of The Day (MOTD)
- landscape-common - displaying core system data: cpu, memory, disk space, etc
- update-notifier-common - available package updates, impending filesystem checks (fsck), and required reboots
- weather-util, etc
Puppet
- cross platform framework enabling system admins to perform common tasks using code
- installing new software, checking file permissions, updating user accounts, etc
- Useful during the initial inst. of a system, also throughout the system’s entire life cycle
- Mostly used in a client/server configuration
Block Device Replication
Ubuntu HA - DRBD
- Distributed Replicated Block Device (DRBD)
- mirrors block devices between multiple hosts
- transparent to other applications
- Mirrors - any block device hard disks, partitions, RAID devices, logical volumes, etc
sudo apt install drbd8-utils
THE END
Summary - Ubuntu
- Try it and have fun! (-;
- Enjoy the fearless world of debian-based distro
- Stable, safe and yet modern system
- For PL-guys check: ubuntu.pl
Resources
Based on (mostly):
- ubuntu.com/server/docs