# Step 1: Update system and install Xfce desktop environment
sudo apt update
sudo apt install -y xfce4 xfce4-goodies
# Step 2: Install and configure VNC server
sudo apt install -y tigervnc-standalone-server
# Step 3: Set up a VNC password
vncpasswd # Follow prompts to set a secure password
# Step 4: Start the VNC server to create initial configuration files
vncserver :1
# Stop the VNC server to edit configuration
vncserver -kill :1
# Step 5: Configure VNC to use the Xfce desktop environment
cat > ~/.vnc/xstartup <<EOF
#!/bin/bash
xrdb $HOME/.Xresources
startxfce4 &
EOF
chmod +x ~/.vnc/xstartup
# Step 6: Restart the VNC server
vncserver :1
# Step 7: (Optional) Ensure port 5901 (VNC) is open in the firewall
sudo ufw allow 5901
# Step 8: Find the public IP address of the server
curl ifconfig.me
# Note: Take note of the IP address printed by the above command
# Step 9: (Optional for security) Set up SSH tunneling
# On your Mac, run:
# ssh -L 5901:localhost:5901 user@your-server-ip
How to Connect From macOS
Open macOS's Built-In Screen Sharing App:
Press Cmd + Space, type Screen Sharing, and press Enter.
Connect to Your Server:
In the address field, enter: vnc:
Click Connect.
Enter Your VNC Password:
Use the password you set during the vncpasswd step.
Access the Desktop:
You should now see the Xfce desktop environment on your server.