Ubuntu Server Cloud: Secure, Automated, and Monitored

Β·

3 min read

Setting Up a Cloud on Ubuntu Server

In this guide, we will walk through the process of setting up a cloud environment on Ubuntu Server. This includes downloading the ISO image, partitioning storage, automating user creation, monitoring the system, and ensuring proper user authorization.


Step 1: Downloading Ubuntu Server

To begin, download the latest LTS (Long-Term Support) version of Ubuntu Server from the official website:

πŸ”— Download Ubuntu Server [https://ubuntu.com/download/server#manual-install]

After downloading, create a bootable USB using Rufus (for Windows) or the dd command (for Linux/macOS). Once the bootable media is ready, proceed with the installation on your server machine.


Step 2: Storage and Partitioning

During installation, you may need to configure storage and partitioning:

  • Using a Single Disk? The default partitioning should be sufficient.

  • Adding an Extra Disk? You need to manually configure mounting.

πŸ“Œ Optional: Mounting an Extra Disk

If you're adding an extra disk, follow these steps:

  1. Identify available disks:

     lsblk
    

    Create a new partition and format it as ext4:

     sudo mkfs.ext4 /dev/sdb
    

    Mount the disk to a directory (e.g., /mnt/storage):

     sudo mkdir -p /mnt/storage
     sudo mount /dev/sdb /mnt/storage
    

    To make the mount persistent, add this entry to /etc/fstab:

     /dev/sdb  /mnt/storage  ext4  defaults  0  2
    

    If you're not using an extra disk, this step can be skipped.


    Step 3: User Creation and Automation

    After storage configuration, the next step is to create multiple users automatically using an automation script. Instead of manually adding users, we will use a pre-configured script to streamline the process.

    πŸ‘‰ Automation Script for User Creation [https://github.com/Zenvila/ubuntu-cloud]

    sudo pacman -S monitWhat this script does:

    βœ” Creates multiple users with predefined settings.
    βœ” Assigns appropriate permissions.
    βœ” Sets up SSH access for secure remote login.

    Run the script and ensure all users are correctly created.


    Step 4: Server Monitoring with Monit

    Now that the cloud setup is complete, system monitoring is crucial to ensure stability and prevent resource overuse. We will use Monit for real-time performance tracking and automated alerts.

    πŸ”— Complete Guide to Monit [https://systemadmin-insights.hashnode.dev/system-monitoring]

    Why Monit?

    βœ” Tracks CPU, RAM, and disk usage in real time.
    βœ” Sends email alerts if resource usage exceeds limits.
    βœ” Monitors processes and automatically restarts failed services.

    πŸ“Œ Monit on Ubuntu Server vs Arch Linux

    • If you are using Arch Linux, install Monit with pacman:

        sudo pacman -S monit
      

      If you are using Ubuntu Server, install Monit with apt:

        sudo apt install monit
      

      Step 5: Security & User Authorization

      To ensure a secure cloud environment, we have implemented strict user authorization and access control:

      βœ… Each user cannot access another user's data.
      βœ… Admins have separate privileges for system management.
      βœ… Proper group permissions are enforced to restrict unauthorized access.

      With Monit configured, if CPU usage exceeds a specific threshold, an email alert will be sent to the administrator’s mobile for immediate action.


      Conclusion

      In this guide, we have:
      βœ… Installed Ubuntu Server and configured storage.
      βœ… Set up automated user creation for efficiency.
      βœ… Implemented Monit for real-time monitoring and alerts.
      βœ… Enforced security through user access control.

      With these steps, your Ubuntu Server cloud is now fully optimized for performance and security. πŸš€


      P.S.

      If you spot any mistakes, please don't hesitate to point them out. We're all here to learn together! 😊

      Haris
      FAST (NUCES)
      BS Computer Science | Class of 2027

      πŸ“Œ GitHub: https://github.com/Zenvila
      πŸ“Œ LinkedIn: https://www.linkedin.com/in/haris-shahzad-7b8746291/
      πŸ“Œ Member: COLAB (Research Lab)

Β