How to Install and Configure an Ubuntu Server 22.04 LTS

Post Reply
User avatar
LHammonds
Site Admin
Site Admin
Posts: 982
Joined: Fri Jul 31, 2009 6:27 pm
Are you a filthy spam bot?: No
Location: Behind You
Contact:

How to Install and Configure an Ubuntu Server 22.04 LTS

Post: # 1003Post LHammonds »

------------- WORK-IN-PROGRESS -------------

Greetings and salutations,

I hope this thread will be helpful to those who follow in my foot steps as well as getting any advice based on what I have done / documented.

To discuss this thread, please participate here: Ubuntu Forums

High-level overview

This document will cover installation of a dedicated Ubuntu server. This will be the "base" installation of the server as a prerequisite for other documents that will build upon it (e.g. MariaDB, Apache, MediaWiki, etc.). The server will be installed inside a virtual machine using vSphere running on ESXi servers. Notes will also be supplied for doing the same thing for Oracle's VirtualBox on a Windows 10 PC. Although there are some VMware-specific and VirtualBox-specific steps, they are very few and the majority of this documentation will work for other Virtual Machines or even directly installed onto a physical machine (e.g. bare-metal install).

This document will also cover some custom scripts to help automate tasks such as backing up, automatically growing the file system when free space is low, etc.

Tools utilized in this process
Helpful links

The list below are sources of information that helped me configure this system as well as some places that might be helpful to me later on as this process continues.
Assumptions

This documentation will need to make use of some very-specific information that will most-likely be different for each person / location. This variable data will be noted in this section and highlighted in red throughout the document as a reminder that you should plug-in your own value rather than actually using these "place-holder" values.

Under no circumstance should you use the actual values listed below. They are place-holders for the real thing. This is just a checklist template you need to have answered before you start the install process.

Wherever you see RED in this document, you need to substitute it for what your company uses.
  • Ubuntu Server name: srv-ubuntu
  • Internet domain: mydomain.com
  • Ubuntu Server IP address: 192.168.107.2
  • Ubuntu Server IP subnet mask: 255.255.255.0
  • Ubuntu Server IP gateway: 192.168.107.1
  • Internal DNS Server 1: 192.168.107.212
  • Internal DNS Server 2: 192.168.107.213
  • External DNS Server 1: 1.1.1.1 (Cloudflare)
  • External DNS Server 2: 8.8.8.8 (Google)
  • Ubuntu Admin ID: administrator
  • Ubuntu Admin Password: myadminpass
  • Email Server (remote): 192.168.107.25
  • Windows Share ID: myshare
  • Windows Share Password: mysharepass
It is also assumed that the reader knows how to use the VI editor. If not, you will need to beef up your skill set or use a different editor in place of it. The vim-nox package that is installed later includes "vimtutor" which is also a good place to learn how to use the vi editor.
User avatar
LHammonds
Site Admin
Site Admin
Posts: 982
Joined: Fri Jul 31, 2009 6:27 pm
Are you a filthy spam bot?: No
Location: Behind You
Contact:

Analysis and Design

Post: # 1004Post LHammonds »

Analysis and Design

The Ubuntu Server Long-Term Support (LTS) is great choice for companies because it is a solid operating system that happens to be free. If professional support is needed, there is an option to buy support for the Long-Term Support (LTS) versions of the operating system.

The large decision over the configuration of Ubuntu is how the hard drive space is sliced up (partitioned). This documentation will focus on partitioning the drives in such a way that it allows for growth depending on what is needed for the specific application.

This following design allows for dynamic growth and fine-tuning if need be. Being caught offguard with a scenario where space is filled up with no immediate option other than deleting files is never a good thing. Long-term life and growth of the system as well as budgeting concerns have to be taken into consideration.

Isolating the root volume to mainly just static data that will not grow much over time is the central concern. Pushing the other folders into their own volumes will be done so their dynamic growth will not affect the root partition. Filling up the root volume on a *nix system is a very bad thing and should be avoided at all costs. The file systems will also not take up 100% of the logical volume. This will allow the file systems (through automated scripts) to grow as needed and give the administrators some time to add more drives if necessary or shrink other volumes to get more space.

