How to configure VNC server in Rhel/CentOs 7

1) Install Genome desktop if not installed
# yum groupinstall "GNOME Desktop"
2) Install vnc server package
# yum install tigervnc-server
3) copy systemd service file 
# cp /lib/systemd/system/[email protected] /etc/systemd/system/vncserver@:3.service
4) Edit service file to enable a user to use vnc desktop
# vim /etc/systemd/system/vncserver@:3.service
Edit bellow to replace <user> with your user name in my case i am using vijay
[Service]
Type=forking
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/sbin/runuser -l vijay -c "/usr/bin/vncserver %i"
PIDFile=/home/vijay/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'

save and exit
5) Now create a user and provide password
# useradd vijay
# passwd vijay
6) Login with user name and start vncserver
# su - vijay
# vncserver
Provide password when prompt and retype the password

7) Now lets start the vncserver service

#systemctl start vncserver@:3.service
#systemctl enable vncserver@:3.service

Comments

Popular posts from this blog

Running web ssh client on port 443 /80 with nginx as reverse proxy

Running cockpit behind nginx reverse proxy with nginx ssl and cockpit non ssl

Setup VOD streaming server with nginx using RTMP on Ubuntu 18.04