Building Home Server with Ubuntu
By Patineboot

I remember the transfer on the trip with the midnight express starting from Vientiane.
Abstract
- Home Server
- Install Ubuntu Server OS
- Configure Ubuntu Server OS
- Store in ZFS filesystem
- Install Samba
Home Server
My good idea…, a photo server.
I remember the memories of my old trip by watching the photos on the home server sometimes. I enjoy it, and my beloved treats me more carefully.
Install Ubuntu Server OS
Get the latest Ubuntu Server OS from “Get Ubuntu Server | Download | Ubuntu.”
I am running the Home Server with Ubuntu Server 22.04 LTS.
Install the Ubuntu Server OS with “Installation guides.”
I choose LVM on the disk image screen on the install wizard.
Ubuntu retrieves an IP address from Wi-Fi Router E9450 made by Linksys, which is in my home network. Linksys Wi-Fi Router leases the static IP address associated with the MAC address.
Configure Ubuntu Server OS
TimeZone
Set JST (Japan Standard Time) to timezone on Ubuntu.
timedatectl set-timezone Asia/Tokyo
Multicast DNS
Install a multicast DNS service for easy access from Macbook pro.
apt install avahi-daemon
Notify Auto-Updated on Mail
Configure /etc/apt/apt.conf.d/50unattended-upgrades:
Unattended-Upgrade::Mail "xxxxx@patineboot.com";
Unattended-Upgrade::Sender "<User account>@<SMTP Server Domain>";
Unattended-Upgrade::MailReport "on-change";
Read this article more, I find installing a SMTP client.
Install the SMTP client
Introduce SMTP client
I require an MTA (Mail Transport Agent) which involves the mailx
command.
- unattended-upgrades on
apt
usesmailx
. - ZED in the ZFS filesystem uses
mail
.
msmtp is really simple, but S-nail has the useful feature of re-sending an e-mail.
Ubuntu does not provide S-nail the mailx
alias.
The workaround is the following from “The commands which sending easy, mailx(s-nail/bsd-mailx)!”.
Add S-nail to mailx
in alternatives
sudo update-alternatives \
--install /usr/bin/mailx mailx /usr/bin/s-nail 10 \
--slave /usr/bin/mail mail /usr/bin/s-nail \
--slave /usr/share/man/man1/mail.1.gz mail.1.gz /usr/share/man/man1/s-nail.1.gz \
--slave /usr/share/man/man1/mailx.1.gz mailx.1.gz /usr/share/man/man1/s-nail.1.gz \
Update alternatives for mailx
.
# update the mailx to set S-nail
sudo update-alternatives --set mailx /usr/bin/s-nail
# update the mailx to remove S-nail
sudo update-alternatives --remove mailx /usr/bin/s-nail
I install msmtp for simple installation.
Install MSMTP with others
Install the msmtp, msmtp-mta, and bsd-mailx packages.
msmtp is an SMTP client, msmtp-mta makes the sendmail alias with the msmtp
command. bsd-mailx provides the mail
/mailx
commands by using the sendmail alias internally.
sudo apt install msmtp msmtp-mta bsd-mailx
Note: The example of configuring msmtp are /usr/share/doc/msmtp/examples/.
Create a configure file at /etc/msmtprc.
# Set default values for all following accounts.
defaults
aliases /etc/aliases
port 587
tls on
tls_host_override <SMTP Server Domain which responded>
# A freemail service
account patine
host <SMTP Server Domain>
from <From address>
auth on
user <User account>@<SMTP Server Domain>
password <Passphrase>
account default : patine
Create the aliases file at /etc/aliases.
# from root forward <User account>@<SMTP Server Domain>
root: "xxxxx@patineboot.com"
# from any accounts forward <User account>@<SMTP Server Domain>
default: "xxxxx@patineboot.com"
Store in ZFS filesystem
Create Logical Volume on LVM
I create logical volume using the ZFS filesystem.
Run the lvcreate
command, which creates a logical volume in a volume group.
The ubuntu-vg volume group already exists, lvcreate
command options are:
- Name: rootpool-lv
- Size: the rest size on the volume group
- Volume Group: ubuntu-lv
lvcreate -n rootpool-lv -l 100%FREE ubuntu-lv
Note: The following LVM commands are available: pvcreate
, vgcreate
, lvcreate
, pvs
, vgs
, lvs
Standing on ZFS filesystem
Install, Configure, and Store files in the ZFS filesystem on Ubuntu.
Jump to the ZFS article, “Standing on the ZFS filesystem on Ubuntu,” so do it.
Operating Samba connected with macOS
Operate Sambe with macOS and Raspberry Pi OS on the ZFS filesystem.
Building the Happy Media Server with the “Operating Samba connected with macOS” article is accomplished.