How to set up an XFCE desktop in EC2

Sometimes it’s nice to have a desktop out in the cloud, especially if you work at a site that has an overzealous web proxy.  Port 22 is frequently open, so NoMachine makes a lot of sense.

Here’s how to set up a Fedora 19 EC2 instance running the XFCE desktop.  You could go with a different desktop manager, but XFCE is nice and light, which lets you get by with a t1.micro instance if you’re cheap.

  1. Click on this link to launch a Fedora 19 instance.  If you don’t want to use US East, go to cloud.fedoraproject.org and take your pick.
  2. Setup your instance.  If you don’t know how to do this, Google is your friend.
  3. Since I’m using a t1.micro instance, which only gives you a 2 GiB root volume, I need a little extra space.  During the setup phase I upped my root volume size to 20 GiB.
  4. Once you’re logged in, execute the following.

$ sudo su -
# yum update -y; yum install -y @xfce; yum install -y wget firefox
# systemctl start graphical.target
# wget http://64.34.173.142/download/3.5.0/Linux/nxclient-3.5.0-7.x86_64.rpm
# wget http://64.34.173.142/download/3.5.0/Linux/nxnode-3.5.0-9.x86_64.rpm
# wget http://64.34.173.142/download/3.5.0/Linux/FE/nxserver-3.5.0-11.x86_64.rpm
# rpm -ivh /root/nx*.rpm
# echo "SSHAuthorizedKeys = "authorized_keys"" >> /usr/NX/etc/server.cfg
# sed -i -e 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
# systemctl reload sshd.service
# useradd mynxuser
# passwd mynxuser
# usermod -a -G nx mynxuser
# /usr/NX/bin/nxserver --start

If you’re on Windows, you can get the client package here. It’s nice because it doesn’t require Administrator privileges to install.  Other OS client packages are available on the NoMachine downloads page.

Install the NX client and accept all the defaults.  When you start the client, click Configure, and enter the following:

  • Host: IP or FQDN of your EC2 instance
  • Under Desktop, choose Unix and Custom, then click Settings.  Choose Run the following command and enter /usr/bin/startxfce4.  Under Options, choose the New virtual desktop radio button.  Adjust the slider to WAN.  Click Ok.
  • Under Display, I like Fullscreen.  YMMV.
  • Now, for Login enter mynxuser and the Password you set.
  • Give the session a name.  I chose xfce.

That should do it!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s