How to Install Ubuntu Server

Ubuntu Server provides a robust, scalable, and secure platform for a wide array of applications, from web hosting and cloud computing to data analytics and machine learning. Its open-source nature, extensive community support, and frequent updates make it a popular choice for professionals and organizations alike. This guide will walk you through the process of installing Ubuntu Server, ensuring a smooth and efficient setup.

Preparing for Installation

Before embarking on the installation journey, meticulous preparation is key to a successful deployment. This involves selecting the appropriate hardware, obtaining the installation media, and understanding the fundamental choices you’ll make during the setup process.

Hardware Requirements

Ubuntu Server is designed to be flexible and can run on a variety of hardware. However, certain minimum specifications are recommended for optimal performance, especially for production environments.

  • Processor: A modern 64-bit processor is essential. While older systems might technically run Ubuntu Server, performance will be significantly degraded. Aim for at least a dual-core processor.
  • RAM: For basic installations and light workloads, 2GB of RAM is the absolute minimum. However, 4GB or more is highly recommended for smoother operation and for running more demanding services. For enterprise-level applications or significant data processing, consider 8GB, 16GB, or even more.
  • Storage: A minimum of 25GB of disk space is required for the operating system itself. However, this is a bare minimum. Consider your planned applications and data storage needs. For a production server, 100GB or more is a reasonable starting point. Solid State Drives (SSDs) will offer a substantial performance boost over traditional Hard Disk Drives (HDDs) for operating system and application responsiveness.
  • Network Interface: A network interface card (NIC) is crucial for server connectivity. Ensure it’s compatible with Ubuntu Server. Most modern onboard NICs are well-supported.
  • Bootable Media: You will need a USB drive (at least 4GB) or a DVD to create bootable installation media.

Obtaining the Ubuntu Server ISO Image

The Ubuntu Server installation image, known as an ISO file, can be downloaded from the official Ubuntu website. It’s vital to download from a trusted source to ensure the integrity and security of your installation.

  1. Visit the Official Ubuntu Website: Navigate to ubuntu.com/download/server.
  2. Choose the LTS Version: For server deployments, it is almost always recommended to use the Long Term Support (LTS) version. LTS releases are supported with security updates for five years, providing stability and reliability for critical infrastructure. Non-LTS versions have a shorter support cycle and are generally better suited for desktop use or testing new features.
  3. Download the ISO: Click the download link for the desired LTS version. The file size is typically around 1-2GB.

Creating Bootable Installation Media

Once you have the ISO file, you need to transfer it to a bootable medium.

Using a USB Drive (Recommended)

A USB drive is the most common and convenient method.

  • For Windows:
    • Download and install a tool like Rufus (rufus.ie) or Balena Etcher (balena.io/etcher).
    • Launch the tool, select your USB drive, select the downloaded Ubuntu Server ISO file, and initiate the writing process. Warning: This will erase all data on the USB drive.
  • For macOS and Linux:
    • Balena Etcher is an excellent cross-platform option.
    • Alternatively, you can use the dd command in the terminal (use with extreme caution, as an incorrect command can wipe your system’s hard drive):
      bash
      sudo dd if=/path/to/ubuntu-server.iso of=/dev/sdX bs=4M status=progress

      Replace /path/to/ubuntu-server.iso with the actual path to your ISO file and /dev/sdX with the device name of your USB drive (e.g., /dev/sdb). Use lsblk to identify your USB drive.

Using a DVD (Less Common)

If you prefer to use a DVD:

  • For Windows: Right-click the ISO file and select “Burn disc image.”
  • For macOS: Open Disk Utility, go to File > Burn, and select the ISO file.
  • For Linux: Use a tool like Brasero or wodim:
    bash
    wodim -v dev=/dev/sr0 ubuntu-server.iso

    Replace /dev/sr0 with your DVD burner’s device name.

BIOS/UEFI Configuration

Your computer’s firmware (BIOS or UEFI) needs to be configured to boot from your newly created installation media.

  1. Restart your computer.
  2. Access the BIOS/UEFI setup: As the computer starts, look for a prompt to press a specific key (commonly Del, F2, F10, F12, or Esc) to enter setup. This key varies by manufacturer.
  3. Change the Boot Order: Navigate to the “Boot” or “Boot Order” section.
  4. Prioritize the USB Drive or DVD Drive: Move your USB drive or DVD drive to the top of the boot order list.
  5. Save and Exit: Save the changes and exit the BIOS/UEFI setup. Your computer will now attempt to boot from the installation media.

The Installation Process

With your bootable media ready and BIOS/UEFI configured, you’re ready to begin the Ubuntu Server installation. The installer is text-based but highly intuitive.

Initial Boot and Language Selection

  1. Boot from Media: If your boot order is correct, you will see a boot menu from the Ubuntu Server installation media.
  2. Select “Try or Install Ubuntu Server”: Choose this option to start the installer.
  3. Language Selection: The first screen prompts you to select your preferred language for the installation process. Use the arrow keys to navigate and Enter to confirm.

