Skip to main content

Ubuntu Server Setup & Configuration


Overview

This document provides a step-by-step guide for setting up and configuring Ubuntu Server as a virtual machine, including installation, user setup, networking, and essential post-installation tasks.


1. Creating the Ubuntu VM (Hyper-V)

  • Open Hyper-V Manager and create a new VM named Ubuntu Server.
  • Use Generation 2 and allocate 4GB RAM.
  • Create a 20GB dynamically expanding virtual hard disk.
  • Attach the Ubuntu Server ISO as the installation media.
  • Use the Default Switch for networking (DHCP).

2. Installing Ubuntu Server

  • Boot the VM and start the Ubuntu installer.
  • Set language and keyboard layout.
  • Set timezone and enable NTP.
  • Choose the default installation (no GUI).
  • Select the 20GB disk and use automatic partitioning.
  • Enable the Default Switch for network connectivity.
  • Set hostname (e.g., myubuntuserver).
  • Set a strong root password and create a regular user (optionally with sudo privileges).
  • Begin installation and reboot when complete.

3. Post-Installation Steps

  • Log in with your user account.
  • Update the system:
    sudo apt update && sudo apt upgrade
  • Install essential tools:
    sudo apt install net-tools curl vim
  • Enable and start SSH if needed:
    sudo systemctl enable ssh
    sudo systemctl start ssh

4. Networking

  • By default, the VM uses DHCP via the Default Switch.
  • To set a static IP, edit /etc/netplan/01-netcfg.yaml.
  • Apply changes:
    sudo netplan apply

5. File Sharing (Samba)

  • Install Samba:
    sudo apt install samba
  • Configure /etc/samba/smb.conf for your share.
  • Set permissions and add a Samba user:
    sudo smbpasswd -a <username>
  • Start and enable Samba services:
    sudo systemctl start smbd nmbd
    sudo systemctl enable smbd nmbd
  • Allow Samba through the firewall:
    sudo ufw allow samba

6. Security

  • For testing, you may adjust UFW or AppArmor as needed.
  • For production, configure firewall and security policies appropriately.

7. Documentation & Resources

  • All configuration files and scripts are documented in the project repository.
  • For troubleshooting, check service status with systemctl status and review logs in /var/log/.

References