Expected Reading Time: 13 minutes

In this blog article, I will show you how to set up an Ubuntu Virtual Machine (VM) with Docker and all the essential tools. This comprehensive guide will walk you through the entire process, from installing the VM to setting up Docker and installing the necessary tools for your development work or projects.

Example unRAID

In unRAID, you can easily and efficiently set up virtual machines (VMs), including those that use the Ubuntu operating system. Here I explain step by step how to set up an Ubuntu VM on an unRAID server. unRAID uses QEMU/KVM as a hypervisor, and management can be done via the user interface.

Step 1: Preparation

Before you start, make sure that your unRAID system is set up correctly and that virtualization is enabled in your computer's BIOS. You should also make sure that the VM function is activated in unRAID.

  1. Go to the unRAID Dashboard.
  2. Navigate to 'Settings' > 'VM Manager' and activate virtualization if you have not already done so.

Step 2: Download Ubuntu ISO

  1. Download the latest Ubuntu Server or Desktop ISO from the official Ubuntu website down.
  2. Save the ISO image in the ISO share of your unRAID server. This is normally located in the directory /mnt/user/isos/.

Step 3: Create a new virtual machine

  1. Go to the unRAID dashboard and select 'VMs'.
  2. Click on 'Add VM'.
  3. Select 'Ubuntu' from the list of preconfigured templates.

Step 4: VM configuration

Configure the VM according to your requirements:

  1. Name: Give your VM a name.
  2. DescriptionOptional, but helpful for later references.
  3. CPU AllocationAssign CPU cores. You can isolate cores that are only used by the VM.
  4. MemorySet enough RAM, at least 2 GB for a basic installation.
  5. Primary vDisk LocationSelect where the virtual hard disk should be saved. Normally in the directory /mnt/user/domains/. 30 GB is sufficient, but is not enough. More helps more. Depending on what you have planned.
  6. Graphics CardIf you want to use an Ubuntu desktop, configure the graphics card options. For simple server applications, you can use the default settings.

Step 5: ISO image and network

  1. ISO ImageSelect the previously downloaded Ubuntu ISO.
  2. Network BridgeChoose br0 for network access so that the VM runs in the same network as unRAID.

Step 6: Start the installation

  1. Click on 'Create'to create and start the VM.
  2. Connect to the VM via the unRAID VM page. Use the VNC remote control built into unRAID to perform the installation.
  3. Follow the installation instructions of Ubuntu. You can see more detailed explanations in the YouTube video linked below.

Step 7: VM management

After Ubuntu is installed, you can start, stop and manage your VM via the unRAID dashboard. You can also create snapshots and backups of your VM to save or restore its state.

With these steps you have successfully set up an Ubuntu VM on an unRAID server. Now you can use the VM for various tasks such as development, testing or as a media server.

Call Ubuntu VM

To log in to your newly set up Ubuntu VM from a Windows computer, you can use different methods depending on whether you want to use a graphical interface or just the command line. Here I explain how to log in via SSH (Secure Shell) as well as via a remote desktop connection.

Method 1: SSH (Secure Shell)

SSH is the most common method to securely log in to a Linux server, especially if no graphical user interface is installed.

Step 1: Install SSH client

Windows 10 and Windows 11 already have a built-in SSH client that you can use in PowerShell or Command Prompt. If you are using an older version of Windows, you can download and install PuTTY, a free SSH and Telnet client.

Step 2: Find out the IP address of the Ubuntu VM

  • Find out the IP address of your Ubuntu VM. You can usually see this information in the unRAID dashboard under the VM overview.
  • Alternatively, you can open a terminal in the Ubuntu VM and ip a to see the network details and the corresponding IP address.

Step 3: Establish connection via SSH

  • Open the PowerShell window or the command prompt on your Windows computer.
  • Enter the following command to connect: bashCopy code ssh username@ip-address Replace username with your Ubuntu username and ip-address with the IP address of the VM.
  • The first time you try to connect, you will be asked whether you want to accept the fingerprint of the key. Confirm this with yes.
  • Enter your password when you are prompted to do so. It is normal that you do not see the input. This is always the case under Linux. Simply confirm with Enter.

Method 2: Remote Desktop (RDP)

If you have installed a desktop version of Ubuntu and prefer a graphical user interface, you can set up a remote desktop connection (RDP).

