blog posts

Ubuntu Linux Server

Basic Setup Guide for an Ubuntu Linux Server

When setting up an Ubuntu Linux server, a few essential steps are required to enhance the security and performance of your server. These steps provide a secure foundation for the tasks you want to perform. In this tutorial, we’ll guide you through the initial setup process for an Ubuntu Linux server.

Prerequisites for Installing Ubuntu Linux Server

  1. A Server with Ubuntu Installed:
    Ideally, use a recent Long-Term Support (LTS) version such as Ubuntu 20.04 or 22.04 for better security, features, and support.
  2. Access Credentials:
    • If you have remote access via SSH, ensure you have the server’s IP address along with a username and password (or SSH key).
    • You’ll need physical access to the server and the local username and password for direct access via the console.

Connecting to Your Server

You can connect to your server through the following methods:

1. Direct Console Access:

Use the console to log in with your server’s username and password.

2. SSH (Recommended):

To connect remotely to your server, use SSH (Secure Shell). SSH is a command-line tool for Linux and macOS users, and for Windows users, you can use tools such as PuTTY. Here’s the syntax to connect:

ssh username@server-ip

3. Graphical Tools:

Tools like VNC allow remote graphical access, but this is typically not recommended for servers due to increased resource usage. By default, the Ubuntu Server version doesn’t include a GUI, but you can install one if necessary.

Tip: For better security, always use key-based authentication instead of passwords for SSH logins.

Creating a Non-Root User

In Linux, the root user has full administrative privileges. However, for security, it’s best practice to perform daily operations with a non-root user.
By default, Ubuntu disables root login for remote access. During installation, you’ll be prompted to create a non-root user, which should be used for logging in.

Add a New User

To add another user named john, run the following command:

sudo adduser john

You will be prompted to set a password and enter additional information.

Grant Administrative Privileges

To give the user john superuser access, add it to the sudo group:

sudo usermod -aG sudo john

Switch to the New User

You can switch to the new user with the following command:

su - john

You’re now operating as the new user with administrative privileges.

Setting Up a Firewall

Ubuntu Server comes with UFW (Uncomplicated Firewall) pre-installed. It’s disabled by default but can be easily configured.

Enable and Configure UFW

1. Enable UFW:

sudo ufw enable

2. Allow SSH access (important for remote management):

sudo ufw allow ssh

3. Check UFW status and rules:

sudo ufw status verbose

Example output:

Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), disabled (routed)
New profiles: skip

Set System Timezone

During installation, you’re prompted to set the server’s timezone. If you need to adjust it later or verify its current configuration:

1. View current timezone settings:

timedatectl

2. Change the timezone (e.g., set it to America/New_York):

sudo timedatectl set-timezone America/New_York

3. Synchronize system time using systemd-timesyncd, which is enabled by default:

timedatectl set-ntp true

Conclusion

By completing these basic setup steps, you’re laying a solid foundation for your Ubuntu Linux server. You’ve created a secure non-root user, configured a firewall, and set up your timezone. These initial settings ensure better security and prepare the server for further configuration or application deployment.

Taking these steps not only makes your server secure but also enhances its reliability and performance. Whether you plan to use your Ubuntu server for web hosting, data storage, or as part of a larger infrastructure, starting with these basics ensures you avoid common vulnerabilities and setup errors.

As you continue managing your server, always follow best practices such as keeping the system updated, monitoring logs for suspicious activity, and implementing backups for critical data. With a well-prepared server, you’re equipped to explore more advanced configurations and applications, confidently supporting your intended use case.