Skip to content

Instantly share code, notes, and snippets.

@nathanhaigh
Created November 3, 2012 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathanhaigh/4007406 to your computer and use it in GitHub Desktop.
Save nathanhaigh/4007406 to your computer and use it in GitHub Desktop.
Script to build an Ubuntu machine with the FreeNX server for a remote desktop-like connection. Can be used as "user data" to be passed to cloud-init in cloud environments.
#!/bin/bash
apt-get update
apt-get -y dist-upgrade
apt-get -y install ubuntu-desktop gnome-session-fallback python-software-properties
add-apt-repository -y ppa:freenx-team
apt-get update
apt-get -y install freenx
cd /tmp
wget https://bugs.launchpad.net/freenx-server/+bug/576359/+attachment/1378450/+files/nxsetup.tar.gz
tar xzf nxsetup.tar.gz
cp nxsetup /usr/lib/nx/nxsetup
/usr/lib/nx/nxsetup --auto --install
ssh-keygen -f "/var/lib/nxserver/home/.ssh/known_hosts" -R 127.0.0.1
sed -i -e 's/^.\(NX_LOG_LEVEL\)=.$/\1=6/' /etc/nxserver/node.conf
sed -i -e 's/^#\(NX_LOGFILE\)/\1/' /etc/nxserver/node.conf
sed -i -e 's/^.\(ENABLE_SSH_AUTHENTICATION\)="."$/\1="1"/' /etc/nxserver/node.conf
sed -i -e 's/^#\(SSHD_PORT\)/\1/' /etc/nxserver/node.conf
# enable ssh login with passwords
sudo sed -i -e 's@PasswordAuthentication no@PasswordAuthentication yes@' /etc/ssh/sshd_config
# Set Golden Bloom as wallpaper
sed -i -e 's@\(warty-final-ubuntu.png\)@Golden_Bloom_by_Twinmama.jpg@' /usr/share/glib-2.0/schemas/10_gsettings-desktop-schemas.gschema.override
glib-compile-schemas /usr/share/glib-2.0/schemas/
# restart SSH service and NX Server
sudo service ssh reload
sudo nxserver --restart
sync
#reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment