Skip to content

Instantly share code, notes, and snippets.

@acosonic
Forked from abdennour/ubuntu-vnc-desktop.sh
Last active December 5, 2022 08:31
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 acosonic/bece0d2ad40858375b7aae872986c49b to your computer and use it in GitHub Desktop.
Save acosonic/bece0d2ad40858375b7aae872986c49b to your computer and use it in GitHub Desktop.
Install Ubuntu Desktop with VNC (REQUIRES MINT UBUNTU 20.04)
#!/bin/bash
sudo apt-get update -y
sudo apt-get install ubuntu-desktop -y
sudo apt-get install tightvncserver -y
sudo apt-get install gnome-panel gnome-settings-daemon -y
sudo apt-get install metacity nautilus gnome-terminal gnome-shell -y
sudo apt-get install ubuntu-gnome-desktop -y
mkdir ~/.vnc
cat > ~/.vnc/xstartup <<EOF
#!/bin/sh
export XKL_XMODMAP_DISABLE=1
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &
gnome-terminal &
EOF
chmod u+x ~/.vnc/xstartup
echo "[Unit]
Description=Tight VNC Remote desktop service
After=syslog.target network.target
[Service]
Type=forking
User=ubuntu
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill :1 > /dev/null 2>&1 || :'
ExecStart=/usr/bin/vncserver :1
ExecStop=/usr/bin/vncserver -kill :1
[Install]
WantedBy=multi-user.target" | sudo tee /etc/systemd/system/vnc.service
sudo systemctl daemon-reload
sudo systemctl start vnc
sudo systemctl enable vnc
# https://stackoverflow.com/a/50578686/747579
cd /usr/lib/x86_64-linux-gnu/
sudo cp libxcb.so.1 libxcb.so.1.bak
sudo sed -i 's/BIG-REQUESTS/_IG-REQUESTS/' libxcb.so.1
vncpasswd
sudo systemctl restart vnc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment