Access Remote Centos 8

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

This post is about Access Remote Centos 8

Introduction

X is a windowing system used to display bitmaps in Unix-based operating systems. In other words, the X system provides the base for implementing a GUI in Linux. For instance, the X system allows you

  • to run an application in windows
  • to move windows around the screen
  • Click on items

So, without X, you will have to interact access remote centos 8 with the operating system using a text-based interface in which you would need to type commands. On the other hand, X will give your Linux-based operating system a look and feel you see in Microsoft Windows.

In an X system, the underlying engine is the X protocol, which manages displays on local and remote systems. This protocol follows a client-server model. Clients are simply programs, whereas the X server is responsible for displaying everything on clients’ demand, even if they are not residing on the same machine.

# dnf groupinstall "Server with GUI" -y

VNC – is the simplest of these three methods to get remote access. VNC stands for Virtual Network Computing) is a beneficial network graphics protocol.
You need to enable EPEL (Extra Packages for Enterprise Linux) repository. Run

# dnf install epel-release -y
# dnf install tigervnc-server -y

 Add user(s) for VNC

# useradd neil
# passwd neil

Create a VNC Password

You also need to set up a VNC password for the user. It can be the same or different from the login password of that user. First, you need to change into the user. To do that and to add a password, type:

# su - neil
neil@localhost$ vncpasswd

Edit VNC Server’s Unit file

While installing the package, dnf also installs a generic VNC service unit file in /lib/systemd/system directory. Copy that file to the /etc/systemd/system directory using the cp command:

# cp /lib/systemd/system/[email protected] /etc/systemd/system/vncserver@:1.service
# vi /etc/systemd/system/vncserver@:1.service
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
Requires=systemd-logind.service

[Service]
Type=oneshot
RemainAfterExit=yes

# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/sbin/runuser -l USERNAME -c "/usr/bin/vncserver %i"
ExecStop=/usr/sbin/runuser USERNAME -c '/usr/bin/vncserver -kill %i'

[Install]
WantedBy=multi-user.target

Reload Systemd Daemon

To inform systemctl about the changes in the unit file or a new unit file, you need to reload the systemd daemon by typing:

#systemctl daemon-reload

Start the VNC Server

# systemctl start vncserver@:1.service

To automatically start it at boot, type

#systemctl enable vncserver@:1.service

Configure the firewall to open the port used by VNC

It would help if you opened the port used by the VNC Server using the firewall-cmd command:


# firewall-cmd --zone=public --permanent --add-service=vnc-server
#firewall-cmd --reload

Connecting to VNC Server

You need to install a VNC Viewer to connect to a VNC Server from the client system. For example, I’ll connect using the Tiger VNC Viewer from an Ubuntu machine. To install it, type:

# dnf install tigervnc-viewer

For other distros, you can install them using their respective package managers.
To connect to a VNC Server on IP Address 192.168.1.100 and port number 5901, type:

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"
Neil
Neil
Treat your password like your toothbrush. Don’t let anybody else use it, and get a new one every six months.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook