筆者について
FreeBSDを通じてOSSにささかな貢献を。
- 日本xrdpユーザ会発起人
- xrdp developer
- FreeBSD developer
OSS活動をご支援いただける方を募集しています
2013-10-15 How to build virtual desktop infrastructure with xrdp & x11rdp on #FreeBSD
■ How to build virtual desktop infrastructure with xrdp & x11rdp on #FreeBSD
This article explains how to build virtual desktop infrastructure with xrdp & x11rdp on FreeBSD.
Basic explanation
This article is written for FreeBSD 9.2-RELEASE. It may work with other releases but I haven't confirmed yet.
$ prompt means you run following command as a normal user. # prompt means you run following command as super user. ${PREFIX} is usually /usr/local.
Here's the target versions.
- FreeBSD
- 9.2-RELEASE
- xrdp
- xrdp-0.6.0_4,1 or xrdp-0.6.1,1
- x11rdp
- x11rdp-0.5.0.299
Step 1. Keep ports tree up to date
First of all, keep ports tree up to date using portsnap(8) or anything you prefer. Here's an example to update ports tree with portsnap(8).
# portsnap fetch update
Step 2. Install net/xrdp
Just install net/xrdp.
# make -C /usr/ports/net/xrdp install clean
Run following command instead of `make install` if you use portmaster.
# portmaster net/xrdp
Make sure all XVNC options are disabled because you use X11rdp instead of Xvnc now. Either is OK for JP106 option. If you don't need Japanese keyboard you can disable it.
Step 3. Obtain x11rdp from my redports repository and install
May 1 2014: Now x11-servers/x11rdp is available in official ports tree. X11rdp will be installed by default configuration. You can skip this step.
If you haven't installed subversion, install it first.
# make -C /usr/ports/devel/subversion
# portmaster devel/subversion
Then, run the following command in your home directory to obtain x11rdp port. If you asked to accept ssl certificate, accept it.
$ svn co https://svn.redports.org/meta/x11-servers/x11rdp/
After that, build x11rdp and install. This may take a while (30 minutes or so).
$ cd x11rdp # make fetch $ make # make install
Step 4. Configure net/xrdp
May 1 2014: This patch is already included current xrdp ports. Skip to editing /etc/rc.conf.
By default setting, xrdp uses Xvnc to raise X session. Apply this patch to xrdp.ini in order to use X11rdp instead of Xvnc.
$ cd /tmp $ fetch https://gist.github.com/metalefty/6983663/raw/9fc314a16ad35c149dc418beac10b5e4ca8bf4a2/patch-xrdp.ini $ cd /usr/local/etc/xrdp # patch < /tmp/patch-xrdp.ini
To enhance seurity, find the following line in ${PREFIX}/etc/xrdp.ini and replace low with high.
crypt_level=low
will be:
crypt_level=high
Add following two lines to /etc/rc.conf.
xrdp_enable="YES" xrdp_sesman_enable="YES"
And then, launch xrdp daemons.
# service xrdp start
Step 5. Install desktop environment
For instance, I use xfce4 for desktop environment. Run the following command to install xfce4. This may take much longer than Step 3.
# make -C /usr/ports/x11-wm/xfce4 config-recursive install clean
or
# portmaster -d x11-wm/xfce4
You don't have to install gdm login manager.
Step 6. Configure startvm.sh
You may need to set your language in ${PREFIX}/etc/xrdp/startwm.sh. For example:
export LANG=ja_JP.UTF-8
or
export LANG=de_DE.UTF-8
or something. You can set other environment variables such as an input method.
Each user can override ${PREFIX}/etc/xrdp/startwm.sh by placing startwm.sh in her home directory.
Step 7. Finally connect to virtual desktop via RDP
Conect to virtual desktop with Microsoft Remote Desktop Client for Win/Mac, Remmina, or FreeRDP. Here's the sample screenshots on Mac.
Input IP address or hostname of xrdp server.
Enter your username and password.
You will be reach xfce4 desktop environment.
If you reconnect with client which have different resolutions, the X11 session would be automatically resized on reconnect.
Step 8. Enjoy your virtual desktop
Install Firefox, Libreoffice, and many other useful GUI software, enjoy!
Limitations
xrdp v0.6 cannot redirect sounds to client. All sound are played server side. Sound redirection is available with xrdp v0.7 via pulseaudio. However current portversion of net/xrdp-devel (0.7.0.20120918) is very experimental and sound redirection is not available yet. I'm working on porting latest xrdp v0.7 to FreeBSD. I will write another article to use latest xrdp v0.7 in a few weeks.
Any questions, please leave comments this article or email me meta_at_vmeta.jp.
Greeet ! You are help me ! It's very good for me !
I'm glad to hear that.
Yay \o/ RDP & native RDP at that! Compiles cleanly from the port now & only required a reverse patch & re-patch of the ini to switch to native.
Great article. I got it working with the xrdp-devel-0.7.0.b20130912_1 on FreeBSD 10. However only with the Xvnc backend X11rdp give a error after authenticating.
Look like it doesn't like the '-uds' option which was param5 in /usr/local/etc/xrdp/sesman.ini<br><br>I commented it out and restarted the service. But still not working. Not sure why now.<br><br>[X11rdp]<br>param1=-bs<br>param2=-ac<br>param3=-nolisten<br>param4=tcp<br>#param5=-uds<br><br><br>Maybe this is why? I don't quite understand that error though.<br><br>root@ip-172-31-14-71:/var/log # X11rdp :10 -geometry 1024x768 -depth 24 -bs -ac -nolisten tcp<br><br>X11rdp, an X server for xrdp<br>Version 0.5.0<br>Copyright (C) 2005-2008 Jay Sorg<br>See http://xrdp.sf.net for information on xrdp.<br>Underlying X server release 70100000, The X.Org Foundation<br>Xorg Release 7.1<br>Screen width 1024 height 768 depth 24 bpp 32<br>dpix 100 dpiy 100<br>buffer size 3145728<br><br>Fatal server error:<br>Couldn't add screen
The problem is you're using xrdp-devel. xrdp-devel-0.7.0.b20130912_1 is NOT compatible with x11rdp-0.5.0.299. <br>Did you try xrdp-0.6.1_3,1 with x11rdp-0.5.0.299? This combination works but other combinations don't.<br><br>If you want to use xrdp-devel-0.7.0, try x11rdp-devel on my redports repo but not well-tested.<br>https://svn.redports.org/meta/x11-servers/x11rdp-devel/<br><br>Please use the versions described on the top of this article. It will work.
Thank you for the inspiration, this was really what I was looking for. I am now enjoying mate-session straight from my server.
Is there no need to configure firewall to allow port 3389 ? I am using freebsd 10.1 and not able to access the desk top remotely. I am using MATE. I am using xrdp successfully on fedora but not on freeBSD. Could you please help? I am able to login to sesman-x11rdp but the session closes after few seconds. It says login Ok, but stops there.
Is there no need to configure firewall to allow port 3389 ? I am using freebsd 10.1 and not able to access the desk top remotely. I am using MATE. I am using xrdp successfully on fedora but not on freeBSD. Could you please help? I am able to login to sesman-x11rdp but the session closes after few seconds. It says login Ok, but stops there.<br><br>As I am using MATE, what should be the value in SESSIONS in file startwm.sh ? It now does not have anything to indicate MATE<br><br>It has:<br>SESSIONS="gnome-session blackbox fluxbox startxfce4 startkde xterm"
You need to pass port 3389, a matter of cource. If you're using MATE, edit SESSIONS to fit your desktop.<br>I'm not sure what exactly you should set SESSIONS because I don't use MATE but probably mate-session or something like that.
Hi,<br><br>thank you, yours is the only good howto for rdp and freebsd!
Glad to hear that.<br><br>The latest stable version of xrdp which available on FreeBSD is still 0.6.1.<br>But hat version is now considered to be old. I'm planning to describe how to use the new version of xrdp and x11rdp, with TLS support.
thanks for this and everything else you contribute!!!!
Great article, thanks much! You may want to update it as x11rdp is now the default back-end, so no patches are needed and the process is much simpler.
I follow above step. But I log in every time successfully that show connected ok. Then close the window itself. Why? I missed something? Please help me. I have installed and tried several times. I am confusing.
Sorry! I have solved it. Because I install in vmware workstation. I haven't install vmware tools. Thanks.