In the future, using the website cloudhosting.lv, you agree to the rules of using Cookies. Read more. I agree
Using the desktop environment on CentOS 7 VPS
When you buy a remote VPS or Cloud server, it is likely that they will only ship with a command line interface. If you want to use the graphical desktop to manage the server and perform various tasks, you can follow this guide.
In this guide, you will learn how to install another lightweight graphical desktop environment for your CentOS 7. You will also learn how to install XRDP on your remote VPS so that you can use the graphical interface from your computer..
Requirements
To follow this guide, you will need a VPS or a cloud server running CentOS 7.x. In addition, you will also need root access. If you are logged in as a non-root user, run sudo -i to switch to the root account. Starting the desktop environment requires additional RAM compared to the command line interface, so make sure you have at least 512 MB, 1 GB recommended.
Install Desktop Environment
In this guide, we will install the GNOME, MATE, and XFCE desktop environments. All of these environments are open source and have various features. You can install any of these desktop environments depending on your choice. Please note that you should install only one desktop environment from the options below. Installing more than one desktop environment will break your computer.
efore installing any package, it is recommended to update the system and installed packages using the following command.
yum -y update
After upgrading your system, you can continue to install any of these desktop environments.
GNOME Installation
GNOME is a desktop environment created using only open source and free software. GNOME is supported on almost all Linux platforms. GNOME has been actively developing for 17 years and is being developed by the GNOME project. The latest version of this software is GNOME 3, which contains many different features.
To install GNOME, run the following command.
yum -y groupinstall "GNOME Desktop"
The above command will install many packages on your system, so it will take some time depending on the speed of your network and equipment. Now run the following command to start GNOME at boot time.
ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target
Now reboot the system using the init 6 command and proceed to install XRDP on your system.
Installing MATE
MATE came from unsupported GNOME 2 code. It is also a very popular desktop environment, and it was the default desktop for Mint and Fedora.
MATE is not available in the YUM repository by default, so you also need to add the EPEL repository to your system. To add an EPEL repository, run the following command.
yum -y install epel-release yum -y update yum clean all
The above command will install the EPEL repository on your system and then update the repository. Finally, the last command will clear the YUM cache from your system..
Now run the following command to install a minimal X windows system on your system.
yum -y groupinstall "X Window system"
Now run the following command to install the MATE graphical desktop system.
yum -y groupinstall "MATE Desktop"
The MATE desktop installs fewer packages on your system compared to the GNOME desktop, so it will take less time compared to GNOME. In addition, we can say that it is lighter than the GNOME desktop.
Now run the following command to start the GUI or MATE desktop at boot time.
systemctl set-default graphical.target
You should see the following output:
[root@Mate ~]# sudo systemctl set-default graphical.target Removed symlink /etc/systemd/system/default.target. Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/graphical.target.
Now reboot the system using the init 6 command and proceed to install XRDP on your system.
Install XFCE
XFCE is another open source graphical desktop environment written in C. XFCE is the recommended desktop environment for remote servers because it is lightweight and fast, and therefore does not require a lot of hardware resources. XFCE is not available in the YUM repository by default, so you also need to add the EPEL repository to your system. To add an EPEL repository, run the following command.
yum -y install epel-release yum -y update yum clean all
The above command will install the EPEL repository on your system and then update the repository. Finally, the last command will clear the YUM cache from your system.
Now run the following command to install a minimal X windows system on your system.
yum -y groupinstall "X Window system"
Now run the following command to install the XFCE desktop on your system.
yum -y groupinstall xfce
Now run the following command to launch the XFCE GUI or desktop at boot time.
systemctl set-default graphical.target
You should see the following output:
[root@Mate ~]# sudo systemctl set-default graphical.target Removed symlink /etc/systemd/system/default.target. Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/graphical.target.
Now reboot the system using the init 6 command and proceed to install XRDP on your system.
Install XRDP
I hope you have successfully installed any of the abov graphical environments. Now that we have the finished desktop, we need to install XRDP on our machine so that we can access the remote machine in graphical mode. XRDP supports Windows Remote Desktop Client as well as VNC Viewer.
To install XRDP on your system, you need to add an EPEL repository to your system. If it is installed earlier, you can skip or install EPEL using the following commands.
yum -y install epel-release yum -y update yum clean all
Now run the following commands to install XRDP on your computer.
yum -y install xrdp tigervnc-server
Now you will need to make changes to your SELINUX. You can configure SELINUX using the following commands.
chcon --type=bin_t /usr/sbin/xrdp chcon --type=bin_t /usr/sbin/xrdp-sesman
You also need to configure firewall rules to allow port 3389 that the RDP service will listen on. Run the following commands for the same.
firewall-cmd --permanent --zone=public --add-port=3389/tcp firewall-cmd –reload
Now you can run XRDP on your system using the following command.
systemctl start xrdp
To start XRDP automatically at boot time, run the following command.
systemctl enable xrdp
To check if the XRDP service is working, use the following command.
netstat -antup | grep xrdp
You will get the following output.
[root@ip-172-31-24-179 ~]# netstat -antup | grep xrdp tcp 0 0 127.0.0.1:3350 0.0.0.0:* LISTEN 23532/xrdp-sesman tcp 0 0 0.0.0.0:3389 0.0.0.0:* LISTEN 23533/xrdp
You can also use the following command to check the status of the XRDP service.
systemctl status xrdp
You should see the following output.
[root@ip-172-31-24-179 ~]# systemctl status xrdp ● xrdp.service - xrdp daemon Loaded: loaded (/usr/lib/systemd/system/xrdp.service; disabled; vendor preset: disabled) Active: active (running) since Wed 2016-09-07 03:27:39 UTC; 2s ago Main PID: 23579 (xrdp) CGroup: /system.slice/xrdp.service └─23579 /usr/sbin/xrdp --nodaemon Sep 07 03:27:39 ip-172-31-24-179 systemd[1]: Started xrdp daemon. Sep 07 03:27:39 ip-172-31-24-179 systemd[1]: Starting xrdp daemon...
Connect to CentOS Machine
If you are using a Windows computer, you can use the built-in remote desktop client to connect to your CentOS computer with your favorite graphical desktop environment. Run the Remote Desktop Client from the search, or you can also run the mstsc command from the command line. Enter the IP address of the remote computer. Then click “Show Options” and go to the “Show” tab. Choose True Color (24 bits) from the color drop-down menu.
Finally, click the “Connect” button, and you will see a warning that the name of the remote computer is not confirmed, click “OK” to continue, and you will be prompted to enter the username and password of your remote computer. Once you are logged in, you will see the following screen.
Conclusion
In this example, we learned how to set up different graphical environments. We also learned how to install XRDP to enable the RDP server on your system. We also learned how to connect to your remote machine using the Windows Remote Desktop Client.