Ubuntu 20.04 Ssh Server Install

broken image


In this post I explain how to install Ubuntu Server 20.04 LTS from a USB drive, how to properly set up the BIOS of your home server, how to easily access your Linux server from a Windows machine, and discuss the basic monitoring tools that I like to install on any new server.

  • While OpenSSH client is installed out-of-the-box, you can do following steps to install and setup OpenSSH server in Ubuntu 20.04. First open terminal and run command to install the packages: sudo apt install ssh.
  • A) You need to have a running Ubuntu 20.04 Server. B) You should have apt tool.

View SSH Key Secure SSH Server in Ubuntu. In order to secure the SSH daemon you should change the default SSH port number from 22 to a random port, higher than 1024, and disallow remote SSH access to the root account via password or key, by opening SSH server main configuration file and make the following changes. $ sudo vi /etc/ssh/sshdconfig. Download Ubuntu 20.04 LTS Server ISO file. Download ISO file of Ubuntu 20.04 LTS server using.

This tutorial is aimed at beginners and does not cover more in-depth topics such as installing SSH keys or setting up a firewall. If you are interested in these topics then go to my next post!

Prerequisites

  • A computer which you want to dedicate as server
  • An empty USB drive

1. Download and burn Ubuntu ISO

First, download the Ubuntu ISO from here: https://ubuntu.com/download/server

Can

Then download a small utility which allows you to burn the ISO to a USB drive: https://rufus.ie/

Ubuntu 20.04 Ssh Server Installieren

  • Run Rufus.exe
  • Select your USB drive
  • Select the Ubuntu 20.04 LTS ISO
  • You can change the volume label if you want to
  • Click on START

2. Configure your BIOS

Before continuing with the installation of Ubuntu Server 20.04 LTS on your machine, you should set up a few options in the BIOS of your server. Most importantly, check whether all RAM sticks are properly recognized and if your CPU temperatures are in check.

  • Set up your fan curves
  • Make sure to select the correct primary graphics adapter: Either onboard or PCIe depending on whether you have a GPU installed or not (found under northbridge configuration on my board)
  • Set your server to power on after power loss (found under southbridge configuration on my board)
  • Enable boot from LAN (listed under boot on my board)
  • Modify boot order to boot from USB drive first!

3. Install Ubuntu Server 20.04 LTS

Make sure to unplug your USB drive from the server after hitting 'REBOOT' as otherwise you will go into an infinite loop of installing Ubuntu over and over again!

You should now be able to log-in on your server using the username and password specified during the installation procedure.

4. Setting up your router

I personally prefer not needing to connect a mouse, keybard, and monitor to my home server and rather administrate it from my Windows machine.

To this end, we need to configure a few things in our router's settings. Enter 192.168.1.1 or whatever the default gateway of your router is (you can generally find this information on a sicker attached to the back of your router) and log in (again, login credentials are often found on your router).

Go to the network configuration and make sure that you always assign the same local IP address to your home server. This is important, because we want to use this IP address when we connect to our server from another computer in our network.

Additionally, if you want to be able to adminstrate your server from outside of your home network, you need to port-forward port 22 to your home server.

Port forwarding the default port (22) for SSH is not considered to be best practice. This can open your server to brute force attacks on your server. I will explain how to set up a different port and how to properly secure your home server in my next post!

5. Access server from Windows

In order to access my home server from Windows, I like to enable the WSL (windows subsystem for Linux) and use the Windows Terminal app.

Here's a tutorial on how to install WSL on your Windows machine: https://docs.microsoft.com/en-us/windows/wsl/install-win10

You can log-in to your server using the following command:

where is the username which you have just set up above and your server's local IP address.

Alternatively, you can also set up an alias, which lets you ssh to your server much more conveniently

6. Initial server setup

The first steps you should take after installing Ubuntu Server 20.04 LTS is to update your server

Additionally, I like to completely remove snap since I prefer to install my applications the regular way (this step is optional). For this, first list all installed snaps

then remove all snaps, uninstall snapd, and remove any remaining snap directories.

Make sure to uninstall the snap core least in order to avoid any issues while uninstalling snapd


7. Monitor temperatures

Finally, here are a few useful tools that allow you to monitor your servers CPU and HDD temperatures.

First, install lm-sensors and detect available temperature sensors

There will be a bunch of questions that pop up during which you should all answer with yes.

Next, reboot your system

Now you can type in order to get a load of information on your systems temperatures

Openssh Ubuntu 20

To monitor your hard drive temperatures, install hddtemp

Next, get the drive identifier for any hard drive you want to check by typing

and then finally get the temperature readings for that drive using

And that's it! Your Ubuntu Server is up and running an you can start installing software and go ham. Have fun in the world of endless possibilities of Linux 🙂

A quick guide to setup a SSH-conncection to Virtual Machine Ubuntu Server 20.04

This article shall serve to prevent wasting hours looking for the pitfalls I encountered setting up Ubuntu Server 20.04 on my Virtual Box host (Ubuntu, Windows and Mac).

Install Ubuntu Server Image in Virtual Box

Download and install the .iso-file as described here. It's quite straightforward:https://hibbard.eu/install-ubuntu-virtual-box/Install openSHH right away or install it afterwards with

Ubuntu Server

Ubuntu Server comes without a GUI and nice advanced terminal features like a clipboard. You could install tmux but a more elegant way is to use a shell from your host.

Port Forwarding

Now, on a normal server connected to the same network, you could just SSH in the server right away (if configured right).Running ‘ifconfig' on your Ubuntu server will show a strange IP like‘10.0.2.15'which has to do with the way Virtual Box treats the virtual machine.If you try to SSH in your virtual machine you will get a misleading error

In case it was really a connection timeout you could just open the ssh config file

and change the line

but this is not the issue here!

As always stackoverflow gets straight to point even though detailed descriptions are missing. The solution is simple port forwarding. Just follow the steps:

Ubuntu 20.04 Ssh Server Installer

  1. Turn off VM
  2. Go to settings -> network -> adapter1 -> advanced -> port forwarding
  3. Create an entry with Name: ForwardPort (could also be anything else), Protocol: TCP, Host-IP: 127.0.1.1, Host-Port: 2222 (could also be 22 or any other unbmer as long as not occupied already on host), Guest-IP: 10.0.2.15, Guest-Port: 22
  4. Confirm, start VM, log in. SSH server starts automatically.
  5. On host enter in terminal

And there we go! I logged in as user dome on my host ubu.

Transfering files

Use scp. If you want to transfer a file from guest to host use

Windows SSH support

Since Windows 10 Windows comes with openSSH, so no more need for PuTTy.Anyway, if you login i.e. with Powershell you will note, that the copy paste behavior changes. Before CTRL+C and CTRL+V worked fine, but now you need to mark text and hit ENTER to copy and right click to paste (stackoverflow).

P.S.If you use VIM in Powershell, you will note, that the background color will likely mess up readability and result in a display like this (recognize the dark blue text?)

Ubuntu 20.04 Ssh Server Install Windows 7

If so, just change the background colors, with right click on the white window bar next to minimize, go to properties -> colors.





broken image