Last active
November 13, 2024 19:13
-
-
Save arschles/ca0ae6d6d4d397875397223b83ec21c3 to your computer and use it in GitHub Desktop.
Set up Gnome and VNC server on an Azure Ubuntu Server VM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set pipefail | |
set -eou | |
apt install gnome-core ubuntu-gnome-desktop | |
echo "Now go and click 'reboot' on your VM in the portal" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# inspired by: | |
# https://medium.com/@achekulaev/how-to-set-up-linux-desktop-environment-in-the-cloud-with-digitalocean-droplet-e51ae4e066b | |
set pipefail | |
set -eou | |
# 1. Installing XFCE and VNC server | |
apt update | |
apt install xfce4 xfce4-goodies tightvncserver xfonts-base x11-xserver-utils |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# inspired by: | |
# https://medium.com/@achekulaev/how-to-set-up-linux-desktop-environment-in-the-cloud-with-digitalocean-droplet-e51ae4e066b | |
set pipefail | |
set -eou | |
vncserver | |
# inspired by https://superuser.com/a/392263/140872 | |
DISPLAY=:1 xhost + | |
vncserver -kill :1 | |
mv ~/.vnc/xstartup ~/.vnc/xstartup.bak | |
cat << EOF > ~/.vnc/xstartup | |
#!/bin/bash | |
xrdb $HOME/.Xresources | |
startxfce4 & | |
EOF | |
chmod +x ~/.vnc/xstartup |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# inspired by: | |
# https://medium.com/@achekulaev/how-to-set-up-linux-desktop-environment-in-the-cloud-with-digitalocean-droplet-e51ae4e066b | |
set pipefail | |
set -eou | |
echo "Make sure you have set your USERNAME env var before running this!" | |
mkdir -p /home/$USERNAME/.vnc | |
cp ~/.vnc/xstartup /home/$USERNAME/.vnc/ | |
chown -R $USERNAME:$USERNAME /home/$USERNAME/.vnc/ | |
echo "Need to set up a new password before we can continue:" | |
passwd | |
echo "This might error out, but you can ignore that!" | |
su $USERNAME -c "vncserver -kill :1" || true | |
su $USERNAME -c "vncserver -depth 24 -geometry 1280x800" | |
echo "You can now connect to this server on port 5901. Make sure you set up a port rule to allow that port on your VM!" | |
# This is how to shut down the server | |
# su $USERNAME -c "vncserver -kill :1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment