Sign In
Sign In

Installing Debian on Ubuntu via VirtualBox

Installing Debian on Ubuntu via VirtualBox
JC Brian Refugia
Technical writer
Debian Ubuntu
29.03.2024
Reading time: 3 min

In the world of Linux distributions, the connection between Debian and Ubuntu is a remarkable combination of reliability, variety, and use. While both Debian and Ubuntu are capable operating systems in their own right, the ability to install Debian atop Ubuntu opens up a world of possibilities, providing users with a distinct set of features and benefits that distinguish it from other solutions.

In this article, deep dive into how to install Debian on Ubuntu and how the two well-known distributions work together seamlessly. Discover the benefits and advantages of this hybrid architecture, which provides users with unrivaled customization, software diversity, and system reliability.

Prerequisites

  • System running in Ubuntu
  • User with Root access on the terminal
  • At least 10GB disk space (recommended 20GB)
  • At least 512 GB RAM (recommended 4GB)
  • Debian ISO file (will be described below)
  • VirtualBox (will be described below)

Once all requirements are met, proceed with installation.

Installing VirtualBox

  1. Install VirtualBox on Ubuntu.

Access the terminal and update the package index.

sudo apt-get update

Image12

  1. Run the below command to install and type yes or y to proceed.

sudo apt-get install virtualbox

Image4

  1. Check if installation was successful by running the command:

sudo dpkg -l virtualbox

Image20

Or login to Ubuntu Desktop and look for VirtualBox on the application search box.

Image19

After successful installation of VirtualBox, it is now ready to install Debian.

Installing Debian with VirtualBox

To install Debian, follow the instruction below:

  1. Download the Debian ISO file on official website of Debian: https://cdimage.debian.org/debian-cd/current/amd64/iso-dvd/. Wait for download to finish.

Image11

  1. Launch the VirtualBox and click New.

Image15

Image17

  1. Create the Debian machine and name it.

Image8

  1. Allocate the required memory and click Next.

Image1

  1. Select the hard disk file type and click Next.

Image18

  1. Choose if the hard disk is dynamically or fixed sized then click Next.

Image9

  1. Allocate the required size of disk and click Create.

Image14

  1. Validate details and click start to proceed with installation.

Image3

  1. Locate the Debian ISO file that has been downloaded on the previous step.

Image10

Select your Debian ISO file.

Image16

Click Start.

  1. Follow the instruction prompt.

Image2

  1. Reply to the system's prompts such as selecting the language and location.

Image13

  1. Wait for the installation to complete. Once done, it will look like below. 

Image7

Debian installation is successful.

Conclusion

As technology advances and user expectations increase, Debian and Ubuntu's collaboration paves the road for open-source innovation and excellence. Embracing this synergy not only improves individual users' capacities, but it also adds to the global advancement of Linux-based solutions. Hostman allows you to launch a server for as low as $4 per month, in case you were wondering.

Debian Ubuntu
29.03.2024
Reading time: 3 min

Similar

Debian

Configuring Samba on Debian

Samba is an open-source, stable software that allows cross-platform sharing of printers and files and makes integration of Windows and Linux problem-free. Windows primarily employs the SMB and CIFS protocols for sharing. Samba employs these protocols to create a shared and common network. With this tool, you can: Get hassle-free file sharing between Linux and Windows platforms. Make the printers available to both platforms. Incorporate Linux servers into Windows-based workgroups or domains. Implement user-based access rights for improved control over shared resources. This guide covers installing, configuring, and setting up Samba on Debian securely. Either you are new or a seasoned admin, this tutorial breaks down each step into step-by-step instructions. Advantages of Samba Samba is among the most reliable tools for mixed-OS networking because of the vast list of benefits it offers. Let's take a look at why Samba is such a gem: 1. Cross-Platform Compatibility Samba facilitates smooth communication and resource sharing between the Linux and Windows environments. It breaks the compatibility hurdles and allows for effortless shared drives configuration, printers, and files. 2. Centralized Management Samba enables smooth integration into Windows environments, facilitating centralized authentication and streamlined resource management. It is very handy for corporations and large companies that have numerous users. 3. Cost-Effectiveness Because Samba is open source, it does not rely on proprietary systems, which is cost-effective without losing enterprise functionality. 4. Security Customizable access controls allow only users with the rights to see or edit sensitive documents. Add-on features such as encrypted passwords add an extra security layer. 5. Scalability Samba is capable of supporting small home networks and also large corporate networks, scaling up as needed. Setting Up Samba on Debian Samba setup entails installing software, configuring shared directories, creating users, and troubleshooting. Below is the step-by-step process. Step 1: Update System To avoid incompatibilities, update system packages before installing Samba. Launch the terminal and enter: sudo apt update && sudo apt upgrade This makes your Debian server ready for Samba installation. Step 2: Install Samba on Debian Samba isn't installed by default in Debian but is easily installable with its package manager. To get this tool, type in: sudo apt install samba -y Step 3: Create a Shared Directory Shared directories are centralized folders that can be accessed from client machines. Establishing one involves the following steps: Create the directory for sharing: sudo mkdir -p /srv/samba/hostman_shared This command makes a new directory for file sharing. Note: /srv directory is where the Filesystem Hierarchy Standard (FHS) advises putting data which is meant to be shared or served by the system. /srv shared directories ensure your directory structure is uncluttered and best practices compliant. Set directory permissions: sudo chmod 2770 /srv/samba/hostman_shared This ensures only trusted users can read and write within the directory. Assign the group to the directory: sudo chgrp sambashare /srv/samba/hostman_shared Group ownership assignment enables user-based access control via the sambashare group. Step 4: Add Samba Users With Samba, shared directory permissions can be set and customized through these commands: Add a new user: sudo adduser sambauser This process ensures you create a samba user with the required permissions. Set a Samba password for the user: sudo smbpasswd -a sambauser Enable the user: sudo smbpasswd -e sambauser With authentication enabled, Samba restricts directory access to permitted users. Step 5: Edit Samba Configuration The Samba config file, smb.conf, controls how shared resources are accessed and protected. Modifying this file is essential to setting up your shares. Open the configuration file: sudo nano /etc/samba/smb.conf Insert the following block to declare the shared directory: [HostmanShared] path = /srv/samba/hostman_shared valid users = sambauser writable = yes browsable = yes guest ok = no create mask = 0660 directory mask = 0770 Where: [HostmanShared] is the designated name for the shared resource in this configuration. path = /srv/samba/hostman_shared defines where the shared directory is placed on the server. valid users = sambauser determines which users have privilege to share. writable = yes provided users permission to modify, create, and delete files inside the shared directory. browsable = yes ensures the share is easily accessible in network searches.  guest ok = no prevents guest access to the share. Only authenticated clients (such as sambauser) can access.  create mask = 0660 sets the default permissions for files created within the shared folder. directory mask = 0770 controls folders permissions created within the shared resource.  Save and exit the file (Ctrl + X, Y, Enter).  Step 6: Restart Samba Server Reload the Samba service to activate the latest configuration updates: sudo systemctl restart smbd Check the status to confirm it’s running: sudo systemctl status smbd Your configuration is now fully operational after this step. Step 7: Connect from a Windows Client For connecting to the shared folder from a  Windows computer: Open File Explorer. Enter \\<server-ip>\HostmanShared into the address bar. Enter the required Samba login credentials to proceed. This confirms your Samba network share is properly configured. Step 8: Connect from a Linux Client To interact with the Samba share from a Linux machine, use the smbclient utility. It helps you connect with the shared resources directly from the terminal. You must install smbclient on your other Linux system via: sudo apt install smbclient Then execute this command to connect to Samba share on Linux: smbclient '\\<server-ip>\HostmanShared' -U sambauser Modify <server-ip> by inserting the real IP address of your Debian system. Once connected, the shared resources can be accessed. Frequent Problems and Their Solutions A proper setup doesn’t always guarantee a smooth experience. Here’s how to resolve potential issues: Permission Denied Check whether access settings are correctly configured for the shared directory. Ensure that the Samba user is set up and activated to be able to access shared folders. When installing the Samba server, make sure to add the user to the sambashare group. This will prevent permission problems when attempting to access or request files. Note: A user can be added on Debian via: sudo adduser [username] Connection Refused Ensure that the Samba service is up and operational: sudo systemctl status smbd Firewall Blocking Connections Configure your firewall to unblock Samba-required ports (137-139 and 445) for smooth operation: sudo ufw allow 137,138/udp sudo ufw allow 139,445/tcp Advanced Samba Features You can expand Samba’s functionality by implementing advanced features, such as: Adding Multiple Shared Directories Samba helps you configure multiple shared directories. Simply repeat the steps for creating and configuring a directory, adding each directory block to the smb.conf file. For example: [PublicShare] path = /srv/samba/public guest ok = yes writable = yes browsable = yes This enables guest access for public files, separate from private resources. Monitoring Samba Usage You can also monitor Samba usage to analyze performance and identify issues: Enable logging in smb.conf: [global]    log level = 3    log file = /var/log/samba/log.%m Analyze logs to troubleshoot or audit usage: sudo tail -f /var/log/samba/log.smbd Conclusion The Linux and Samba integration offers transparent sharing of resources among operating systems. From home installation to corporate network with thousands of nodes, the scalability and flexibility of Samba make it an indispensable cross-platform integration software. From this tutorial, you have acquired secure access, user authentication, and shared-resource capabilities, and a functional, properly configured environment. Take advantage of Samba functionality to create collaboration and ease the execution of operations, and network appliances efficiently.
22 July 2025 · 7 min to read
Debian