Step 1: Install desktop environment and RDP server

  • First you need to make sure that a desktop environment is installed on your Ubuntu VM.
  • Install an RDP server such as xRDP:
sudo apt update
sudo apt install xrdp
sudo systemctl enable xrdp
sudo systemctl start xrdp

Step 2: Firewall configuration

  • Allow RDP traffic on your Ubuntu VM:
sudo ufw allow from any to any port 3389 proto tcp

Step 3: Establish connection from Windows

  • Open the "Remote Desktop Connection" tool on your Windows computer. You can find this by searching for "Remote Desktop" in the Start menu search.
  • Enter the IP address of the Ubuntu VM and click on "Connect".
  • Enter your Ubuntu username and password when prompted.

Using these methods, you can successfully log in to your Ubuntu VM from a Windows computer and use the VM for your purposes. Choose the method that best suits your needs, depending on whether you need a graphical user interface or want to work with the command line.

Update Ubuntu immediately

After you have installed Ubuntu, it is important to update the system immediately. This ensures that you have the latest security patches, bug fixes and improvements, making your system more secure and stable. Here I explain how to update your Ubuntu system and why this is so important.

How to update Ubuntu?

Updating your Ubuntu system is a simple process that can be done via the terminal. Here are the steps to bring your system up to date:

Step 1: Open the terminal

Open the terminal by pressing Ctrl+Alt+T or by searching for it via the Ubuntu Dash or the Start menu.

Step 2: Update package lists

The first thing you should do is update the package lists. These lists contain information about which software packages can be downloaded from the Ubuntu repositories. To update them, run the following command:

sudo apt update

This command checks the connectivity to the Ubuntu servers and fetches the latest versions of the package lists without installing them.

Step 3: Update all installed packages

After the package lists have been updated, you can update all installed packages to the latest available versions. This includes security updates, bug fixes and improved functions. To do this, execute the following command:

sudo apt upgrade

This command will download and install all available updates for the installed packages.

Step 4: Check for distribution upgrades

Sometimes there are also major version jumps for the entire operating system, so-called distribution upgrades, which offer new functions and significant changes. To check whether such an upgrade is available, use :

sudo apt dist-upgrade

This command handles dependencies more intelligently than apt upgrade and installs necessary new packages or removes obsolete ones.

Step 5: Clean up

After the update, it is good practice to remove packages that are no longer required and to clear the local cache of downloaded package archives:

sudo apt autoremove
sudo apt autoclean

These commands help to free up disk space and keep the system clean.

Why should you update Ubuntu immediately after installation?

  • SecurityThe most important motivation for immediate updates is security. Regular updates protect your system from known security vulnerabilities and threats.
  • StabilityUpdates can also fix system and application errors that could affect the stability of your system.
  • PerformanceSometimes updates contain improvements that increase the performance of your applications and the operating system.
  • Latest featuresRegular updates provide you with the latest functions and improvements provided by software developers.

Updating your Ubuntu system regularly is a basic maintenance practice that helps to keep your system secure, efficient and up to date.

Get root rights for your own user

In Unix-based operating systems such as Ubuntu, the root-user is the most powerful user with access to all commands and files in the system. It is often recommended not to use root to avoid accidental changes to the system. Instead, you can work as a normal user and, if necessary, execute commands with administrator rights (root-rights). One way to do this is to use sudo (superuser do).

Use of sudo su to obtain root rights

If you need root rights for certain tasks and do not want to use sudo before the command, you can use the command sudo su to create a shell with root-rights. Here are the steps to do this:

Step 1: Open the terminal

Open the terminal via your desktop environment or press Ctrl+Alt+T.

Step 2: Switch to root

Enter the following command:

sudo su

This command prompts you to enter your password. Here you should enter the password of the current user, not the root-password. The command sudo checks whether the user is in the file /etc/sudoers as sudo-This is normally set up during the installation of the operating system for the first user.

Step 3: Working as root

After entering the correct password, the user ID of the shell changes to rootrecognizable by the change of the prompt, typically from $ to #. Now you can enter commands as root without having to sudo in front of it.

Step 4: Edit the /etc/sudoers-file

To edit this file, you should never use a normal text editor such as nano or vi directly. Instead, there is a special program called visudowhich checks the syntax and avoids errors that could make the system inaccessible.

