Make your ubuntu server to GUI Based
sudo apt install xfce4 xfce4-goodies -y
sudo apt install tightvncserver -y
vncserver
vncpasswd
Dapat dilihat pada /root/.vnc/
vncserver -kill :1
mv ~/.vnc/xstartup ~/.vnc/xstartup.bak
nano ~/.vnc/xstartup
#!/bin/bash
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
startxfce4 &
chmod +x ~/.vnc/xstartup
vncserver -localhost
vncserver -rfbport 6901
IP:6901
sudo netstat -tulpn | grep 690
ssh -L 6901:localhost:6901 -C -N -l user 192.168.x.x
Access on localhost:6901
- Root Version
sudo nano /etc/systemd/system/vncserver@.service
[Unit]
Description=Start TightVNC server at startup
After=syslog.target network.target
[Service]
Type=forking
User=root
Group=root
WorkingDirectory=/root/
PIDFile=/root/.vnc/%H:%i.pid
ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -rfbport 6901 -depth 24 -geometry 1280x800 :%i
ExecStop=/usr/bin/vncserver -kill :%i
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable vncserver@1.service
sudo systemctl start vncserver@1
sudo systemctl status vncserver@1
- Another User Version
sudo nano /etc/systemd/system/vncserver@.service
[Unit]
Description=Start TightVNC server at startup
After=syslog.target network.target
[Service]
Type=forking
User=anotheruser
Group=anotheruser
WorkingDirectory=/home/anotheruser/
PIDFile=/home/anotheruser/.vnc/%H:%i.pid
ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -rfbport 6901 -depth 24 -geometry 1280x800 :%i
ExecStop=/usr/bin/vncserver -kill :%i
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable vncserver@1.service
sudo systemctl start vncserver@1
sudo systemctl status vncserver@1
sudo apt update
sudo apt install x11vnc xvfb gnome-shell ubuntu-gnome-desktop autocutsel gnome-core gnome-panel gnome-themes-standard gnome-settings-daemon metacity nautilus gnome-terminal dconf-editor gnome-tweaks yaru-theme-unity yaru-theme-gnome-shell yaru-theme-gtk yaru-theme-icon fonts-ubuntu tmux fonts-emojione
x11vnc -storepasswd
reboot
export DISPLAY=:0
Xvfb $DISPLAY -screen 0 2048x1200x16 &
sudo -u ubuntu gnome-session &
x11vnc -usepw -forever -repeat -shared -display :0
# Option: Endlessly repeat x11vnc invocation in case it fails at some point.
while :; do x11vnc -usepw -forever -repeat -shared -display :0 ; done