You are on page 1of 6

Jerry Vigil MktNeutral.

com September 12, 2012 HOWTO Install XRDP on Linux for Faster Remote GUI Sessions than VNC
VNC (Virtual Network Computing, http://en.wikipedia.org/wiki/Vnc) is considered the standard in remote GUI software for connecting to a Linux box from a remote machine and initiating a desktop GUI session with your favorite desktop environment such as GNOME, Unity, Xfce, KDE, etc. Many variants of the VNC server/client system exist including the popular RealVNC and TightVNC implementations. While these tools are great for connecting to a remote Linux machine, the GUI sessions can often be slow and unresponsive, especially when connecting from a Windows machine, making some applications such as IDEs, graphics editors, and webbrowsers cumbersome to use, even if both the client and the server are on the same physical network. An alternative solution to VNC is to install an RDP server (Remote Desktop Server, http://en.wikipedia.org/wiki/Remote_Desktop_Protocol) on your Linux box and to broadcast your VNC sessions over the RDP protocol. Microsoft Windows clients that connect to the Linux box over RDP will benefit from faster and more responsive GUI sessions because the Windows RDP client is built into Windows XP/Vista/7 and the RDP protocol and client has many graphics optimizations that are absent in a typical VNC client/server implementation. In my opinion, RDP and desktop virtualization represents one of a handful of areas where Microsoft has been a leader with a superior product. XRDP (http://www.xrdp.org/) is an open source RDP server for X11 that I have been using for about 4 years with high satisfaction. With XRDP I am able to log into my remote Linux VMs and use IDEs, graphics editors, and emulators such as Eclipse, IntelliJ IDEA, GIMP, and the Android emulator seamlessly. Streaming video also works with XRDP as long as both the client and server are on reasonably fast internet connections.

The simplest way to install XRDP is from a YUM, APT, or other package repository. You may find a suitable package for your Linux distribution, version, and architecture on http://pkgs.org at the URL below if it is unavailable on your system's default repos. http://pkgs.org/search/?keyword=xrdp While the installation via YUM or APT is always easier, it's often not a viable option as your package manager may fail to resolve some of the dependencies or a suitable .rpm or .deb package is unavailable for your Linux box's distro, version, and architecture. Installation from source

Step #1 Ensure that you have a vncserver package installed and working on your system. I have personally used XRDP successfully with RealVNC (http://www.realvnc.com/) and TightVNC (http://www.tightvnc.com/). If you don't have a vncserver package installed on your machine, you should be able to install it with your favorite package manager such as YUM, APT or similar. If you need to find a repo, you can use http://pkgs.org and add it your /etc/yum.repos.d or /etc/apt/sources.list accordingly. Step #2 Download the XRDP source tarball from sourceforge or checkout the XRDP code from github. The sourceforge and github repo links are below. http://sourceforge.net/projects/xrdp/files/xrdp/ https://github.com/FreeRDP/xrdp

Step #3

If you are installing from the sourceforge tarball, unzip and extract it and go to the root directory of the XRDP project. If you checked out the sources from github, then go to the XRDP project's root directory. Example using the sourceforge tarball: tar xzvf xrdp-v0.6.0.tar.gz cd xrdp-v0.6.0 Example using the github repo: git clone http://github.com/FreeRDP/xrdp.git cd xrdp Step #4 In order to build from the sources, you first need to generate the Makefile by running the bootstrap and configure scripts in the XRDP project's root folder. At this point you may need to install some library dependencies and gnu build tools in order to successfully build the XRDP project. Here is a list of packages that I had to install in order to successfully build XRDP on my one of my work VM's running RHEL 5 64-bit.

autoconf.noarch automake.noarch libtool.x86_64 pam-devel.x86_64 libX11-devel.x86_64 libXfixes-devel.x86_64 If you have all of the required packages, you can then generate the Makefile by running the bootstrap and configure scripts. ./bootstrap ./configure Step #5 Do make and make install to build the sources and install all of the binaries and configuration files on your Linux box. make; make install XRDP Configuration The default path for the XRDP configuration files and the XRDP startup script is /etc/xrdp/. If you would like to change this directory, you can pass a parameter to the ./configure script before generating the Makefile. The main configuration file is the xrdp.ini file. In this file, we can modify global settings for the RDP server, and the session specific settings for the RDP sessions. Open the xrdp.ini file in the /etc/xrdp folder and edit the values under [xrdp1]. Here is sample snippet from my xrdp.ini file in which the RDP session is configured to run from the VNC session running as root. [xrdp1] name=vnc-any lib=libvnc.so ip=localhost port=ask5901 username=root password=ask
I would also recommend that you consider changing the listening port from the standard of 3389 to some other TCP port if your Linux box is not behind a VPN. I would strongly recommend this if you are running a VM on a public service such as Amazon EC2, Rackspace, GoDaddy, GoGrid, Slicehost, etc. Since 3389 is the standard RDP listening port, hackers may try and 3

connect to your box using RDP on that port, and using a nonstandard port could lower the probability of being hacked. The port property is listed at the top of the xrdp.ini configuration file under [globals]. Remember to open the TCP port up on your firewall(s).

VNC and Desktop Environment Configuration Check that all the packages required to run your favorite desktop environment (GNOME, Unity, Xfce, KDE, etc.) are installed. If you have already used your desktop environment locally or from VNC, then this should be a given. However, if it is a VM and you have only connected via SSH, then you may need to install additional desktop environment packages.
You need to have VNC configured for the UNIX user account(s) from which you want to run the GUI sessions. The VNC config files are in the .vnc directory in the $HOME directory for each UNIX account. For example, for the root UNIX user account they are in /root/.vnc. The only file you may need to edit is the xstartup file. My sample xstartup for running the GNOME desktop environment is listed below.

#!/bin/sh # Uncomment the following two lines for normal desktop: # unset SESSION_MANAGER exec /etc/X11/xinit/xinitrc [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources xsetroot -solid grey gnome-panel & exec gnome-shell & twm &= Startup Your VNC Server If you don't already have an instance of vncserver running on your machine, then you need to start one. Even if you do, and you edited the xstartup file, then restart the vncserver to reflect those changes. While it is not required, I would recommend setting the graphics geometry for your vncserver session either in your xstartup file or on the command line when you start the vncserver. Here is an example that starts a server session with a desktop screen size of 1820 by 1024 pixels. vncserver :1 -geometry 1820x1024

Startup the RDP Server Start the XRDP server using the xrdp.sh script in /etc/xrdp. Here is an example. /etc/xrdp/xrdp.sh start Log Into Your Linux Box From Windows with the RDP Client You should now have a vncserver instance running on your Linux box with the GUI session broadcasting over the remote desktop protocol on the port you specified in your xrdp.ini config file. Open the remote desktop client on your Windows machine. If you are unfamiliar with the RDP client, it should be under Start -> All Programs -> Accessories -> Remote Desktop Connection. In the input labeled "Computer" enter the hostname or IP address of your Linux box. You will also need to append the listening port to the hostname as in "myhostname.com:port" if your RDP server is configured to listen on a nonstandard port. Click the "Connect" button. You should now see the XRDP login screen, which should look similar to the screenshot below. Enter the password for your VNC session in the "password" field. This should be the password that you set when you started the vncserver from the command line. Click the "OK" button.

You should now see your Linux machine's desktop environment, and you should be able to use your installed GUI applications. A downside to XRDP is that it does not have support for clipboard cut and paste and drag and drop file transfer between the client and server hosts. 5

While I think it would be a challenge to get the cut and paste to work, it would be cool if the drag and drop file transfer could be supported in a later release. I imagine there are several different ways that this could be implemented.

You might also like