How to Install and Configure VNC on Debian

The term Virtual Network Computing (VNC) refers to a system for remote access to a computer’s desktop environment. It allows users to interact with the interface, access files on storage, run applications, and modify operating system settings. A similar approach is used for managing virtual machines rented from providers like Hostman. This guide will walk you through setting up a VNC server on a Hostman's VPS servers running Debian, with a secure connection established over SSH. For this example, we’ll use the TightVNC utility, known for its reliable performance even over low-speed connections and seamless file transfers in both directions (to and from the server). Technical Requirements Before starting, ensure you have a prepared Debian server, either in the cloud or locally. Apart from having the operating system ready, it's recommended to configure both a root user and a sudo user (the former without privileges and the latter with them). Additionally, you must allow SSH connections through the firewall. You will need the following: A machine running Windows or macOS. A pre-installed VNC client such as TightVNC, RealVNC, or UltraVNC on Windows, or Screen Sharing on macOS. Alternatively, if you are using another Linux machine, you can install a VNC client such as Vinagre, KRDC, RealVNC, or TightVNC. Installing the VNC Server and Desktop Environment By default, a Debian server doesn’t have a graphical interface for easier management, nor does it include a remote management tool. Therefore, the first step is to install both. In this example, we’ll use the Xfce desktop environment and TightVNC, both of which are available in Debian’s official repository. Update the Package List First, update the list of available packages on the host system by running: sudo apt update Install the Xfce Desktop Environment Next, install the Xfce desktop environment along with additional utilities: sudo apt install xfce4 xfce4-goodies During the installation, the system will prompt you to select a keyboard layout from the provided list. Choose the desired option and press Enter to continue. Once the installation is completed, proceed to install the VNC server. Install the TightVNC Server Use the following command to install TightVNC: sudo apt install tightvncserver After the installation, you need to configure TightVNC by setting a security password and generating configuration files where connection parameters will be stored. Initial VNC Configuration Run the following command to start configuring the VNC server: vncserver The program will prompt you to set a password for connecting to the remote system: You will require a password to access your desktops.Password:Verify: The password must be between 6 and 8 characters long. If a longer password is entered, it will be automatically truncated. Additionally, you can set up a view-only mode, where the connected user can only observe the desktop without being able to control the keyboard or mouse. This mode is useful for demonstrations. After entering both passwords, the utility will generate a configuration file: Would you like to enter a view-only password (y/n)? nxauth:  file /home/username/.Xauthority does not existNew 'X' desktop is your_hostname:1Creating default startup script /home/username/.vnc/xstartupStarting applications specified in /home/username/.vnc/xstartupLog file is /home/username/.vnc/your_hostname:1.log Configuring the VNC Server The VNC server needs to be configured so that it knows what commands to execute upon startup—for example, specifying the desktop environment to be launched when a connection is established. These startup instructions are located in the xstartup file, which resides in the .vnc subdirectory of the home directory. This file is automatically created when you launch the vncserver for the first time.  In this guide, we’ll modify the configuration to launch the Xfce graphical interface upon startup. By default, VNC communicates with remote hosts using port 5901, also known as the display port for "display 1". Additional instances can be started on ports 5902, 5903, etc. Stop the VNC Server Before configuring VNC on Debian, stop the currently running instance with the following command: vncserver -kill :1 The output will look something like this: Killing Xtightvnc process ID 17648 Backup the Original Configuration File It’s a good practice to create a backup of the original xstartup file, so you can easily revert the settings if anything goes wrong: mv ~/.vnc/xstartup ~/.vnc/xstartup.bak Create and Edit a New xstartup File Now, generate a new xstartup file and open it for editing using a text editor (in this case, nano): nano ~/.vnc/xstartup The commands you add to this file will be automatically executed when the VNC server starts or restarts. Add the following lines to launch the Xfce desktop environment: #!/bin/bashxrdb $HOME/.Xresourcesstartxfce4 & Here: The first line specifies that the script should be executed using the bash shell. The line with xrdb loads the .Xresources file, which defines terminal colors, cursor themes, font rendering, and other desktop appearance settings. The line startxfce4 & launches the Xfce graphical interface. Make the xstartup File Executable After editing the configuration file, make it executable by running: sudo chmod +x ~/.vnc/xstartup Restart the VNC Server Finally, restart the VNC server: vncserver You’ll see the following output on the screen: New 'X' desktop is your_hostname:1Starting applications specified in /home/username/.vnc/xstartupLog file is /home/username/.vnc/your_hostname:1.log Configuring the VNC Desktop By default, TightVNC establishes a connection without encryption. However, for our purposes, we require a secure tunnel using the SSH protocol. This involves creating a secure connection on the client side, which forwards data to localhost for handling by the VNC utility. You can achieve this by running the following command in the terminal (Linux or macOS): ssh -L 5901:127.0.0.1:5901 -C -N -l user your_server_ip The -L option specifies port forwarding. The default configuration uses port 5901 on both the remote and local hosts. The -C option enables compression, which reduces the size of data sent between the client and server. The -N option tells the SSH protocol that no remote commands will be executed and that it is only being used for port forwarding. The -l option specifies the username for the remote connection. In the above command, replace user with the username (typically a non-privileged root user) and your_server_ip with the actual IP address of the remote host. If you are using Windows, you can create the SSH tunnel using PuTTY, a popular SSH client with a graphical interface. In PuTTY, you need to: Enter the IP address of the remote host. Configure port forwarding by adding localhost:5901 as the new port for data redirection. Save the session settings and initiate the connection. Once you initiate the connection, the system will prompt you to enter the password you set during the initial VNC server configuration. The tunnel will only be activated after successful user authentication. Once connected, you will see the Xfce graphical interface as configured in the .Xresources file. You can finalize the desktop setup by selecting "Use default configuration" in the menu. To end the SSH session, press the key combination Ctrl+C. This will close the tunnel and terminate the remote session. Running VNC as a System Service In the final step, we will configure VNC Server as a system service on Debian, enabling you to start, stop, and restart it just like other system services. This ensures that the utility starts automatically with the server. To do this, we'll edit the configuration file /etc/systemd/system/vncserver@.service: sudo nano /etc/systemd/system/vncserver@.service The @ symbol is used as an argument to modify the service parameters. It is applied when you need to specify the display port used by the VNC utility. Add the following lines to the file (replace user, group, workingdirectory, and username with your own values): [Unit]Description=Start TightVNC server at startupAfter=syslog.target network.target[Service]Type=forkingUser=usernameGroup=usernameWorkingDirectory=/home/usernamePIDFile=/home/username/.vnc/%H:%i.pidExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 :%iExecStop=/usr/bin/vncserver -kill :%i[Install]WantedBy=multi-user.target The ExecStartPre command allows you to stop the VNC server if it is already running. The ExecStart command will restart the server and set the resolution to 1280x800 with 24-bit color. After editing the file, apply the changes and inform the system about the new file: sudo systemctl daemon-reload Next, enable the service: sudo systemctl enable vncserver@1.service The 1 after the @ represents the display number where the service should be activated. It will always be "1" unless you change the default configuration, but you can specify another number if needed. Now, stop the active instance of the VNC server and start the new service: vncserver -kill :1sudo systemctl start vncserver@1 You can check if the VNC server is running with: sudo systemctl status vncserver@1 The result will look like this: vncserver@1.service - Start TightVNC server at startup   Loaded: loaded (/etc/systemd/system/vncserver@.service; enabled; vendor preset: enabled)   Active: active (running) since Wed 2018-09-05 16:47:40 UTC; 3s ago  Process: 4977 ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 :1 (code=exited, status=0/SUCCESS)  Process: 4971 ExecStartPre=/usr/bin/vncserver -kill :1 > /dev/null 2>&1 (code=exited, status=0/SUCCESS)  Main PID: 4987 (Xtightvnc)... After these steps, the VNC server will be available after the system restarts. Now, initiate the SSH tunnel again: ssh -L 5901:127.0.0.1:5901 -C -N -l username your_server_ip This command will create a connection using the client application that forwards the connection from localhost:5901 to your local machine. Conclusion We have completed configuring and launching a secure VNC server on a Debian system. Now, you can perform all usual operations: installing and uninstalling software, configuring programs, managing files, surfing the web, etc. To know more, click on the instruction on how to create server on Hostman's horsepowers.  Frequently Asked Questions How do I install VNC on Debian Linux? Run sudo apt install tigervnc-standalone-server, then follow the steps for your desktop environment. What VNC server is recommended for Debian? TigerVNC is fast and reliable. RealVNC is another solid option with nice GUI tools. How do I start a VNC session in Debian? Just run vncserver :1 once you’ve configured your user and desktop. Can I secure my VNC connection? Absolutely. Always use SSH tunneling to encrypt your session.
17 April 2025 · 9 min to read
Debian

