Setup
Installation
- Download the latest ISO image of Ubuntu Server OS from this link.
- It's recommended to use Alternate Mirror (Singapore/India) for faster downloads.
- Use Balena (Etcher) on MacOS to burn the downloaded ISO image on to a USB drive.
- Connect the USB to the server machine and restart it to install the OS.
- You may have to change the boot order.
- The installation process is pretty straight forward, but if you need assistance, this official guide will help.
- Here are the details to be filled during installation:
- Language: English
- Keyboard Layout: English (US)
- Base for installation: Ubuntu Server (Don't use
minimized) - Storage configuration: Choose
Custom Storage Layout(See details below on how to configure this) - Name: Pirate Developer
- Server Name: pirateserver
- Username: piratedev
- Password:
See iCloud KeyChain - Ubuntu Pro: Skip
- Check Install OpenSSH server
- Import SSH identity from GitHub (Username: PirateDevCom)
- Custom Installations
- microk8s
- docker
- etcd
- aws-cli
- Reboot the device after installation.
- You'll be asked to remove USB drive and press ENTER.
Custom Storage Layout
- First
Reformatall the drives (should result in free space after reformat). - Select a drive and choose
Add GPT Partitionon the free space and select a partition for/bootand give at-least30Gsize and useext4format. - Create another partition with at-least
50GBfor/homepartition. This helps isolate the operating system drive from your data drive. - Optionally, create another partition for
/filespartition. This will serve as the folder for File Server process, to share data within local network.- If you have multiple drives, you can dedicate one drive for this, so that it's easy to migrate later.
- Use remaining space for
/partition.
SSH Setup
The first thing you should do after installation is to update repos and upgrade packages:
# You'll be prompted for password to gain sudo access
sudo apt update && sudo apt upgradeThe OpenSSH should be already installed on the server, but it may not be enabled by default. But before you enable it, you must secure the server by disabling root login. To do so, edit the SSH config present at /etc/ssh/sshd_config:
# Edit using `sudo vi /etc/ssh/sshd_config`
Port 22
ListenAddress 192.168.1.100
PermitRootLogin noEnable and restart SSH service using:
# Gives current status
sudo systemctl status ssh
# Enable SSH service (to start automatically after each boot)
sudo systemctl enable ssh
# Restart SSH service
sudo systemctl restart ssh
# Check current status after restart
sudo systemctl status sshSince you've imported GitHub SSH keys, you should now be able to SSH into homeserver from your Mac machine.
Post-installation Setup
The OS installation is completed, but you'll need other packages and tools to make proper use of the home server. For this post-installation setup, SSH into the homeserver from MacOS device using:
ssh piratedev@192.168.1.100Disable Ubunto Pro Advertisement messages
Reference Docs
# Check current APT News status
sudo pro config show apt_news
# Disable APT News
sudo pro config set apt_news=false
# Disable Pro messages from APT
mkdir -p ~/docs && sudo mv /etc/apt/apt.conf.d/20apt-esm-hook.conf ~/docs/
# Disable Pro messages from MOTD
sudo cp /var/lib/update-notifier/updates-available ~/docs/
sudo vi /var/lib/update-notifier/updates-available
# Remove unnecessary linesEnable Firewall
- Get the current status of Firewall and enable it using:
sudo ufw status verbose
sudo ufw enable- Allow all traffic from IPs within local network using:
# This allows all traffic within local network
sudo ufw allow from 192.168.1.0/24- Check status again using
sudo ufw status verbose.
Install Python
Python 3 is already available on Ubuntu server, but it's managed by apt package manager. So it won't let you install pip packages directly without using a virtual environment. So in order to install Python packages, install them using apt install python3-package foramt.
DO NOT upgrade to latest version of Python to avoid issues.
sudo ln -s /usr/bin/python3 /usr/local/bin/pythonInstall Node and Yarn
Here are the steps for current verion v22 from this official page.
# Download and install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
# in lieu of restarting the shell
\. "$HOME/.nvm/nvm.sh"
# Download and install Node.js:
nvm install 22
# Verify the Node.js version:
node -v # Should print "v22.14.0".
nvm current # Should print "v22.14.0".
# Download and install Yarn:
corepack enable yarn
# Verify Yarn version:
yarn -vInstall Java and Scala
Install Java first:
sudo apt install openjdk-11-jdk -yDownload and Install Scala 3:
curl -fL https://github.com/coursier/coursier/releases/latest/download/cs-x86_64-pc-linux.gz | gzip -d > cs && chmod +x cs && ./cs setupAdd symlinks:
sudo ln -s ~/.local/share/coursier/bin/scala /usr/bin/scala
sudo ln -s ~/.local/share/coursier/bin/scalac /usr/bin/scalac
sudo ln -s ~/.local/share/coursier/bin/amm /usr/bin/ammConfirm installation:
scala --versionConfigure Git CLI
- Execute following commands:
git config --global user.name "Pirate Developer (homeserver)"
git config --global user.email "57877111+PirateDevCom@users.noreply.github.com"Create RSA Keys
ssh-keygen -t rsa -b 4096
# Give a passphrase when promptedSetup SSH Agent
Add following line to ~/.profile to start SSH Agent on login:
eval "$(ssh-agent -s)"Execute the following command once and set the environment variables from the output message:
ssh-agent -sThen execute the following command to your SSH Key to the SSH Agent:
ssh-add
# Enter passphrase when promptedUpload SSH Key to GitHub
- Copy the generated public key to clipboard:
cat ~/.ssh/id_rsa.pub- Navigate to this GitHub link and upload the SSH key.
Configure Personal Docs
Configuring the personal docs (this repo) will make it accessible as a website within local network.
Clone GitHub repo:
mkdir ~/github && cd ~/github && git clone git@github.com:PirateDevCom/personal-docs.gitInstall dependencies and start local server as a background process:
cd ~/github/personal-docs && yarn install && nohup yarn docs:dev --host > /tmp/vitepress.log 2>&1 &In order to run the web server as a service, create a service file using:
# sudo vi /etc/systemd/system/piratedocs.service
[Unit]
Description=PirateDev Docs Server
After=network.target
[Service]
Type=simple
User=piratedev
WorkingDirectory=/home/piratedev/github/personal-docs
ExecStart=/home/piratedev/.nvm/versions/node/v22.14.0/bin/node /home/piratedev/.nvm/versions/node/v22.14.0/bin/yarn docs:dev --host
Restart=always
RestartSec=5
Environment="PATH=/home/piratedev/.nvm/versions/node/v22.14.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Environment="NODE_VERSION=22.14.0"
StandardOutput=append:/var/log/vitepress.log
StandardError=append:/var/log/vitepress.log
[Install]
WantedBy=multi-user.target- Enable and start the service using:
sudo systemctl enable piratedocs
sudo systemctl start piratedocsYou should now be able to access the website at http://192.168.1.100:5173/
Optional: Install Samba (File Server)
To setup homeserver as a file server accessible from Apple's Files app, you'll need to install and configure Samba:
sudo apt install samba -yIf you had followed the steps properly, you would have a /files partition dedicated for file serving. Create a folder inside it for connecting to Samba:
sudo mkdir /files/icedrive
sudo chmod 777 /files/icedrive
sudo chown piratedev:piratedev /files/icedriveConfigure Samba by editing /etc/samba/smb.conf file:
# Edit using `sudo vi /etc/samba/smb.conf`
[IceDrive]
path = /files/icedrive
browseable = yes
read only = no
guest ok = no
create mask = 0666
directory mask = 0777Create Samba User:
sudo smbpasswd -a piratedev
# Enter a password when promptedRestart Samba Service:
sudo systemctl restart smbdAt this point, you should be able to connect to the homeserver from Files app remotely.
Help
Debug SSH connection issues
To confirm that SSH service is listening on Port 22, use:
sudo ss -tulpn | grep :22
# This should return something like this:
# tcp LISTEN 0 4096 192.168.1.100:22 0.0.0.0:* users:(("sshd",pid=1390,fd=3),("systemd",pid=1,fd=92))From MacOS, check if the host is reachable by pinging it:
ping 192.168.1.100If ping works but SSH says Connection Refused, it's mostly due to some issue with Homeserver hardware components. You should keep trying until it works. A couple of restarts may work sometime.
GitHub SSH Keys
In case you forgot to download GitHub keys during installation or if you deleted ~/.ssh/authorized_keys by mistake, you can re-download them using:
wget https://github.com/PirateDevCom.keys
mv PirateDevCom.keys ~/.ssh/authorized_keysDelete Firewall rules
If you need to delete existing firewall rules, you need to first list them as numbered ones:
sudo ufw status numberedUse the number against the rule to be deleted and use:
sudo ufw delete [RuleNumber]Check status again using sudo ufw status verbose.
Upgrade distribution
To upgrade Ubuntu itself, use:
sudo do-release-upgrade