Skip to content

Instantly share code, notes, and snippets.

@mokshchadha
Last active September 13, 2024 03:15
Show Gist options
  • Save mokshchadha/d442e36899914529ec26a45271f64f72 to your computer and use it in GitHub Desktop.
Save mokshchadha/d442e36899914529ec26a45271f64f72 to your computer and use it in GitHub Desktop.
Installing KDE plasma on freebsd and connecting via VNC server
# Update package repository
pkg update
# Install X.Org
pkg install -y xorg
# Install KDE Plasma
pkg install -y kde5
# Install SDDM (display manager)
pkg install -y sddm
# Enable SDDM in rc.conf
sysrc sddm_enable="YES"
# Enable dbus (required for KDE)
sysrc dbus_enable="YES"
# Set default window manager to Plasma
echo "exec ck-launch-session startplasma-x11" > ~/.xinitrc
## == VNC setup == ##
# Install TigerVNC server
pkg install -y tigervnc-server
# Create a VNC password
vncpasswd
# Create a VNC startup script
cat << EOF > ~/.vnc/xstartup
#!/bin/sh
exec ck-launch-session startplasma-x11
EOF
# Make the startup script executable
chmod +x ~/.vnc/xstartup
# Start VNC server
vncserver :1

Steps to connect

Step 1:- make sure Tiger VNC is running on your remote machine

a. check wheather any pre-existing vnc server running or not

ps aux | grep Xvnc

b. Kill and restart server

vncserver -kill :1 vncserver :1 -geometry 1920x1080 -depth 24

Step 2 :- in your local terminal type this

ssh -L 5901:localhost:5901 -i your-key.pem ec2-user@your-ec2-instance-ip

Step 3 :- On your local machine, use a VNC client (like tiger VNC Viewer) to connect to localhost:5901.

vncviewer -PreferredEncoding="hextile,h264"

Step 4:- Enter the VNC password you set earlier.

You should then see something like this

https://i.ibb.co/wM2vtn2/Screenshot-2024-09-06-at-10-07-40-PM.png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment