setupadmin@tin:~$ sudo apt update
Hit:1 http://ca.archive.ubuntu.com/ubuntu jammy InRelease
Hit:2 http://ca.archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:3 http://security.ubuntu.com/ubuntu jammy-security InRelease
Hit:4 http://ca.archive.ubuntu.com/ubuntu jammy-backports InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
2 packages can be upgraded. Run 'apt list --upgradable' to see them.
setupadmin@tin:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
python3-update-manager update-manager-core
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
Introduction
Describes production proven Bonsai Framework approach to setup of a Ubuntu Server version 22.
Bash script version is also maintained for quick setup.
Initial Setup
To follow through these tutorials you should have basic understanding of networks and know how to edit files on Ubuntu through terminal or sftp.
For security reasons may want to replace the account names in this tutorial especially setupadmin with something else of your choosing.
Download
If you are working for a large organization, it is recommended to use the LTS (Long Term Support) version,
https://www.ubuntu.com/download/server
Hosting at Home
Before paying for hosting, practice on your desktop using virtualization technology. If you have minimal needs, you might want to host from home. Follow this article for Home Server Virtualization.
Installing from Scratch in a Virtual Environment
Boot up your Virtual Server.
Be default, "*Try or Install Ubuntu Server" will be selected. Hit "Enter".
Language selection : Use the Up/Down arrow keys to select your language and then hit "Enter".
Installer update available : If you have a fast connection use "Update to the new installer". "Enter".
Keyboard configuration : "Enter" unless you have a special keyboard.
Choose type of install :
- Use your up arrow to move the cursor to "Search for third-party drivers" and hit space-bar to enable, it will select it like this "[X]"
- Go back down to "Done" and hit "Enter".
Network connections : You should see something under NAME adjacent to DHCPv4. Record it. In my case, ens33 and 10.0.0.211/24. "Enter".
Configure proxy : You should not be using a proxy for home use. "Enter".
Configure Ubuntu archive mirror : Some values will start showing up. You should see somethign like "Hit:1 http://...". Once you see "Reading package lists...", hit "Enter".
Guided storage confguration : Move to Done and "Enter".
Storage configuration : "Enter".
Confirm destruction action : select "Continue", "Enter"
Profile setup :
- Your name: Setup Admin
- Your server's name: tin (whatever you want, but don't use spaces or strange charcters)
- Pick a username: setupadmin
- Choose a password: The Bonsai Framework password standard should suffice.
- Done
Upgrade to Ubuntu Pro : We won't need so "Enter".
SSH Setup : Hit space-bar to select then select "Done", "Enter".
Third-party driver : You may see "No applicable third-part drivers are available locally or online". That is fine. "Continue".
Featured Server Snaps : Navigate to "Done", "Enter".
Stuck : At this point you'll see the Ubuntu OS being installed and and when complete you'll see "Reboot Now", select and "Enter", you might see some messages,
- [FAILED] Failed unmounting /cdrom
- Please remove the installation medium, then press ENTER:
Go ahead and press "Enter" and you may love your mouse control for a bit. That's ok, just wait.
Reboot Complete : Due to quirk in virtual machines, you may not see your prompt to login. Instead you might see "[ OK ] Reached target Cloud-init target. That's ok, just hit "Enter" and then you'll see the login prompt. IN my case, "tin login: ".
Hosting Company
When using a hosting company, currently KVM based solutions the most cost effective where 1GB of RAM is required. See the Bonsai Framework discussion on Hosting for further details.
Cloud
You may also consider using Cloud with instructions here,
- Azure (to write though it's pretty point and click)
- AWS
Starting from a Server Hosted Solution
With most Virtual Server Hosting solutions you will be asked to select a virtual server image operating system which is then built as defined by the hosting provider. Some providers also allow you to install from a linked iso image which provides the most fined grained control and security.
Some hosting providers modify the Ubuntu Setup or only let you load a pre-configured image. In that case they are just asking for credentials.
With older hosting provider they may ask for a root password. Make sure to select a VERY complex password for the root account. It might be a little annoying, but as you walk through the article you will find that we actually stop using root altogether.
Modern Cloud servers like Microsoft Azure will create a default user account or provide option to provide your public ssh keys. For now choose password. SSH keys with how to load them into your OS will be covered later.
Login
The very first thing to do is to log into the server. There are two main types of login, remote and console.
With a remote login, you are not physically at the machine. This is often accomplished using SSH. By default following these instructions SSH login will not be enabled.
With a console login, you are for all intents and purposes physically at the server. Most hosted solution provide a web based interface to simulate this type of behaviour.
We'll start with console login in your virtual machine and you'll see something like below. Note your IPv4 address, in my case 10.0.0.211.
Welcome to Ubuntu 22.04.3 LTS (GNU/Linux 5.15.0-91-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage System information as of Thu Dec 21 06:18:18 AM UTC 2023 System load: 0.009765625 Usage of /: 8.4% of 57.77GB Memory usage: 19% Swap usage: 0% Processes: 201 Users logged in: 1 IPv4 address for ens33: 10.0.0.211 IPv6 address for ens33: 2607:fea8:52a1:ce00::a5c2 IPv6 address for ens33: 2607:fea8:52a1:ce00:20c:29ff:fe64:cfb1 Expanded Security Maintenance for Applications is not enabled. 44 updates can be applied immediately. To see these additional updates run: apt list --upgradable Enable ESM Apps to receive additional future security updates. See https://ubuntu.com/esm or run: sudo pro status Last login: Thu Dec 21 06:14:05 2023 setupadmin@tin:~$
Security First
I usually immediately install fail2ban,
sudo apt-get install fail2ban
You don't need to know what it does right away (other than it blocks a user from logging for a period of time after too many incorrect passwords) but it makes your box much safer.
If your system is on the Internet and you only have SSH login with a user name and password, make sure it is strong. Your password can be broken in within minutes.
You also want to go straight to SSH RSA Key Based Authentication.
Synchronize Server Time
The ntp daemon calculates the drift of your system clock and continuously adjusts it.
Determine the systems current timezone,
date # determine current timezone
If you did a fresh setup, you should have the correct time zone and you can skip this step. If your timezone is incorrect, change it,
sudo dpkg-reconfigure tzdata # sets the timezone
Before proceeding to below instructions, please do an update on ubuntu setup
sudo apt-get update # updates your basic installation
Install the ntp daemon,
sudo apt-get install ntp
If you do not want to spare the processing power and memory, consider using other approaches documented by the Ubuntu Community or the traditional cron approach.
Select a Locale
If you used a hosting company like Slice or Rackspace chances are the server image provided is minimal with no locale set. This will cause problems with Perl (used to install quite a few things) and in my case, it caused me head-aches setting up PostgreSQL.
locale # Look at your current locale. LANG=en_CA.UTF-8 LC_CTYPE="en_CA.UTF-8" LC_NUMERIC="en_CA.UTF-8" LC_TIME="en_CA.UTF-8" LC_COLLATE="en_CA.UTF-8" LC_MONETARY="en_CA.UTF-8" LC_MESSAGES="en_CA.UTF-8" LC_PAPER="en_CA.UTF-8" LC_NAME="en_CA.UTF-8" LC_ADDRESS="en_CA.UTF-8" LC_TELEPHONE="en_CA.UTF-8" LC_MEASUREMENT="en_CA.UTF-8" LC_IDENTIFICATION="en_CA.UTF-8" LC_ALL= setupadmin@tinman:~$
If the results show an error or the locale is not set up for UTF-8 as shown above, then run the following commands,
If you are not from Canada, you can choose another language, just make sure to use UTF-8.
sudo locale-gen en_CA.UTF-8 sudo update-locale LANG=en_CA.UTF-8
If you changed the locale, log off and then back on.
Finally, verify the locale changes took effect,
setupadmin@tinman:~$ locale LANG=en_CA.UTF-8 LC_CTYPE="en_CA.UTF-8" LC_NUMERIC="en_CA.UTF-8" LC_TIME="en_CA.UTF-8" LC_COLLATE="en_CA.UTF-8" LC_MONETARY="en_CA.UTF-8" LC_MESSAGES="en_CA.UTF-8" LC_PAPER="en_CA.UTF-8" LC_NAME="en_CA.UTF-8" LC_ADDRESS="en_CA.UTF-8" LC_TELEPHONE="en_CA.UTF-8" LC_MEASUREMENT="en_CA.UTF-8" LC_IDENTIFICATION="en_CA.UTF-8" LC_ALL= setupadmin@tinman:~$
Update Repositories
Check if you're up to date,
sudo apt update Hit:1 http://ca.archive.ubuntu.com/ubuntu jammy InRelease Hit:2 http://ca.archive.ubuntu.com/ubuntu jammy-updates InRelease Hit:3 http://security.ubuntu.com/ubuntu jammy-security InRelease Hit:4 http://ca.archive.ubuntu.com/ubuntu jammy-backports InRelease Reading package lists... Done Building dependency tree... Done Reading state information... Done 45 packages can be upgraded. Run 'apt list --upgradable' to see them.
In my case I have 45 packages that can be updated. I'll update them,
sudo apt upgradeReading package lists... Done Building dependency tree... Done Reading state information... Done Calculating upgrade... Done The following NEW packages will be installed: ubuntu-pro-client-l10n The following packages have been kept back: python3-update-manager update-manager-core The following packages will be upgraded: apparmor apt apt-utils bind9-dnsutils bind9-host bind9-libs cloud-init cryptsetup cryptsetup-bin cryptsetup-initramfs distro-info-data git git-man initramfs-tools initramfs-tools-bin initramfs-tools-core irqbalance kpartx libapparmor1 libapt-pkg6.0 libcryptsetup12 libldap-2.5-0 libldap-common libnetplan0 libnss-systemd libpam-systemd libsgutils2-2 libsystemd0 libudev1 multipath-tools netplan.io python3-software-properties sg3-utils sg3-utils-udev software-properties-common sosreport systemd systemd-hwe-hwdb systemd-sysv systemd-timesyncd ubuntu-advantage-tools ubuntu-drivers-common udev 43 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. Need to get 19.2 MB of archives. After this operation, 5,565 kB disk space will be freed. Do you want to continue? [Y/n]
Just hit "Enter" is the same as typing Y then hitting "Enter".
If you see a prompt to restart services, go ahead and move the cursor to OK, "Enter".
You can confirm you upgrade with running the "update command" again.
setupadmin@tin:~$ sudo apt update Hit:1 http://ca.archive.ubuntu.com/ubuntu jammy InRelease Hit:2 http://ca.archive.ubuntu.com/ubuntu jammy-updates InRelease Hit:3 http://security.ubuntu.com/ubuntu jammy-security InRelease Hit:4 http://ca.archive.ubuntu.com/ubuntu jammy-backports InRelease Reading package lists... Done Building dependency tree... Done Reading state information... Done 2 packages can be upgraded. Run 'apt list --upgradable' to see them.
In this case there's two packages that have been held back. That's ok.
Update Server
General Upgrades
Next perform a dist-upgrade.
sudo apt dist-upgrade # upgrade to the newest kernel
Once you have applications and software running and stable, it is advisable to only perform incremental upgrades and judiciously perform dist-upgrades as appropriate.
During the update, all the update installers are downloaded to your system and kept there for future reference in case you need to re-install. With fast connections, this is not necessary. Clean up,
sudo apt autoclean # use this if you only want to clean out nolonger used packages sudo apt clean # clean out all downloaded packages - I usually use this one sudo apt autoremove # cleans out unused packages
Read Upgrading Ubuntu Packages for more in depth details.
Since this is still a fresh system, restart the system,
sudo reboot
Shutdown Server
Shutdown your server with this command,
sudo shutdown -h now
Next Steps
Continue to Ubuntu Firewall Software.
2 Comments
Tin Pham
I've moved Baski's question here,
This screen appeared and no instruction to resolve,
Tin Pham
The answer is you should not be getting this screen.
Based on what I see, the VMWare image was created with an unsupported hard disk type. Destroy the VM and create one using the wizard. Make sure to pick the appropriate Ubuntu which will ensure the right type of hard disk type is generated.