Setting up a desktop and VNC on Ubuntu Server

Post Reply
User avatar
Edge100x
Founder
Founder
Posts: 12405
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Setting up a desktop and VNC on Ubuntu Server

Post by Edge100x » Tue Nov 09, 2010 12:25 pm

Here's one way to get a working VNC desktop with Ubuntu Server Edition. You can use this on a dedicated server or on a VDS. This was last tested with Ubuntu 20.04.

1. In a plain SSH (terminal) window on the server, type:

Code: Select all

apt-get update
apt-get install ubuntu-desktop tightvncserver xfce4 xfce4-goodies
Press enter when it asks to confirm that you want these packages installed.

If the "apt install" step downloads very slowly, try hitting control-C to abort it, then re-run the command; sometimes, a slow mirror is chosen.

2. Start the VNC server with this command:

Code: Select all

tightvncserver -nolisten tcp :1
It will ask you for a password. Choose a good one here, and enter it twice, as it asks. Then tell it "n" when it asks "Would you like to enter a view-only password?" (unless you want one). When you run tightvncserver again it will not repeat these questions.

3. Paste in these commands to stop the running VNC server, instruct Ubuntu to start up XFCE when VNC runs, and start back up the VNC server:

Code: Select all

killall Xtightvnc
echo "startxfce4 &" >> /root/.vnc/xstartup
tightvncserver -nolisten tcp :1
4. Open up a VNC viewer client on your personal computer and connect to w.x.y.z:1, where w.x.y.z is your server's IP address. It will ask for the password, and then display a desktop window to you.

Note that we recommend against running desktop applications on a server, for performance, security, and stability reasons. As Ubuntu docs state, a web-based administration package is usually a better choice (or simply using the command-line directly).

Sources:
https://help.ubuntu.com/community/ServerGUI
https://help.ubuntu.com/community/VNC/Servers
https://askubuntu.com/questions/800302/ ... -16-04-lts

User avatar
Edge100x
Founder
Founder
Posts: 12405
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Setting up a desktop and VNC on Ubuntu Server

Post by Edge100x » Mon Jul 20, 2020 2:29 pm

If you would prefer to run the Gnome desktop environment instead of xfce, you can switch to that. Just run these commands after following the other steps:

Code: Select all

apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal
killall Xtightvnc
perl -pi -e 's/startxfce4/gnome-panel/' /root/.vnc/xstartup
echo "gnome-settings-daemon &" >> /root/.vnc/xstartup
echo "metacity &" >> /root/.vnc/xstartup
echo "nautilus &" >> /root/.vnc/xstartup
tightvncserver -nolisten tcp :1

Post Reply