Installing and Hardening an Ubuntu Server: Difference between revisions

From Stiles Wiki
Jump to navigation Jump to search
(Created page with "==Requirements== ==Installing the Ubuntu Server== ==Update and Configure== ==Securing the Server== ==Configuring the Firewall== ==Installing Fail2Ban== ==Securing SSH==")
 
No edit summary
Line 1: Line 1:
This guide will help you install, configure, and secure a golden image for your Ubuntu servers.
==Requirements==
==Requirements==
This guide assumes you know the basics of installing an operating system on a computer.
==Installing the Ubuntu Server==
==Installing the Ubuntu Server==
This should be a pretty standard answer the questions and follow the directions on screen. If you want a static IP address you can set it here, but I like to set a static address through DHCP instead of on the actual server. I also like to use LVM for the disk set ups.
==Update and Configure==
==Update and Configure==
After you've finished installing the OS, it's time to connect to the server and begin updates and a base configuration. I connect through SSH, but you can do it the physical box if you want. I've found that if you don't make any changes to the default disk settings, you fill up the disk very quickly. Let's change that first, we need to resize the logical volume to use all the existing and free space of the volume group.
<code>sudo lvm</code>
<code>lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
exit</code>
And then, we need to resize the file system to use the new available space in the logical volume. After that's done, we should make sure that it shows the new disk size.
<code>sudo resize2fs /dev/ubuntu-vg/ubuntu-lv
df -h</code>
==Securing the Server==
==Securing the Server==
==Configuring the Firewall==
==Configuring the Firewall==
==Installing Fail2Ban==
==Installing Fail2Ban==
==Securing SSH==
==Securing SSH==

Revision as of 19:34, 4 June 2020

This guide will help you install, configure, and secure a golden image for your Ubuntu servers.

Requirements

This guide assumes you know the basics of installing an operating system on a computer.

Installing the Ubuntu Server

This should be a pretty standard answer the questions and follow the directions on screen. If you want a static IP address you can set it here, but I like to set a static address through DHCP instead of on the actual server. I also like to use LVM for the disk set ups.

Update and Configure

After you've finished installing the OS, it's time to connect to the server and begin updates and a base configuration. I connect through SSH, but you can do it the physical box if you want. I've found that if you don't make any changes to the default disk settings, you fill up the disk very quickly. Let's change that first, we need to resize the logical volume to use all the existing and free space of the volume group.

sudo lvm

lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv

exit

And then, we need to resize the file system to use the new available space in the logical volume. After that's done, we should make sure that it shows the new disk size.

sudo resize2fs /dev/ubuntu-vg/ubuntu-lv

df -h

Securing the Server

Configuring the Firewall

Installing Fail2Ban

Securing SSH