WindowsMacSoftwareSettingsSecurityAndroidProductivityLinuxPerformanceAppleDevice Manageme.. All

How to Configure VNC Server on Fedora

Edited 2 weeks ago by ExtremeHow Editorial Team

FedoraVNC ServerRemote DesktopConfigurationNetworkingCommand LineTerminalSoftwareSystem AdministrationComputers

How to Configure VNC Server on Fedora

This content is available in 7 different language

Virtual Network Computing (VNC) allows you to remotely access a desktop environment from another computer. This is exceptionally useful if you need to remotely access the GUI of your server. Configuring a VNC server on Fedora can be simple if you follow the steps carefully. In this comprehensive guide, we will go into detail about configuring VNC on Fedora to ensure that you have a working remote desktop at the end.

Table of contents

Introduction to VNC

Virtual Network Computing (VNC) is a system that controls another computer remotely using the Remote Frame Buffer (RFB) protocol. It transmits keyboard and mouse events from one computer to another and relays graphical screen updates back in the other direction over the network. This functionality allows users to interact with a GUI on another machine remotely. VNC was developed for the Remote Desktop feature, which allows users to work from any location, provided they have the proper permissions.

Prerequisites

Before you can configure a VNC server on Fedora, you need to fulfill a few pre-requisites. These include:

Setting up VNC Server on Fedora

First and foremost, you need to update your system to ensure that all existing packages are up to date. You can achieve this using Fedora's package manager, DNF.

# sudo dnf update

After the system is updated, install the TigerVNC server package. TigerVNC is a high-performance VNC server software. Use the following command to install it:

# sudo dnf install tigervnc-server

Initial configuration of VNC

After installing TigerVNC, you need to do some initial configuration. First, make sure you have a desktop environment installed. The server version of Fedora does not come with a GUI by default. You can install the GNOME desktop environment using the command:

# sudo dnf groupinstall "GNOME Desktop"

Verify the existence of the Desktop service:

# systemctl status graphical.target

Make sure the system boots into a graphical target by enabling this:

# sudo systemctl set-default graphical.target

Configuring VNC Server User Settings

For VNC to work, you must specify the user who will access the remote desktop. The configuration lies in setting up user-specific files. Each user who wants to use VNC must have his settings defined in a separate configuration file. Let's assume the user is vncuser.

Make a copy of the default VNC configuration template file:

# sudo cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service

Edit this file to specify the user:

# sudo nano /etc/systemd/system/vncserver@:1.service

Find the line where <USER> is mentioned and change it to vncuser:

[Service] Type=forking User=vncuser PIDFile=/home/vncuser/.vnc/%H:%i.pid ExecStart=/usr/sbin/runuser -l vncuser -c "/usr/bin/vncserver %i -geometry 1024x768 -depth 24" ExecStop=/usr/sbin/runuser -l vncuser -c "/usr/bin/vncserver -kill %i"

Setting a VNC password

For security reasons, VNC servers are password protected. You must set a VNC password for each user account before using the VNC service. This is important to ensure, as there is no point in setting up a Remote Desktop service if it can be easily broken into.

Switch to the user account you want to set the VNC password for:

# sudo su - vncuser

Run command to set the VNC password:

$ vncpasswd

You will be asked to enter and confirm a password. Remember this password, as you will need it to log in remotely via the VNC client.

Configuring the VNC Server

You can now configure the VNC server to start with your specific settings. Use the following steps:

  1. Make sure the service is loaded and enabled to start during boot time:
    # sudo systemctl daemon-reload # sudo systemctl enable vncserver@:1.service
  2. Start the VNC server:
    # sudo systemctl start vncserver@:1.service

You can also check the status to make sure everything is running correctly:

# sudo systemctl status vncserver@:1.service

Configuring the Firewall

Once your VNC server is configured, you will need to allow access to it through your firewall. VNC works on port 5900 by default. However, since you have set up VNC using display :1, you must allow traffic on port 5901.

# sudo firewall-cmd --permanent --add-port=5901/tcp # sudo firewall-cmd --reload

Starting the VNC server

If you followed the previous steps the VNC server should already be running. However, if you need to refresh its settings you can issue the following command to restart it:

# sudo systemctl restart vncserver@:1.service

Accessing a VNC Server Remotely

You can now access your Fedora machine's GUI from another computer. You'll need a VNC client to access it. Software options include RealVNC Viewer, TigerVNC, or TightVNC.

On your remote machine, open your VNC client and connect to 192.168.1.X:1, where 192.168.1.X is the IP address of your Fedora server. When prompted, enter the VNC password you set earlier.

Troubleshooting

You may encounter problems where the VNC connection does not work as expected. Here are some things you can check:

Security considerations

VNC is generally considered a secure way to access remote servers, but you can take a few additional steps to ensure that your VNC connection remains as secure as possible.

In conclusion, configuring a VNC server on Fedora can greatly enhance your ability to manage your system remotely. By following these steps, you should have a VNC server up and running that you can easily connect to your Fedora machine from anywhere. As with any remote access software, make security a priority to keep your data safe.

If you find anything wrong with the article content, you can


Comments