Step 5: visudo use

  • Open the terminal.
  • Enter the command sudo visudo in. This command opens the /etc/sudoers-file in a secure text editor, by default nano or videpending on your distribution and configuration.

Step 6: Make changes

In the sudoers-file, you can add specific directives to customize the sudo-rights. Here are some examples:

  • Grant user rights:
    username ALL=(ALL) ALL
    This gives the user username permission than any user (ALL) on each host (ALL) each command (ALL).
  • Grant user rights without password prompt:
    username ALL=(ALL) NOPASSWD: ALL
    This allows the user to usernameto execute any command without entering the password.
  • Grant group rights:
    %groupname ALL=(ALL) ALL
    Each member of the group groupname can execute any command. The percent sign in front of the group name is required.
  • Restrict commands to specific users:
    username ALL=(ALL) /usr/bin/apt-get, /usr/bin/systemctl
    This limits the commands that the user can username with sudo may execute on apt-get and systemctl.

Step 7: Save and close file

Once you have made your changes, save the file and close the editor. visudo checks the syntax before saving the changes. If an error is found, it gives you the option to review the edit or reject the changes to prevent the system from being corrupted.

Step 8: Restart Ubuntu

To restart Ubuntu, you can sudo reboot in a terminal window and the system will restart immediately. This ensures that the rights have been loaded in any case.

Safety instructions

  • Minimum principleGrant sudo-rights only if absolutely necessary. Excessive sudo-rights can lead to security vulnerabilities.
  • Documentation: Keep changes to the sudoers-file so that you know who has which rights and why.
  • Backups: Make regular backups of the sudoers-file before you make any changes.

Setting the time zone in Ubuntu

You can also set the time zone on an Ubuntu system using the command line tool dpkg-reconfigure for the package tzdata can be used. This is particularly useful on servers or in environments where no graphical user interface is available. Here is how to set the time zone with dpkg-reconfigure tzdata can be set:

Steps for setting the time zone

  1. Open a terminalYou can open the terminal via an SSH connection or directly on your Ubuntu server.
  2. Executing the commandEnter the following command to start the reconfiguration process:
sudo dpkg-reconfigure tzdata

This command starts a text-based user interface that allows you to select your time zone.

  • Select the geographical regionFirst you will be asked to select the geographical region (for example "Europe"). Use the arrow keys on your keyboard to navigate through the list and press Enter to confirm your selection.
  • Select the specific time zoneAfter you have selected a region, you will be asked to select a specific city or region within this geographical zone that represents your local time zone (for example "Berlin" for Europe/Berlin). Select the appropriate city and confirm again with Enter.
  • Checking the settingsAfter selection, the system will immediately apply the new time zone. You can check this by viewing the date and time with the following command: date
  • This command shows you the current system time and date, which should now correspond to your new time zone.

ConclusionThat's it! You have successfully changed the time zone of your Ubuntu system via dpkg-reconfigure tzdata changed.

YouTube video implementation

Conclusion

Congratulations! You have successfully set up and configured an Ubuntu Virtual Machine (VM) on an unRAID server. This comprehensive guide has taken you through all the necessary steps, from installing the VM, to setting up Docker, to logging in and updating your system.

You learned how to create an Ubuntu VM in the user-friendly unRAID environment, starting with preparing your system and downloading the required Ubuntu ISO. The detailed configuration of your VM, including the allocation of CPU, memory and network settings, was covered as well as the actual installation of the operating system.

By setting up Docker, you have created a flexible platform on which you can run various applications and services in containers. This provides a clean and efficient way to manage your development projects or server applications.

The guide to logging in via SSH or RDP has shown you how to access your VM remotely, which is particularly useful if you need graphical interfaces or command line interaction. You've also covered important security aspects by updating your system immediately after installation to ensure that all security patches and updates have been applied.

Finally, by setting the correct time zone and configuring your user in the /etc/sudoers File for sudo-rights are taken care of. All these steps help to ensure that your VM is not only powerful, but also secure and optimally configured for your requirements.

Use your new Ubuntu VM on unRAID now to develop and test projects or use it as a media server. Good luck and have fun exploring and expanding your knowledge and skills with your new virtual environment!

The display of the products was implemented with the affiliate-toolkit plugin.
Categories: Self-hosted server

0 Comments

Leave a Reply

Avatar placeholder

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

en_US