After a fresh install of Ubuntu Server 18.104.22.168 there are several improvements that should be immediately performed.
This guide assumes you have already installed Ubuntu Server 16.04.3. The example server used here is named
ubuntu-vm and our desktop is named
mint-mockup. All of the shell commands given in this guide are executed on
ubuntu-vm unless indicated otherwise
Console access only
To start, we’ll be restricted to using the console because OpenSSH server is not installed yet. Login to your console, either physical console, or through the VMM console.
First, let us make sure we have all the possible software updates installed. Update
sudo apt-get update
Then upgrade the system.
sudo apt-get upgrade
The upgrade will begin downloading source packages and then configure and install them. Ultimately if everything is successful, you should be uneventfully returned to a command prompt.
If there are any problems installing updates, you need to fix those now before we proceed. But being part of the Linux ecosystem, a fresh Ubuntu Server install will update the first time just fine without errors. This is not Microsoft Windows…
Periodically, you should clean
sudo apt-get clean
And remove any unneeded
sudo apt-get autoremove
As you add software, run updates, and generally use your new server, over time, the
apt subsystem will need periodic maintenance and the above 2 commands will show more meaningful messages. This is a fresh Ubuntu Server install and it will behave all shiny and clean. Again, this is not Microsoft Windows…
Now reboot your server. CoolGeeks likes using
init 6 to reboot. Call it an ode to old school 1337
An immediate reboot will occur. There is no confirmation prompt when executing
sudo init 6
Static network settings
In most cases, we like our servers to have static IP addresses. While it is OK and encouraged for our user PCs and devices to have dynamic DHCP addresses, servers and network hardware are best configured with fixed addresses to ensure their availability when unusual circumstances occur elsewhere on our network, like the DHCP server being offline or some kind of network connectivity issue.
Login to the console again. After we get our static address to work, we will install OpenSSH and connect to our server remotely from our client workstations. For now, console it is.
Our server is using a hard-wired Ethernet network card (NIC). It is a virtual NIC from KVM, but the Ubuntu Server thinks it is a real physical NIC connected to a real physical LAN.
You can determine which NIC is being used by running
On your Ubuntu Server, the Ethernet NIC may be named something other than
ens3 Link encap:Ethernet HWaddr 52:54:00:61:c6:da
inet addr:172.20.100.187 Bcast:172.20.100.255 Mask:255.255.255.0
inet6 addr: fe80::5054:ff:fe61:c6da/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3274 errors:0 dropped:0 overruns:0 frame:0
TX packets:174 errors:0 dropped:0 overruns:0 carrier:0
RX bytes:296317 (296.3 KB) TX bytes:35943 (35.9 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:176 errors:0 dropped:0 overruns:0 frame:0
TX packets:176 errors:0 dropped:0 overruns:0 carrier:0
RX bytes:13296 (13.2 KB) TX bytes:13296 (13.2 KB)
The NIC settings are stored in
/etc/network/interfaces . We use
vi because, yeah, we are 1337
sudo vi /etc/network/interfaces
This is what the default file looks like.
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
iface lo inet loopback
# The primary network interface
iface ens3 inet dhcp
Setup a static IPv4 address. Configure the Ethernet NIC using your own local LAN parameters and an unused IP address.
Do not just add these lines. Replace the existing
iface ens3 inet static
Go ahead and add this static IP address to your
sudo vi /etc/hosts
172.20.100.150 ubuntu-vm.coolgeeks101.com ubuntu-vm
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
We need to invoke these new settings. You can either reboot your server or run these 2 commands.
sudo ip addr flush interface-name
sudo systemctl restart networking
Remote SSH access
Now let us complete this post by enabling remote access through secure shell (SSH). Log back into your Ubuntu Server console and install OpenSSH server.
If you selected SSH server during Ubuntu installation, this step will not be needed
sudo apt-get install openssh-server
To ease further configuration and administration, we will access our Ubuntu Server remotely from our Linux Mint workstation. Setup key-based authentication to improve login efficiency.
If you already have a keypair in your
user/.ssh directory, you do not need to run the
Run this command on
mint-mockup while logged on with your regular user account there. No
sudo is required.
You might need to use the IP address of the server, not host name. In the example here, that would be
ssh-copy-id [email protected]
OK, so now you are all set with the baby steps needed to get your brand new Ubuntu Server 22.214.171.124 predictably accessible from the local LAN.