{"id":6216,"date":"2023-04-24T01:28:12","date_gmt":"2023-04-23T23:28:12","guid":{"rendered":"https:\/\/contabo.com\/blog\/?p=6216"},"modified":"2025-05-23T15:20:11","modified_gmt":"2025-05-23T13:20:11","slug":"how-to-install-a-gui-and-xrdp-on-ubuntu-and-centos","status":"publish","type":"post","link":"https:\/\/contabo.com\/blog\/how-to-install-a-gui-and-xrdp-on-ubuntu-and-centos\/","title":{"rendered":"How to install a GUI and XRDP on Ubuntu and CentOS"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"630\" src=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2023\/04\/blog-head_how2-install-a-GUI-and-XRDP-on-Ubuntu-and-CentOS.jpg\" alt=\"How to install a GUI on Ubuntu and CentOS (header image)\" class=\"wp-image-16925\" srcset=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2023\/04\/blog-head_how2-install-a-GUI-and-XRDP-on-Ubuntu-and-CentOS.jpg 1200w, https:\/\/contabo.com\/blog\/wp-content\/uploads\/2023\/04\/blog-head_how2-install-a-GUI-and-XRDP-on-Ubuntu-and-CentOS-600x315.jpg 600w, https:\/\/contabo.com\/blog\/wp-content\/uploads\/2023\/04\/blog-head_how2-install-a-GUI-and-XRDP-on-Ubuntu-and-CentOS-768x403.jpg 768w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/figure>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>It is not necessary to install a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Graphical_user_interface\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Graphical User Interface (GUI)<\/a> on a Linux based system because there is always the possibility to administrate and configure the system through SSH. However, undoubtedly, a GUI has its advantages. Especially for those who are experienced Windows users and who have never been using a terminal before, a GUI on Linux could be an alternative way to use a Linux-based server without paying extra money for a Windows license. Furthermore, a GUI can simplify work and make some complicated tasks more clear. This does not mean that the terminal is obsolete forever and ever but many tasks such as editing configuration files or managing the file structure within a file manager will be much easier.<\/p>\n\n\n\n<p>The following tutorial will provide all information to allow everyone to install a GUI and <a href=\"http:\/\/www.xrdp.org\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">XRDP<\/a> on CentOS and Debian based systems using <a href=\"https:\/\/www.xfce.org\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">XFCE4<\/a> as desktop environment and it will show how to connect to the server afterwards. The tutorial is separated in three parts: Fulfilling the prerequisites, how to install and configurate the software and finally how to connect to the system.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-prerequisites\">Prerequisites<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li> An already installed instance running any Linux operating system <\/li>\n\n\n\n<li>\nA working internet\n\tconnection to install additional packages on the remote server and\n\tto connect to the remote server from the local machine\n\t<\/li>\n\n\n\n<li>\nA VNC client or SSH\n\tclient to connect to the server from your local device\n\t<\/li>\n\n\n\n<li>\nA user which is allowed\n\tto log in to the operating system\n\t<\/li>\n\n\n\n<li>\nA little bit work on the\n\tterminal either via SSH or VNC\n<\/li>\n<\/ol>\n\n\n\n<p>It is not necessary to have a\nfresh installed server as it will always be possible to install the\nGUI and XRDP on an already installed and configured server at any\ntime.<\/p>\n\n\n\n<p>An internet connection is mandatory and should work in anyway on our servers. However, if this is &#8211; for some reason &#8211; not the case, you will have to establish an internet connection first.<\/p>\n\n\n\n<p>To create the user and to install all the necessary software you will have to connect to the server either via VNC on a VPS or via SSH on a VPS or Dedicated Server. To do so, we already have great tutorials you can refer to:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th><\/th><th> VPS\/VDS <\/th><th> Dedicated Servers<\/th><\/tr><\/thead><tbody><tr><td>\n\t\t\t\t<strong>SSH<\/strong>\n\t\t\t<\/td><td> <a href=\"https:\/\/contabo.com\/blog\/establishing-connection-server-ssh\/\" target=\"_blank\" rel=\"noreferrer noopener\">More Information<\/a> <\/td><td> <a href=\"https:\/\/contabo.com\/blog\/establishing-connection-server-ssh\/\" target=\"_blank\" rel=\"noreferrer noopener\">More Information<\/a> <\/td><\/tr><tr><td>\n\t\t\t\t<strong>VNC<\/strong>\n\t\t\t<\/td><td> <a href=\"https:\/\/contabo.com\/blog\/vnc-connect-vps\/\" target=\"_blank\" rel=\"noreferrer noopener\">More Information<\/a> <\/td><td>\n\t\t\t\tNot\n\t\t\t\tSupported\n\t\t\t<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>A user is needed to log in to the system after the RDP session was established. This can not be the user root since it is disabled to login on the GUI for security reasons. Furthermore, we actually do not suggest to work as user root directly but working with a user which is able to extend its privileges by the &#8216;sudo&#8217; command to perform tasks where root privileges are mandatory. <a href=\"https:\/\/contabo.com\/blog\/a-practical-guide-to-superuser-accounts-sudo-root\/\">You can learn more about root user and &#8216;sudo&#8217; command here<\/a>.<\/p>\n\n\n\n<p>Kindly note, if you decide to use VNC you will have to log in to the system first using your root credentials. Using SSH this is not necessary because you will directly be logged in to the system as the appropriate user which is root in our case. Once logged in we will first create the user:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>useradd -m -s \/bin\/bash USERNAME<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>passwd USERNAME<\/code><\/pre>\n\n\n\n<p>The first command creates a user with name USERNAME and its home directory in <em>\/home\/USERNAME<\/em> using bash as preferred shell. Please replace USERNAME with any name you like.<\/p>\n\n\n\n<p>The\nsecond command creates a password for this user. You will be prompted\nto enter a password two times as you may already know from\nregistration forms on the internet. After executing every command the\noutput of your terminal should look similar to the screenshot to the\nleft.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"501\" height=\"149\" src=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2019\/10\/xrdp.create_user.jpg\" alt=\"\" class=\"wp-image-6220\" srcset=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2019\/10\/xrdp.create_user.jpg 501w, https:\/\/contabo.com\/blog\/wp-content\/uploads\/2019\/10\/xrdp.create_user-300x89.jpg 300w\" sizes=\"auto, (max-width: 501px) 100vw, 501px\" \/><\/figure>\n\n\n\n<p>This\nare all prerequisites and we finished the first step now. Please do\nnot close the connection to your server as we will also need it to\ncomplete the second part of this tutorial.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-installation-and-configuration-of-xrdp-and-the-gui\">Installation and configuration of XRDP and the GUI<\/h2>\n\n\n\n<p>Although XRDP runs without a GUI a GUI is required to log in to the server. Therefore, we have to install both.<\/p>\n\n\n\n<p>XRDP and the GUI can be installed via the package management. Depending on the system you are using the commands are different. Please see the commands for Ubuntu and CentOS in the following:<\/p>\n\n\n\n<figure class=\"wp-block-table aligncenter\"><table><thead><tr><th> Ubuntu based systems <\/th><th>\n\t\t\t\tCentOS\n\t\t\t<\/th><\/tr><\/thead><tbody><tr><td>apt update<br>apt install xrdp vnc4server xubuntu-desktop <\/td><td>yum install -y epel-release <code>yum groupinstall \"Server with GUI\" -y<\/code><br><code>yum -y install<\/code> <code>xrdp tigervnc-server<\/code> <\/td><\/tr><tr><td>First update the package manager database and secondly install XRDP and the GUI. <\/td><td>First install the \u201eExtra packages for enterprise Linux) which makes XRDP available. The following two commands install a GUI and XRDP in combination with a VNC server. <\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>If all commands finished without errors, XRDP is successfully installed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-configure-xrdp\">Configure XRDP<\/h2>\n\n\n\n<p>Once done XRDP should work out of the box. However, we should at least enable TLS encryption to secure the communication between the client and the server. Although the installation of XRDP already includes a certificate, we will create our own by just performing a single command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>openssl req -x509 -newkey rsa:2048 -nodes -keyout xrdp.key.pem -out xrdp.crt.pem -days 3650<\/code><\/pre>\n\n\n\n<p>This will create two files,\nxrdp.key.pem and xrdp.cert.pem in the home directory of the current\nuser you are logged in with. Then\nadjust the file permissions to prevent other to read the private key:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chown root:root xrdp*.pem<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>chmod 640 xrdp*.pem<\/code><\/pre>\n\n\n\n<p>Then move this files to\n\/<em>etc\/<\/em>xrdp:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mv xrdp*.pem \/etc\/xrdp<\/code><\/pre>\n\n\n\n<p>Now\nit is time to alter the XRDP configuration. Please open the file\nxrdp.ini file with your preferred text editor:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nano \/etc\/xrdp\/xrdp.ini<\/code><\/pre>\n\n\n\n<p>and\nchange the appropriate lines security_layer, certificate and key_file\nas shown on the screenshot below:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"760\" height=\"231\" src=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2019\/10\/xrdp.tls_.jpg\" alt=\"\" class=\"wp-image-6225\" srcset=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2019\/10\/xrdp.tls_.jpg 760w, https:\/\/contabo.com\/blog\/wp-content\/uploads\/2019\/10\/xrdp.tls_-300x91.jpg 300w\" sizes=\"auto, (max-width: 760px) 100vw, 760px\" \/><\/figure>\n\n\n\n<p>Now\nwe will have to check if the system starts into the graphical target.\nTo verify this, type in the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl get-default<\/code><\/pre>\n\n\n\n<p>Now\nyou should see the output:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>graphical.target<\/code><\/pre>\n\n\n\n<p>on\nthe terminal. If this is not the case, please type the following to\nactivate the graphical target:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl set-default graphical.target<\/code><\/pre>\n\n\n\n<p>and\nverify with the above command if it was successfully set. Finally\nenable the xrdp server by typing the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl enable xrdp.service<\/code><\/pre>\n\n\n\n<p>Then\nset the appropriate desktop environment for the formerly created\nuser:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>echo \u201exfce4-session\u201c &gt; \/home\/USERNAME\/.xsession<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>chown USERNAME: \/home\/USERNAME\/.xsession<\/code><\/pre>\n\n\n\n<p>Afterwards,\nreboot your server. After the server is rebooted you should be able\nto connect via RDP with the server.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to install a graphical user interface (GUI) and XRDP on Ubuntu and CentOS Step-by-step guide with easy-to-follow instructions.<\/p>\n","protected":false},"author":32,"featured_media":16925,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[18],"tags":[],"ppma_author":[1504],"class_list":["post-6216","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials"],"uagb_featured_image_src":{"full":["https:\/\/contabo.com\/blog\/wp-content\/uploads\/2023\/04\/blog-head_how2-install-a-GUI-and-XRDP-on-Ubuntu-and-CentOS.jpg",1200,630,false],"thumbnail":["https:\/\/contabo.com\/blog\/wp-content\/uploads\/2023\/04\/blog-head_how2-install-a-GUI-and-XRDP-on-Ubuntu-and-CentOS-150x150.jpg",150,150,true],"medium":["https:\/\/contabo.com\/blog\/wp-content\/uploads\/2023\/04\/blog-head_how2-install-a-GUI-and-XRDP-on-Ubuntu-and-CentOS-600x315.jpg",600,315,true],"medium_large":["https:\/\/contabo.com\/blog\/wp-content\/uploads\/2023\/04\/blog-head_how2-install-a-GUI-and-XRDP-on-Ubuntu-and-CentOS-768x403.jpg",768,403,true],"large":["https:\/\/contabo.com\/blog\/wp-content\/uploads\/2023\/04\/blog-head_how2-install-a-GUI-and-XRDP-on-Ubuntu-and-CentOS.jpg",1200,630,false],"1536x1536":["https:\/\/contabo.com\/blog\/wp-content\/uploads\/2023\/04\/blog-head_how2-install-a-GUI-and-XRDP-on-Ubuntu-and-CentOS.jpg",1200,630,false],"2048x2048":["https:\/\/contabo.com\/blog\/wp-content\/uploads\/2023\/04\/blog-head_how2-install-a-GUI-and-XRDP-on-Ubuntu-and-CentOS.jpg",1200,630,false]},"uagb_author_info":{"display_name":"Michael","author_link":"https:\/\/contabo.com\/blog\/author\/michaelj\/"},"uagb_comment_info":0,"uagb_excerpt":"Learn how to install a graphical user interface (GUI) and XRDP on Ubuntu and CentOS Step-by-step guide with easy-to-follow instructions.","authors":[{"term_id":1504,"user_id":32,"is_guest":0,"slug":"michaelj","display_name":"Michael","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/6d6cdf09cae3aa60e4bc9fb09ae1551ac9978016ad93e36ec87f26dabb400108?s=96&d=mm&r=g","0":null,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/posts\/6216","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/users\/32"}],"replies":[{"embeddable":true,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/comments?post=6216"}],"version-history":[{"count":6,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/posts\/6216\/revisions"}],"predecessor-version":[{"id":23714,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/posts\/6216\/revisions\/23714"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/media\/16925"}],"wp:attachment":[{"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/media?parent=6216"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/categories?post=6216"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/tags?post=6216"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=6216"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}