Here is how to enable graphical interface to your CentOS-7 server (remote server). If you want to setup GUI on Ubuntu please click here.
To get a graphical mode on remote Linux, we need to setup a VNC server application on the remote Linux server, and a VNC client app on our local computer. Download VNC Viewer 32 for your 32 bit Windows computer, or download VNC Viewer 64 for your 64 bit Windows.
In this tutorial, I have bought a CentOS VPS from 1and1 for temporary use. I use the IP address “74.208.xxx.xx”, CentOS server username “root”, CentOS server password “vy5wKc&tLxrHb”, VNC app password “tXj2pNqh“. Keep in mind that the VNC password should be eight characters long. These credential settings surely differ for you, so you should replace them where appropriate. And also, please make sure that your server’s firewall port (22, 5900, 5901) are already open before starting setup.
If you’re unable to login as root, please click here to learn how do you enable root.
Now, prepare PuTTy session to proceed next. Run PuTTy and provide server’s IP address in the hostname field, give a session name, and click “Save“.
Set “root” as login name for all session. Username will be permanently saved as root for server login on any future session. Load your server’s saved session, and click “Data” under “Connection” category menu.
Write “root” in auto-login username field, and click “Session” from Category menu.
Again, click “Save“, and then click “Open” to go to the terminal window.
A security warning will open for the first time, click “Yes” and you’ll never get this warning in future sessions.
This time, terminal window will open and asking you for password. Write your CentOS server’s root password (when typing password you can’t see it) and press Enter.
If you want to copy/paste the password, just copy the password from your computer and on the PuTTy terminal window click your mouse right-button. Know that the mouse right-button click is the paste command in PuTTy window.
Now, the terminal is ready to take and apply command to server. Just write command and press Enter.
In this tutorial, I have given the all commands to setup Linux GUI. Each command are outlined with a border as code format. You can copy each command from here and paste it to your terminal.
First install nano text editor and default downloader, if you did not get it already.
yum -y update
yum -y install nano wget
And then run Yum Upgrade.
yum -y upgrade
Restart the server.
After reboot, open PuTTy again and login to start new session.
Update package list again:
Command a query to test, if desktop environment group is available in your CentOS yum repository.
yum group list
You might get query result like this:
Available Environment Groups: Minimal Install Compute Node Infrastructure Server File and Print Server Basic Web Server Virtualization Host Server with GUI GNOME Desktop KDE Plasma Workspaces Development and Creative Workstation Available Groups: Compatibility Libraries Console Internet Tools Development Tools Graphical Administration Tools Legacy UNIX Compatibility Scientific Support Security Tools Smart Card Support System Administration Tools System Management Done
Send command to install Gnome Desktop:
yum -y groupinstall "GNOME Desktop"
Please wait for the installation completion.
Install a VNC server:
yum -y install tigervnc-server
Create the vncserver configuration file:
cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
If you unfamiliar with nano please click here to look at nano’s very simple uses.
Edit the configuration file, so that root can login via VNC Viewer:
Just replace “<USER>” with root as it shown below:
It’s time to allow vnc-server to the system firewall:
systemctl restart firewalld
firewall-cmd --permanent --zone=public --add-service vnc-server
systemctl restart firewalld
Now, create password for login to the VNC Viewer:
You will require a password to access VNC Server. Provide an eight characters password and press Enter.
Provice the same VNC Password again for confirmation.
Then, you will be offered to enter a view-only password. Just write
n and press Enter.
Reload VNC Server:
Setup VNC Server to run at system startup:
systemctl enable vncserver@:1.service
Restart the server:
If you want to use VNC in unsecured mode, you can login now to your remote desktop by using VNC Viewer. Open VNC Viewer software/app from your Windows computer. VNC Viewer app download link is given at the beginning of this tutorial. Write VNC address as “IP:Port” (22.214.171.124:5901), and click Connect.
A password prompt will appear, type the VNC Password there and press Enter.
You are good to go on your remote server’s Desktop. Enjoy !
Or, you can configure secure connection via PuTTy. Follow the below guide.
Here we need to setup a tunnel on PuTTy for securely access to the remote server. Load the session profile and expand SSH category menu.
Enable X11 forwarding.
Add IP:Port to the tunneling section.
After added the tunnel info, the address will show on the box.
Go back to Session category, and click Save again.
Now, PuTTy tunneling setup is done. Load the session profile and click Open. Login and keep terminal open as long as you want to securely access your server’s remote desktop.
Open VNC Viewer software/app from your Windows computer. VNC Viewer app download link is given at the beginning of this tutorial. Write VNC address as “localhost:1”, and click Connect.
A password authentication will appear, type the VNC Password there and press Enter.
Congratulations ! You got your remote CentOS’s Desktop in the VNC-Viewer window.
Configure some basic desktop settings there and done. Enjoy !