Now that you've installed Linux VM, what's next?
Just installed a Linux VM and wondering what to do next? This guide walks you through everything you need to get your VM production-ready—from adding secure users and setting up SSH keys, to configuring firewalls, port forwarding, and even running your first Nginx web server.

Demola Malomo
Apr 07 2025
4 min read

So you’ve installed a Linux virtual machine (VM). Congratulations! Now you’re staring at the terminal and thinking, “What’s next?” “How do I move forward?” “What should I install to get the environment ready?” You’re not alone. We've all been there. I recently went through the same phase after setting up my Homelab. That’s a setup where you run your own servers, networks, or other infrastructure at home to learn, experiment, or support side projects. I remember wondering what to install and how to get everything running as a proper Homelab or even a lightweight production environment.
In this guide, I’ll walk you through the essential post-installation steps to get your Linux VM ready for deploying, hosting, and building software.
1. Initial System Updates and Package Management
Before you get into any complex setup, the first thing you should do is update your VM. This pulls in the latest security fixes, patches, and features. It might not seem exciting, but skipping this step is like leaving your front door unlocked. Outdated software is one of the easiest ways for things to go wrong.
1sudo apt update 2sudo apt upgrade -y
2. Install Essential Tools
With your Linux VM updated, the next step is to install some basic development tools. These will help you access the internet, manage code, and do everyday tasks more easily.
1sudo apt install build-essential git curl wget vim -y
Here’s a quick breakdown of what each tool does:
build-essential
is a package that includes tools likegcc
,g++
, andmake
, which are needed to compile and build software from source.git
is used to track changes in your code and collaborate with others on projects.curl
lets you fetch data from URLs directly from the terminal. It’s great for testing APIs or downloading files.wget
is another tool for downloading files from the internet. It works well for pulling entire files or even websites.vim
is a command-line text editor. It’s handy for quickly editing config files or writing code without needing a full-blown IDE.
3. User Management: Create a Non-Root User
When you first set up your Linux VM, you’ll usually have access as the root user. That’s convenient because you can do anything on the machine. However, it’s also risky. It's like driving without a seatbelt. The root account should be used only for core administrative tasks. You should create a regular user account for your daily work to stay safe and avoid mistakes.
1# Create a new user 2sudo adduser yourusername 3 4# Add user to sudo group (for admin privileges when needed) 5sudo usermod -aG sudo yourusername
3. Set Up SSH and Permission Keys for Remote Access
While using a username and password lets you access your VM, you probably don’t want to start sharing those credentials with applications that need to connect to it. For example, if you’ve set up a GitHub Action to deploy a Next.js app to your VM, using your username and password for remote access is not a good idea. Instead, you should use an SSH key. It gives you a secure way to connect to your VM without relying on a password.
Passwords are more vulnerable to brute force attacks. SSH keys help reduce that risk and give you a safer way to manage access.
To set up SSH, follow the steps below:
Step 1: Get your VM IP address using your VM terminal
1ip addr show
Step 2: Generate an SSH key on your local machine
1ssh-keygen -t ed25519
You’ll be asked to enter a name and some optional details. You can press Enter to accept the defaults.
Step 3: Copy your public key to the VM
1ssh-copy-id yourusername@your.vm.ip.address
To confirm the key was copied successfully, run this command on your VM:
1cat ~/.ssh/authorized_keys
Step 4: Disable password authentication on your VM
Use vim
to open the SSH config file
sudo vim /etc/ssh/sshd_config
Look for the line that says PasswordAuthentication
and change its value to no
. Remove the #
and update the value if the line is commented out.
Step 5: Restart the SSH service
1sudo systemctl restart ssh
Step 6: Router Exposure and Port Forwarding
If you want to access your VM from outside your local network, you’ll need to forward the SSH port (by default, that’s port 22) from your router to your VM. Every router is a bit different, so check your router’s manual or admin panel for how to set up port forwarding.
Tip: You can change the default SSH port to something less common, like
2222
, to avoid drawing unnecessary attention from bots or scanners. Just remember to update thePort
value in your SSH config file and restart the SSH service afterward.
4. Firewall Configuration and Traffic Management
Now that your VM is exposed to the internet, it’s important to lock it down. Without a firewall, it’s like leaving your house wide open with a sign that says "Come on in." You want to let in only what you need and block everything else.
The Uncomplicated Firewall (UFW) makes it easy to manage which traffic is allowed in and out of your VM.
Step 1: Install and configure UFW
Update your package list and install UFW.
1sudo apt update && sudo apt install ufw
Step 2: Allow essential services
Let UFW know which ports you want open. For example:
1sudo ufw allow 2222/tcp # if you changed SSH port 2sudo ufw allow 80/tcp # for HTTP 3sudo ufw allow 443/tcp # for HTTPS
Step 3: Enable the firewall
Once your rules are in place, turn the firewall on.
1sudo ufw enable
Step 4: Check your firewall status
1sudo ufw status verbose
5. Installing and Configuring Nginx: Your First Web Server
To get a sense of what your VM can do, it’s a great idea to set up Nginx. Nginx is a lightweight, powerful web server that’s perfect for both testing and production environments. Setting it up will show that your VM is ready to serve web content and handle real-world traffic.
Step 1: Install Nginx
Start by updating your package list and installing Nginx.
1sudo apt update && sudo apt install nginx
Step 2: Start and enable the Nginx service
Once installed, start the Nginx service and make sure it starts automatically on boot:
1sudo systemctl start nginx 2sudo systemctl enable nginx
Step 3: Test your setup
Open a browser and go to http://your-vm-ip
. If everything is set up correctly, you’ll see the Nginx welcome page.
Wrapping Up
Setting up your Linux VM after installation might feel overwhelming at first, but each step is important for making sure your system is secure, efficient, and ready to handle your software deployment and hosting needs.
Keep in mind that system administration isn’t a one-time task. It’s an ongoing process. Make it a habit to review your security settings, keep your software updated, and be ready to adjust as your needs evolve.