Deploying a Server: Basic Configurations for Ubuntu | {Part-1}

After deploying a server from a hypervisor or cloud service provider like: Linode or Azure you will receive a public key or password along with an IP address. To log in to your server, simply enter:

ssh yourserver@[ip]
Password:*****

In this article, we’ll discuss essential configurations for your Ubuntu server to enable easy deployment.

There are several hypervisors to choose from, including Vmware, Redhat Virtualization platform, Proxmox, Windows hyper V.  For home environments, we recommend Proxmox for its ability to create lightweight LXC containers.

Step 1: Update packages

In ubuntu or Debian based servers you can update packages using the command:

sudo apt update && sudo apt upgrade
#or
sudo apt-get update && sudo apt-get upgrade

Based on your package manager you can do both update and upgrade.

sudo apt update: update will refresh the local package and repositories which will ensure that the latest information about available packages and their dependencies

sudo apt upgrade: This will install any available updates to your installed packages.

Why update before upgrade?

If you run “upgrade” before “update” you may miss out on important updates or encounter errors due to outdated package information.

Step 2: Set time zone

You can set your time zone using timedatectl command in ubuntu. Firstly, you can list available time zones using the command

#view timezones
timedatectl list-timezones
#set your time zone
timedatectl set-timezone "[Your_timeZone_Here]"#Example: Asia/Kathmandu
timezones

Why to set your time zone?

It can lead to discrepancy on time-based applications. Challenging while correlating events from log and compliance requirements are some needs why you need to set correct time zone.

Step 3: Create a user

Generally you are given with root account credentials in many server providers. Allowing root account login via SSH is bad practice, so have to create a new user and disallow root login via SSH config file.

The command we can use to create another user with password is:

adduser [username]
#alternatively you can also user
useradd [username] -m #this option to create user's home directory
passwd username

This command will prompt you to enter user credentials along with the password and name, details, etc.

Why to create another user instead of using root?

As the root account has complete control over the server, and if you by mistake executed something wrong on the system the server may fail and if you lost the root account’s password someone will have full access of your system. So it’s a best practice to create another user with limited and only required privileges. Talking about the authentication method key based authentication is considered to be more secure than password based authentication. So in the coming series I will be explaining about it too.

Step 4: Setup your hostname

In ubuntu you can set your hostname using the command hostnamectl

hostnamectl set-hostname [hostname]

You can see the changed hostname using the command hostname in your machine. To see the change in bash shell you have to restart the system.

You can also user hostnamectl status command to view the hostname along with other information.

Why to setup your host name in the system?

It will help you to easily identify your server. Ease of administration, and security purpose. If you see any unauthorized host name on your network, you will know that there may be a security breach.

In this upcoming series, we’ll dive deep into configuring firewalls, live patching, and fail2ban for your server. These essential measures will help optimize your server’s security and performance.

References:

  1. Ubuntu Documentation – https://ubuntu.com/server/docs/security-firewall
  2. Livepatch Ubuntu – https://ubuntu.com/livepatch
  3. Fail2Ban – https://www.fail2ban.org/wiki/index.php/Main_Page
  4. DigitalOcean’s Firewall Guide – https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-with-ufw-on-ubuntu-18-04
  5. How To Configure A Firewall Using Iptables – https://www.digitalocean.com/community/tutorials/how-to-configure-a-firewall-using-iptables-on-ubuntu-18-04

To further explore our expertise, check out our popular articles below:

Setup Ansible in your servers

Creating Redhat Image using image builder and Pushing it to Google Cloud.

Leave a Reply 2

Your email address will not be published. Required fields are marked *


Randolph Colar

Randolph Colar

I really enjoyed reading this post, thank you! Fantastic job!

doorhandles

doorhandles

My brother recommended I might like this web site He was totally right This post actually made my day You cannt imagine just how much time I had spent for this information Thanks