Simple Install Ubuntu Server with Docker
This article is intended to provide an easy, step-by-step guide to install Ubuntu server with Docker on a new or existing machine.
Prerequisites
You need:
- A USB drive big enough to install Ubuntu (more than 2GB is fine)
- A computer with a working internet connection to download Ubuntu and setup the USB
- A computer you want to install Ubuntu on with an ethernet network connection. These steps will likely erase any existing data on that machine so be sure you want to do that!
Step 1: Get Ubuntu Server Image
- Head over to https://ubuntu.com/download/server
- Select “Option 2 — Manual Server Installation”
- Click Download Ubuntu Server 20.04.2 LTS:
That’s it! The Ubuntu server image should be downloaded to your usual download directory.
Step 2: Create a bootable USB
This step will write the image from the first step to a USB drive so you can use that USB to install Ubuntu on any machine you require. The steps vary depending on the OS you are using, so choose from one of the following:
- Windows: https://ubuntu.com/tutorials/create-a-usb-stick-on-windows#1-overview
- MacOS: https://ubuntu.com/tutorials/create-a-usb-stick-on-macos#1-overview
- Ubuntu: https://ubuntu.com/tutorials/create-a-usb-stick-on-ubuntu#1-overview
The above guides are very comprehensive so I wont repeat the steps. Just remember to use the file you downloaded in step 1 whenever “ISO” or “Image” is referred to.
Step 3: Boot from the USB
Insert the USB into the machine you want to install Ubuntu on and start it up. You should see a lot of text as the installer boots up and finally the first Install page:
Step 4: Setup the Installation
The steps are straight forward navigating up and down to highlight options, enter to alter them and then navigate to Done and press enter to move to the next page:
- Select your language — this should be straightforward.
- Select your keyboard layout — again this should be self explanatory.
- Select your Network Connections — this should be configured for you if you are using an ethernet connection so all you have to do is press enter on Done.
- Configure proxy — i’m assuming you dont need a proxy so select Done and continue.
- Configure Ubuntu archive mirror — This should be set to the default value, so you can select Done and continue.
- Guided storage configuration — you should be presented with something similar to this:
Your disk size and name will likely be different, but this does not matter. Feel free to add encryption and a password if you desire and then hit Done.
- Storage configuration — you should see something similar to this:
If your sizes and device names are different to this do not worry — this is expected depending on the size and make of your hard drive. Move to Done and press enter. You will be asked to confirm the installation by selecting Continue. This will erase data currently on that device so be sure at this point that is what you want to do!
Step 5: Configure your server
The installation should start in the background whilst you configure your server:
- Profile setup — supply your profile details:
Remember to choose a secure password! Your server’s name is up to you — pick something memorable so you can easily identify it in future.
- SSH Setup — If you want to be able to communicate with this machine via SSH (command line remote access) then you should enable SSH. This is recommended if setting up a Cardano node:
Press enter on Install OpenSSH server, which should add an x in the box next to it. Then move to Done and press enter
- Featured Server Snaps — this is where you choose additional software to install, you should highlight docker and prometheus so they have an asterisk * next to them:
Move to Done and press enter.
- The installation will continue now:
Wait for this until the title changes to “Install complete!” like so:
You can choose to wait for the updates to install or navigate to “Cancel update and reboot”. If you choose to wait the option will change to “Reboot Now” — hit enter on this. You may be prompted to “remove the installation medium, then press ENTER:” — this simply means remove the USB drive and press Enter.
Step 6: Reboot in to your new install!
Once you have rebooted you should be presented with a screen like this:
Select the first option and press enter. It may take a while to start up on the first attempt so be patient. You will soon be presented with the command line login:
Login by entering the username you chose during installation setup, press enter then enter your password and enter again.
Step 7: Configure Docker
You should configure your user to use docker — this is not as difficult as it might sound! Firstly you should have a command prompt like this:
This is the profile username you set up then “@” then the hostname you setup during installation — so don’t worry if they are different to the values we had as long as they match yours. At the command prompt type:
sudo groupadd docker
You will be prompted to enter your password again. This is because the action requires sudo
which is a higher level of permissions. This has created a new group called docker that will determine who can use docker. Next type:
sudo usermod -aG docker $USER
Be careful with the syntax here and copy it exactly including the capitalisation. This adds your user to the docker
group you just created. You must now reboot the machine — you can do this by typing:
reboot
Step 8: Verify your docker installation
Once you have logged back in to the server type the following:
docker ps
You should see some output similar to this:
Success! You have set up an Ubuntu server and configured your user to use docker
. You can run the “hello world” docker app like so to prove it is working:
docker run hello-world
You should see some output similar to this:
And that’s it! You have a running Ubuntu server with docker installed!
If you are interested in ADA Staking or Cardano please visit our website for more information: https://www.lambda-honeypot.com