Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit

* Add Vagrantfile for Jammy

* Fix configuration of NTP for Jammy

* Update setup text to be more accurate

* Update README

Git stats


Failed to load latest commit information.
Latest commit message
Commit time
April 18, 2022 04:57
December 1, 2016 20:02
April 18, 2018 15:12
December 1, 2016 19:56
April 18, 2022 04:57
April 18, 2022 04:57

Bash setup script for Ubuntu servers

Build Status

This is a setup script to automate the setup and provisioning of Ubuntu servers. It does the following:

  • Adds or updates a user account with sudo access
  • Adds a public ssh key for the new user account
  • Disables password authentication to the server
  • Deny root login to the server
  • Setup Uncomplicated Firewall
  • Create Swap file based on machine's installed memory
  • Setup the timezone for the server (Default to "Asia/Singapore")
  • Install Network Time Protocol


SSH into your server and install git if it is not installed:

sudo apt-get update
sudo apt-get install git

Clone this repository into your home directory:

cd ~
git clone

Run the setup script

cd ubuntu-server-setup

Setup prompts

When the setup script is run, you will be prompted to enter the username of the new user account.

Following that, you will then be prompted to add a public ssh key (which should be from your local machine) for the new account. To generate an ssh key from your local machine:

ssh-keygen -t ed25519 -a 200 -C "user@server" -f ~/.ssh/user_server_ed25519
cat ~/.ssh/

Finally, you will be prompted to specify a timezone for the server. It will be set to 'Asia/Singapore' if you do not specify a value.

Supported versions

This setup script has been tested against Ubuntu 14.04, Ubuntu 16.04, Ubuntu 18.04, Ubuntu 20.04 and Ubuntu 22.04.

Running tests

Tests are run against a set of Vagrant VMs. To run the tests, run the following in the project's directory: