Using VNC to Operate a Desktop on Ubuntu 18.04

Frankie Fan
2 min readOct 16, 2020


Install ubuntu-desktop and VNC server

#Update the package sources
sudo apt-get update
sudo apt-get upgrade

#Install ubuntu-desktop
sudo apt-get install ubuntu-desktop

#Install VNC server
sudo apt-get install vnc4server

#Install gnome tools
sudo apt-get install gnome-core gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal

#Fix the vi direction/delete key not working issue
sudo apt-get remove vim-common
sudo apt-get install vim

#Install net tools to test network
sudo apt install net-tools
netstat -tulpn

Launch VNC server and set access password

vncserver :1

#Telnet to test VNC server it's running
telnet localhost 5901

Connecting to VNC From your Desktop

Download and install the RealVNC Viewer on your laptop. Create a connection and specify your ubuntu address with the port 5901 and connect it, remember to input the password you just set.

Connecting to VNC From your Desktop

You may see the blank Gnome desktop after you connect to your VNC server.

Fix the VNC grey screen issue

You should modify the xstartup script to fix this issue.

vi .vnc/xstartup

xstartup content


# Uncomment the following two lines for normal desktop:
#exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic -nowin &
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
x-window-manager &

#These are newly added commands
gnome-panel &
gnmoe-settings-daemon &
metacity &
nautilus &
gnome-terminal &

Restart the VNC server after modification

vncserver -kill :1

Connected to VNC From your Desktop

Now you can connected to your VNC server desktop

Originally published at