Keyboard Configuration

After selecting your language, you’ll be asked to configure your keyboard layout.

  1. Select Keyboard Layout: Choose the layout that matches your physical keyboard.
  2. Detect Keyboard Layout (Optional): The installer can attempt to detect your layout automatically. If you’re unsure, it’s often best to select it manually.
  3. Add More Layouts (Optional): You can add alternative layouts if needed.

Network Configuration

This is a critical step. Ubuntu Server will attempt to configure network interfaces automatically using DHCP if available.

  1. DHCP: If your network has a DHCP server, your server will likely acquire an IP address automatically. The installer will show this process.
  2. Static IP Configuration: For servers, a static IP address is usually preferred for predictability and reliable access.
    • If DHCP fails or you require a static IP, select “Manual” when prompted for network configuration.
    • You will need to provide the IP address, subnet mask, gateway, and DNS server information.
    • IP Address: The desired static IP address for your server.
    • Subnet Mask: Defines the network size. Common examples are 255.255.255.0 (for /24) or 255.255.0.0 (for /16).
    • Gateway: The IP address of your router or the device that connects your local network to the internet.
    • DNS Servers: The IP addresses of DNS servers (e.g., your router’s IP, Google DNS 8.8.8.8, or Cloudflare DNS 1.1.1.1).
  3. Proxy Configuration (Optional): If your network requires a proxy to access the internet, enter the proxy details here.

Ubuntu Server Installer Configuration

The installer will now proceed with several configuration steps.

Storage Configuration

This section deals with how your hard drives will be partitioned and used.

  • Guided Storage Configuration: This is the easiest option for most users.
    • “Use an entire disk”: This will erase the selected disk and use it entirely for Ubuntu Server.
    • “Set up LVM (Logical Volume Management)”: LVM provides flexibility for resizing partitions later. It’s generally recommended for servers.
    • “Set up ZFS”: ZFS is an advanced filesystem with features like data integrity checks, snapshots, and RAID-like capabilities. Choose this if you’re familiar with ZFS and its benefits.
    • “Custom Storage Layout”: This allows manual partitioning. You’ll need to create partitions for /, /home, swap, and potentially /var or /boot.
  • Manual Partitioning (for advanced users): If you choose “Custom Storage Layout,” you will be presented with a disk management interface.
    • Create Partitions: You’ll need to define partition sizes, types (e.g., ext4, swap), and mount points.
    • Recommended Partitions:
      • /: Root filesystem. Typically 20-50GB.
      • swap: For virtual memory. Size is often recommended to be equal to RAM for systems with less than 4GB RAM, or smaller (e.g., 2-4GB) for systems with more RAM if hibernation isn’t a concern.
      • /home: For user data. Allocate remaining space.
      • /var: For logs, caches, and variable data. Can be on its own partition for large log files.
      • /boot: For bootloader files. Typically 500MB – 1GB.

Profile Setup

This is where you create your initial user account.

  1. Your Name: Enter your full name.
  2. Server’s Name: This is the hostname of your server (e.g., webserver01, database-prod). It will be used to identify the server on the network.
  3. Username: Choose a username for your administrative account (e.g., admin, sysadmin).
  4. Password: Create a strong password for your user account. Re-enter it to confirm.

SSH Setup

Enabling SSH is crucial for remote administration.

  1. Install OpenSSH Server: It’s highly recommended to check the box to install the OpenSSH server. This allows you to connect to your server remotely from another computer using SSH clients.
  2. Import SSH Identity (Optional): If you have pre-existing SSH keys you wish to use for initial login, you can import them here.

Featured Server Snaps

Ubuntu Server offers “Snaps” for easily installing popular server applications.

  • Docker: A containerization platform. Installing it here allows you to start using Docker immediately.
  • Nextcloud: A self-hosted cloud storage solution.
  • MicroK8s: A lightweight Kubernetes distribution for development and testing.
  • Others: Depending on the Ubuntu Server version, other snaps like Grafana, Prometheus, or specific databases might be listed.

You can choose to install any of these by selecting them. They will be installed after the base operating system is set up. You can also install them manually later.

Installation of Ubuntu Server

The installer will now proceed with copying files and installing the base system. This process can take some time, depending on your hardware and network speed.

  1. Package Installation: The core system packages are installed.
  2. Snap Installation (if selected): If you chose to install any featured snaps, they will be configured and installed now.
  3. Configuration Updates: The system applies final configurations.

Reboot and First Login

Once the installation is complete, you will be prompted to reboot your system.

  1. Remove Installation Media: The installer will usually prompt you to remove the USB drive or DVD before rebooting. Make sure to do this.
  2. Reboot: Select the option to reboot.
  3. Login: After the server restarts, you will see a login prompt. Enter the username and password you created during the profile setup.

Post-Installation Configuration and Updates

After successfully installing Ubuntu Server and logging in, there are essential steps to ensure your system is up-to-date, secure, and ready for its intended purpose.

Updating the System

Keeping your system updated is paramount for security and stability.

  1. Update Package Lists: This command fetches the latest information about available packages from the repositories.
    bash
    sudo apt update
  2. Upgrade Installed Packages: This command installs the newer versions of all packages that have updates available.
    bash
    sudo apt upgrade -y

    The -y flag automatically answers “yes” to prompts, which is convenient for scripting but should be used with caution on production systems where you might want to review changes.
  3. Dist-Upgrade (Optional but Recommended): This command is more intelligent than upgrade. It can install new packages or remove existing ones if required to satisfy dependencies for the upgrade.
    bash
    sudo apt dist-upgrade -y
  4. Autoremove (Optional): This removes packages that were automatically installed to satisfy dependencies for other packages and are now no longer needed.
    bash
    sudo apt autoremove -y
  5. Reboot (if necessary): Some updates, especially kernel updates, require a reboot to take effect. You will typically be informed if a reboot is necessary.
    bash
    sudo reboot

Configuring SSH for Secure Remote Access

If you installed the OpenSSH server, you can now connect to your server remotely.

  1. Find Your Server’s IP Address: If you didn’t set a static IP, you can find it by running ip a on the server. If you did, you already know it.
  2. Connect from Another Computer: Open a terminal on your local machine (or use an SSH client like PuTTY on Windows) and use the following command:
    bash
    ssh your_username@your_server_ip_address

    Replace your_username with the username you created and your_server_ip_address with the server’s IP.
  3. First Connection: The first time you connect, you’ll be asked to confirm the server’s host key. Type yes and press Enter.
  4. Password Authentication: Enter your password when prompted.

Securing SSH (Recommended):

  • Disable Password Authentication: Once you have SSH keys set up, you should disable password authentication for enhanced security. Edit /etc/ssh/sshd_config and set PasswordAuthentication no.
  • Change Default Port: Consider changing the default SSH port (22) to a non-standard port to reduce automated attack attempts. Edit /etc/ssh/sshd_config and change Port 22 to a different number (e.g., Port 2222). Remember to update your firewall rules accordingly.
  • Use Fail2ban: Install and configure Fail2ban to automatically block IP addresses that show malicious signs, such as too many failed login attempts.
    bash
    sudo apt install fail2ban

Firewall Configuration (UFW)

Ubuntu Server comes with UFW (Uncomplicated Firewall), a user-friendly interface for managing iptables. It’s essential to configure your firewall to only allow necessary incoming connections.

  1. Check UFW Status:
    bash
    sudo ufw status

    Initially, it will likely be inactive.
  2. Enable UFW:
    bash
    sudo ufw enable

    Confirm with y.
  3. Allow Essential Services:
    • SSH: This is crucial. If you changed the SSH port, replace 22 with your custom port.
      bash
      sudo ufw allow ssh
      # Or if using a custom port:
      # sudo ufw allow 2222/tcp
    • HTTP/HTTPS (if running a web server):
      bash
      sudo ufw allow http
      sudo ufw allow https
    • Other services: Allow ports for any other services you plan to run (e.g., sudo ufw allow 3306/tcp for MySQL).
  4. Deny All Other Incoming Traffic: By default, UFW denies all incoming connections unless explicitly allowed.
  5. Check Status Again:
    bash
    sudo ufw status verbose

Time Synchronization (NTP)

Accurate time is critical for logging, security, and many network services. Ubuntu Server typically uses systemd-timesyncd by default, which is sufficient for most use cases.

  • Check Status:
    bash
    timedatectl

    Ensure “NTP synchronized” is set to “yes.” If not, ensure systemd-timesyncd is enabled:
    bash
    sudo systemctl enable systemd-timesyncd
    sudo systemctl start systemd-timesyncd
  • For more advanced NTP configuration (e.g., using ntp package):
    bash
    sudo apt install ntp
    # Configure /etc/ntp.conf as needed
    sudo systemctl restart ntp

Basic System Monitoring

Understanding your server’s performance is important.

  • Resource Usage:
    • htop (install with sudo apt install htop): An interactive process viewer.
    • top: Built-in process viewer.
    • free -h: Shows RAM and swap usage.
    • df -h: Shows disk space usage.
  • Logs:
    • /var/log/syslog: General system messages.
    • /var/log/auth.log: Authentication logs.
    • journalctl: A powerful tool to query systemd journal logs.

Conclusion

Installing Ubuntu Server is the foundational step in deploying a powerful and versatile computing environment. By carefully preparing your hardware, obtaining the correct installation media, and following the step-by-step installation process, you can establish a stable and secure server operating system. The post-installation steps, including system updates, firewall configuration, and SSH hardening, are vital for maintaining the health and security of your server. With Ubuntu Server installed and properly configured, you are well-equipped to host applications, manage data, and build robust IT infrastructure.

Leave a Comment

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

FlyingMachineArena.org is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com. Amazon, the Amazon logo, AmazonSupply, and the AmazonSupply logo are trademarks of Amazon.com, Inc. or its affiliates. As an Amazon Associate we earn affiliate commissions from qualifying purchases.
Scroll to Top