How to Add User to Sudoers in Debian 12

Adding a username to the sudoers file in Debian 12 is crucial for granting superuser privileges. It helps you seamlessly execute administrative tasks without requiring root login. The sudoers configuration controls which commands can be executed, permitting authorized profiles to carry out tasks with elevated privileges. By doing so, it enhances the system's security while allowing the completion of essential administrative duties. Providing administrative authorities in the system allows activities like software installation, system settings management, and conducting maintenance work. Understanding how to effectively add an account to the sudoers file is vital for maintaining a secure and efficient system environment. In this tutorial, we'll outline different techniques to add users to the sudoers in Debian 12. We'll explain the usermod command, manually editing the sudoers configuration, and appending an account to the admin group. Each technique provides a reliable means of managing permissions, ensuring your system stays protected while granting necessary admin rights. Prerequisites Before we start, ensure you have: A Debian 12 distribution. Terminal with root access. Method 1: Via usermod  The command usermod grants necessary administrative powers by including an account in the superuser category. This method involves adjusting the account's group membership, permitting it to undertake tasks with elevated authority. Here are the steps: Search for "Terminal" in Debian or quickly open it with Ctrl + Alt + T. Add an account to the elevated access category via:  sudo usermod -aG sudo $USER Where: sudo: Carries out the command with root-level powers. usermod: Applied to update user profiles. -aG: The -a option includes the account in the specified category, while the -G option identifies the group name. sudo: The group for user inclusion. $USER: The user granted superuser status. Confirm the account's group affiliation with: sudo -l -U $USER sudo -l: Lists authorized and prohibited actions. -U $USER: Specifies the login name. This method is straightforward and efficient for adding usernames to the sudo category. It will quickly grant necessary rights without manually editing setup files. Method 2: Manually Editing the sudoers  Editing the sudoers file is another effective strategy to grant superuser rights and administrative capabilities. This method involves directly editing the file to add the desired profile, providing the needed permissions to carry out different system activities. To keep edits safe, we use visudo (sudoers editor). It prevents syntax errors and ensures that only one person can edit the file at a time. Here are the steps: Open editor to edit the doc securely: sudo visudo Or use: sudo nano /etc/sudoers Note: Visudo provides safety by verifying syntax and locking the file during editing. Use this line, replacing $USER with the actual login name: $USER ALL=(ALL:ALL) ALL This line authorizes the designated profile to perform all activities with superuser rights. Save your edits and quit the editor. It will handle syntax error checking. Confirm the profile's inclusion in the sudoers by using: sudo -l -U $USER This will reveal the $USER elevated rights if it has been properly included. Manual editing provides flexibility, allowing you to specify exact permissions for each user. However, exercise caution to prevent syntax errors that might impact system functionality. Method 3: Username Inclusion to the Admin Group In some Debian-based distributions, appending an account to the admin class grants elevated privileges. This method involves modifying the account’s group membership to include it in the admin group, enabling administrative tasks with superuser privileges. Here are the instructions: Open terminal on your Debian 12 distribution. Include a username to the admin group by using: sudo usermod -aG admin $USER Confirm the user's inclusion through: groups $USER This will show all the groups that the user is part of, including admin if added correctly. Additional Setup For better system performance, add some extra configurations. These adjustments can streamline how you handle users and protect your system. They help streamline administrative tasks, improve efficiency, and provide more control over permissions. Providing Limited Sudo Privileges To give restricted sudo privileges, detail the specific commands in the sudoers file. Use the following instructions: Open the file via: sudo visudo Specify the user's name in place of $USER and update /path/to/anycommand with the correct command. $USER  ALL=(ALL:ALL) /path/to/anycommand Save your modifications and exit the editing interface. Verify the user's limited sudo rights by executing: sudo -l -U $USER This will reveal the specific sudo rights conferred on the user. Passwordless sudo Rights Sometimes, it’s essential to let a user execute sudo commands without needing to enter a password. You can set this up in the sudoers file to make things easier and more efficient for specific users. Here's how to set it up: Access the file via: sudo visudo Include this line to enable the user to run sudo commands without a password requirement. Replace $USER with the correct username: $USER ALL=(ALL) NOPASSWD:ALL Finalize and save your modifications before closing the editor. Validate that the user can carry out elevated duties without a password. For instance: sudo ls /root This should execute successfully without requiring a password. Adding Users with Specific Privileges You can append profiles with specific authorities to run certain administrative tasks with: sudo visudo Add a line to assign the user particular permissions, replacing $USER and /sbin/shutdown. $USER ALL=(ALL) NOPASSWD: /sbin/shutdown Removing Users from sudoers To remove an account from the sudoers list, either remove them from the sudo group or delete their entry in the file. sudo deluser $USER sudo Frequent Issues and Their Solutions Listed here are common issues and their quick remedies: Issue 1: Username Missing from sudo Group Double-check the username and command syntax if the user isn't granted sudoer status. Check which groups the account is part of by running the groups command. Issue 2: sudoers Format Errors When there are format errors in the sudoers file, the visudo editor will notify you to correct them. Consistently use this editor for editing the file to prevent the format errors. FAQs Q1: Why include a username in the sudoers file on Debian 12? To assign superuser privileges for administrative functions while upholding security. Q2: What's the process to include an account in the sudo group via usermod?  Open the terminal and run:  sudo usermod -aG sudo $USER Q3: Is it safe to manually edit sudoers? Yes, but it's best to utilize sudo visudo to avoid format errors. Conclusion Granting a user access to the sudoers file in Debian 12 facilitates correct permission handling and allows them to carry out vital admin tasks. By doing so, you enable users to execute commands with elevated privileges, ensuring that they can efficiently manage the system without compromising security.  This guide provides in-depth steps on several methods to achieve the goal, whether you decide to use the usermod utility, manually adjust the sudoers file, or add the username to the admin group. Each method is designed to provide a secure way to manage permissions, ensuring your system remains protected while allowing necessary administrative access. By assigning proper privileges, you create a safe and efficient system setup that enhances overall functionality and security.
26 February 2025 · 6 min to read

Do you have questions,
comments, or concerns?

Our professionals are available to assist you at any moment,
whether you need help or are just unsure of where to start.
Email us
Hostman's Support