The volumes will initially be sliced up as follows:
  • boot - This will remain static in size. It is also the only space residing outside the Logical Volume Manager (LVM)
  • root volume - Operating system and everything else which should remain fairly static.
  • home volume - This is where personal files will be stored but likely not be used in most server configurations.
  • tmp volume - This location will be used for temporary storage. Size should be adjusted to match however it is being used.
  • usr volume - This will contain mostly static data and should not grow unexpectedly.
  • var volume - This is the app/database/log storage and will continue to grow over time.
  • srv volume - This will contain the files stored in the Samba share.
  • opt volume - This will contain specific software you add but may not be utilized at all depending on configuration.
  • bak volume - This will contain a local backup of the server/applications/data. So space needs to be about double the size of your application data (typically double the /var and /opt size).
  • Offsite Storage - This will be handled elsewhere. A backup server will access this server to pull backup data. It is wise to make sure no servers can access the backup server for security reasons.
The partitions will be increased later as needed but will start off with a minimum size due to how the installer expands the file system to fill up all available volume space.

To get a good idea of the initial hard drive layout and to understand the process better, here is a graphical representation of the initial design for the server:

>> CREATE IMAGE FOR 22.04 <<
Image

These numbers will be used for the initial build of the system:

boot = 1 GB
root = 5 GB
home = 0.5 GB
tmp = 1 GB
usr = 3 GB
var = 1 GB
srv = 0.5 GB
opt = 0.5 GB
bak = 2 GB

Important information
  • When the logical volumes and file systems are initially created, they consume the maximum amount of space allocated which means the file system size will initially equal the logical volume size. These partition sizes above are artificially small for that reason. These will be later modified so that the logical volume will be larger than the file system so that the file system has room to expand when needed in a safe and automated manner.
  • If you want, you can initially allocate a larger disk such as a 50 GB drive rather than adding the 2nd and 3rd disk as noted in these steps. These are just examples on how to manage and expand your storage when needed.
  • The /tmp folder is strictly temporary. By default, each time the server reboots, this folder is deleted and re-created.
  • The /bak folder will retain the most recent backup and is considered the "local" copy of the backup and where the remote backup server will pull backups from.
VMware Virtual Machine Settings
  • Configuration: Custom
  • Name: srv-ubuntu
  • Datastore: DS3400-LUN0
  • Virtual Machine Version: 8
  • Guest Operating System: Linux, Version: Ubuntu Linux (64-bit)
  • Number of virtual processors: 1
  • Memory Size: 1 GB
  • Number of NICs: 1
  • NIC 1: VM Network
  • Adapter: VMXNET3, Connect at Power On: Checked
  • SCSI controller: LSI Logic Parallel
  • Select a Disk: Create a new virtual disk
  • Create a Disk: 25 GB, No thin provisioning, No cluster features, Store with the virtual machine
  • Advanced Options: Virtual Device Node = SCSI (0:0)
  • Remove Floppy Drive
  • Mount CD/DVD Drive to Ubuntu ISO (ubuntu-20.04-server-amd64.iso). Make sure CD/DVD is set to Connect at power on
  • Set boot options to Force BIOS Setup so you can set CDROM to boot before the Hard Disk
VirtualBox Virtual Machine Settings
  • Name: srv-ubuntu
  • Operating System: Linux
  • Version: Ubuntu (64 bit)
  • Memory: 1 GB
  • Check - Start-up Disk
    - Create new hard disk
    - VMDK
    - Dynamically allocated
    - Size: 25 GB
  • Select srv-ubuntu and click Settings (CTRL+S)
    - System, Processor, Enable PAE/NX
    - Network, Attached to: Bridged Adapter, Advanced, Adapter Type: Intel PRO/1000 MT Server
    - Storage, IDE Controller, Choose a virtual CD/DVD disk file, ubuntu-22.04-server-amd64.iso
Install PuTTY

When running inside a virtual machine, the response time for screen refreshes can be painfully slow to view man (manual) pages and navigating in VI (text editor). However, when using PuTTY via SSH, it is a far better solution for your Ubuntu console because it handles the screen draws much faster when scrolling and allows copying and pasting text between windows.

For example, selecting and copying a command in this document and then right-clicking in the PuTTY window will paste the command and have it ready to execute. Any text/lines highlighted with the mouse will be automatically copied into clipboard memory on the PuTTY window.

Download the portable edition and run the install...except it does not really "install" like a normal program, it simply extracts to a specified folder and will run from that folder even if you put it on a USB stick and carry over to a new computer (requires no install to run and thus leaves no footprint on your Windows system)
  1. Start PuTTY
  2. Under Window - Translation - Remote character set, select UTF-8
  3. Type the following and click the Save button:
    Host Name: SRV-Ubuntu (or the IP such as 192.168.107.2)
    Port: 22
    Connection type: SSH
    Saved Sessions: SRV-Ubuntu
  4. Now all you have to do is double-click on the session and it will connect to your server (when online).
Post Reply