Tuesday, May 5, 2020

How to install VNC on Ubuntu

Access your server using a free simple SSH client program called Putty located at:
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

Follow these commands:

$ sudo apt update
$ sudo apt install xfce4 xfce4-goodies
$ sudo apt install tightvncserver
$ vncserver
$ vncserver -kill :1
$ mv ~/.vnc/xstartup ~/.vnc/xstartup.bak
$ nano ~/.vnc/xstartup
(paste the following in the xstartup file and write out)

#!/bin/bash
xrdb $HOME/.Xresources
startxfce4 &
(Ctrl+O+Enter button to save)
(Ctrl+X button to Exit)

$ sudo chmod +x ~/.vnc/xstartup
$ vncserver
$ sudo nano /etc/systemd/system/vncserver@.service
(paste the following in the window and write out)

[Unit]
Description=Start TightVNC server at startup
After=syslog.target network.target

[Service]
Type=forking
User=yourname
Group=yourname
WorkingDirectory=/home/yourname

PIDFile=/home/yourname/.vnc/%H:%i.pid
ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 :%i
ExecStop=/usr/bin/vncserver -kill :%i

[Install]
WantedBy=multi-user.target

(Ctrl+O+Enter button to save)
(Ctrl+X button to Exit)

$ sudo systemctl daemon-reload
$ sudo systemctl enable vncserver@1.service
$ vncserver -kill :1
$ sudo systemctl start vncserver@1
$ sudo systemctl status vncserver@1

No comments:

Post a Comment

Joyful June Offer

Because time is the new currency and peace of mind is precious.