Basic System Setup After Installing Rocky Linux 9 on VirtualBox: A Step-by-Step Guide

Setting up Rocky Linux 9 on VirtualBox is a great way to create a virtualized environment for system administration, development, and testing. However, the installation process is just the first step. To ensure your Rocky Linux system is running efficiently and securely, configuring it properly after installation is essential.

In this guide, we will walk you through the basic system setup after installing Rocky Linux 9 on VirtualBox. For a detailed, step-by-step walkthrough, be sure to watch the accompanying video here.

A Step-by-Step Guide :: Basic System Setup After Installing Rocky Linux 9 on VirtualBox

Why Is System Setup Important?

After installing Rocky Linux on VirtualBox, your system is not yet fully optimized for performance, security, or ease of use. The post-installation steps are crucial for configuring network settings, updating software, securing the system, and installing essential tools. A well-configured virtual machine (VM) ensures that your setup works smoothly and is secure for any tasks you plan to perform.

1. Initial System Update and Package Installation

The first step in any system setup is to update your Rocky Linux system to ensure that you have the latest patches and software updates. These updates provide essential security fixes and performance improvements.

  1. Open a terminal window and run the following commands to update your system:
    sudo dnf update -y
    

    This command will fetch the latest software and security updates. It is crucial to run updates regularly to ensure your system is up to date.

  2. After the update, reboot the system if required:
    sudo reboot
    

2. Install Essential Tools

After the system update, the next step is to install the essential tools you need for your environment. These tools include network utilities, text editors, and package managers that will make system administration easier.

Run the following command to install these tools:

sudo dnf install -y vim wget curl net-tools
  • Vim is a powerful text editor.
  • Wget and curl are useful for downloading files from the internet.
  • Net-tools includes networking tools like ifconfig, netstat, and route.

3. Set Up Network Configuration

For your VM to communicate effectively with the host system and other networks, it’s important to configure the network settings.

  1. Check the current network interfaces by running:
    ip a
    
  2. If you are using a static IP for your VM, you can configure it by editing the network configuration file located at /etc/sysconfig/network-scripts/ifcfg-ens33. Modify the file to match your network settings.
  3. Restart the network service to apply the changes:
    sudo systemctl restart network
    

4. Set the Hostname

Setting the hostname is an important step to ensure that your system can be easily identified on the network.

  1. To set the hostname, run the following command:
    sudo hostnamectl set-hostname my-rocky-linux
    

    Replace my-rocky-linux with your desired hostname.

  2. You can check the hostname by running:
    hostnamectl
    

5. Install and Configure a Firewall

Security is essential, even for VMs. It’s highly recommended to enable and configure a firewall to protect your system from unwanted traffic.

  1. To install the firewall, use:
    sudo dnf install -y firewalld
    
  2. Enable and start the firewall service:
    sudo systemctl enable --now firewalld
    
  3. Check the status of the firewall:
    sudo firewall-cmd --state
    
  4. Allow necessary ports (e.g., SSH, HTTP, HTTPS) by running:
    sudo firewall-cmd --zone=public --add-port=22/tcp --permanent
    sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
    sudo firewall-cmd --zone=public --add-port=443/tcp --permanent
    sudo firewall-cmd --reload
    

6. Enable SSH for Remote Access

If you plan to access your Rocky Linux VM remotely, enabling SSH is essential.

  1. Install the OpenSSH server package:
    sudo dnf install -y openssh-server
    
  2. Enable and start the SSH service:
    sudo systemctl enable --now sshd
    
  3. Verify that SSH is running by checking its status:
    sudo systemctl status sshd
    
  4. To allow SSH access through the firewall, run:
    sudo firewall-cmd --zone=public --add-service=ssh --permanent
    sudo firewall-cmd --reload
    

7. Create User Accounts

For security reasons, it’s always better to create a separate user account for day-to-day tasks instead of using the root account.

  1. Create a new user by running:
    sudo useradd newuser
    sudo passwd newuser
    
  2. Add the user to the sudoers group to grant them administrative privileges:
    sudo usermod -aG wheel newuser
    

8. Final Reboot

Once you’ve completed all the necessary configuration steps, reboot your system to ensure all changes take effect properly:

sudo reboot

FAQs

Q1: How do I update Rocky Linux 9.5 after installation?

Run the command sudo dnf update -y to update all packages and security patches.

Q2: How can I check the network interfaces on my system?

Use the ip a command to view all available network interfaces.

Q3: What is the purpose of installing firewalld?

Firewalld is a dynamic firewall management tool that helps protect your system from unauthorized access.

Q4: How can I enable SSH access to my Rocky Linux VM?

Install OpenSSH by running sudo dnf install -y openssh-server, then enable and start the SSH service using sudo systemctl enable --now sshd.

Q5: How can I check if SSH is running on my system?

Use the command sudo systemctl status sshd to verify the status of the SSH service.


Conclusion

Proper system setup after installing Rocky Linux 9.5 on VirtualBox ensures that your virtual environment is secure, efficient, and ready for use. From updating your system to configuring network settings, firewalls, and SSH access, each step plays a vital role in ensuring the system’s stability.

To help you set everything up easily, watch the step-by-step guide in the video. By following these instructions, you’ll have a well-configured Rocky Linux 9.5 VM that meets your needs.

See also:

Reset Jenkins Admin Username and Password

How to Check Your Linux OS Version

Managing User Accounts and Permissions in Linux Server

List of monitoring tools 

Linux Blogs

AWS Cloud Blogs

Database Blogs

DevOps Blogs

Interview Questions & Answers

Docker Blogs

Google Cloud Blogs







Leave a Comment

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