How to Check Your Ubuntu Version

Prerequisites

  • A system running Ubuntu
  • Access to a user account with sudo or root privileges
  • A terminal window/command line (CtrlAltT)

There are two (2) simple ways to determine the Ubuntu version installed on your server. Check the version in the terminal window or use Ubuntu’s default graphical interface.

How to Check Ubuntu Version in Terminal

If you prefer using the terminal, you can determine the Ubuntu version installed on your machine in three (3) different ways.

Check Ubuntu Version with lsb_release –a Command

  1. Open the terminal (use the Ctrl+Alt+keyboard shortcut).
  2. Type in the following command and hit Enter:
lsb_release –a
screenshot of checking ubuntu version from terminal

The output displays the current version of Ubuntu. In the example seen in the image above, it is Ubuntu 18.04 (codenamed Bionic Beaver).

Check Ubuntu Version with cat /etc/lsb-release Command

Alternatively, you can use the command:

cat /etc/lsb-release
cat /etc/lsb/release

Check Ubuntu Version with cat /etc/*release Command

To get more in-depth information about the Ubuntu release, you can also use the command:

cat /etc/*release
find information about ubuntu release

Check Ubuntu Version with hostnemctl Command

Another command that also gives you information about the Ubuntu version is the hostname command:

hotnamectl
Check Ubuntu version using hostnamectl command.

Check Ubuntu Version from Graphical Interface

You can quickly identify the Ubuntu version running on your system through the graphical interface.

1. First, select Activities in the top left corner.

2. In the search bar, enter Settings and click on the icon once it appears in the results.

find settings in ubuntu

3. In the System Settings window, click on the Details tab.

system settings details of Ubuntu

The Details section displays which Ubuntu version number you have, along with other information about your operating system.

ubuntu version details 18.04

The image above indicates that the system running on the machine is Ubuntu 18.04.2 LTS (codenamed Bionic Beaver). LTS is an acronym that stands for Long-Term Support, meaning it’s a major version supported for up to 10 years.

Other Ubuntu LTS releases include:

  • Ubuntu 20.04 (Focal Fossa)
  • Ubuntu 16.04 (Xenial Xerus) which has an end of life in April 2021
  • Ubuntu 14.04 (Trusty Tahr)

How to Install CentOS 7

Prerequisites

  • Recommended minimum of 10GB of free disk space
  • CentOS 7 ISO install file

Follow the Steps to Install CentOS 7

If you are only looking to update or upgrade CentOS, see How to Upgrade or Update CentOS.

Step 1: Download CentOS 7

To download the official and up-to-date CentOS 7 ISO file, navigate to https://www.centos.org/download/.

Our recommendation for non-enterprise environments is to download the DVD ISO option, which includes the GUI. We recommend the Minimal ISO option only for production enterprise environments.

Select DVD ISO option for CentOS 7 installation.

Step 2: Create Bootable USB or DVD

Now that you have downloaded the ISO image, you can create a bootable USB, burn it on a DVD or load the image on a VM.

Several applications can help you create a bootable USB. We recommend using Etcher. Download the application for your system (Windows, macOS or Linux), install and run.

etcher running on a drive

The setup is intuitive and easy:

  1. Select the CentOS 7 ISO image.
  2. Insert the USB flash.
  3. Find the USB and select it in the Select drive step.
  4. Click Flash.

Step 3: Boot the CentOS ISO File

Upon booting the CentOS 7 ISO file, you can begin the installation process. To do so, select Install CentOS 7. That will start the installer’s graphical interface.
Read More

How to Set or Change a Hostname in CentOS 7

Prerequisites

  • Server running CentOS 7
  • Access to a user account with root privileges
  • Terminal window (Menu > Applications > Utilities > Terminal)
  • A text editor, like Vim

How to Change Centos Hostname

Step 1: Check Existing Hostname

Before you start, it is advised to check what your current hostname is. Type the following command in the console to find out:

hostnamectl

The output should return the static hostname, as well as a list of other information about your network configuration and operating system.

check static hostname on centos

Step 2: Set a New Static Hostname

As CentOS 7 only allows Fully Qualified Domain Names (FQDNs), double-check the hostname you plan to use.

Acceptable values include:

  • Lower-case letters a to z
  • Numbers 0 to 9
  • Periods and hyphens
  • Hostnames must be between 2 and 63 characters
  • Hostnames must start and end with a number or letter

Type in the following command in the terminal:

hostnamectl set-hostname my.new-hostname.server

Note: Make sure to replace my.new-hostname.server with your chosen hostname.


Step 3: Check the Hostname

Next, verify the hostname by using the following command again:

hostnamectl

The console should display the new hostname.

Step 4: Edit the /etc/hosts File

Start by opening the hosts file by typing:

sudo vim /etc/hosts

In the text editor, look for the line that begins with 127.0.0.1 (the IP address that refers to the system you are working on). It should read:

127.0.0.1  localhost localhost.localdomain localhost 4 localhost4.localdomain4 old.hostname

Change the entry old.hostname to my.new-hostname.server – and spell it the same as in Step 2.

Save the file and exit.

Step 5: Reboot and Check CentOS 7 machine hostname

Restart your system. Open a console window, and run:

hostnamectl

It should display your new hostname.

You can also use your text editor to open and verify your /etc/hostsfile. It should still have your new hostname listed.

Step 6 (Optional): Using a Pretty Hostname

To use a “pretty” hostname type the following command:

hostnamectl set-hostname “My Boss’s Hostname”

Make sure you have the quotation marks.

Once that completes, check the hostname:

hostnamectl status

The console should return a list of information. Check the Static hostname and Pretty hostname lines – they should look like this:

Static hostname:  mybossshostname
Pretty hostname:  My Boss’s Hostname

By putting the hostname in quotes, you’re telling the system to use the complex characters inside the quotes as a pretty hostname.

This enables you to avoid character restrictions for static hostnames.

using a pretty name on centos

But you still need a FQDN hostname for the machine to understand. Fortunately, CentOS is smart enough to remove or change any unacceptable characters and render the static hostname automatically.

Step 7 (Optional): Setting a Transient Hostname

Fist, open the console and type the following:

sudo hostnamectl –transient set-hostname temporary.hostname

You can check the hostname in the same way you did earlier, with the hostnamectl or hostnamectl status command.

This change will last until you reboot the machine.

You can use this command with any type of hostname (Static, Pretty, or Transient) as an option with the double-hyphen.

Just use the double-hyphen to indicate what you want:

sudo hostnamectl --prettyset-hostname “Pretty Hostname”

or

sudo hostnamectl --staticset-hostname temporary.hostname

How To Upgrade or Update CentOS

Introduction

CentOS is a popular fork, or derivative, of the Red Hat Enterprise Linux distribution.

CentOS 7.6 is a minor update and was published in December 2018. It includes updates and changes, including support for newer software and server technology. This guide will walk you through upgrading and updating the current version to the latest CentOS release.

Prerequisites

  • Access to a command line / terminal window (Menu > Applications > Utilities > Terminal)
  • The yum package manager, included by default

Upgrade CentOS to Latest Version: 6 Easy Steps

Step 1: Check current CentOS version

Check the version of your current release with the command:

cat /etc/redhat-release

The system should display the CentOS Linux release version. Make sure the first number is at least 7.x.x.

Step 2: Verify data and backups

Backing up important server data should be done before running a operating system upgrade. Take a moment to verify your system backups.

Step 3: Check for available updates

Check available CentOS updates with the command:

sudo yum check-update

The system will display a list of available updates, including the core operating system updates. Scan through these to make sure everything is in order.
Read More