CentOS 7.x Setup VNC service

From Notes_Wiki

Home > CentOS > CentOS 7.x > Remote Access > CentOS 7.x tigervnc-server > CentOS 7.x Setup VNC service

To setup tigervnc-server in Linux use following steps:

  1. Disable selinux
  2. Disable firewall
  3. Install tigervnc server
    yum install tigervnc-server
  4. If required, as local OS users
    useradd <useraccount>
    passwd <useraccount>
  5. Create vnc password for user account
    #Login as corresponding user
    su - <useraccount>
    vncpasswd
  6. Create & modify vnc configuration file via root
    1. cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
    2. vim /etc/systemd/system/vncserver@:1.service
      [Unit]
      Description=Remote desktop service (VNC)
      After=syslog.target network.target
      [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=/usr/sbin/runuser -l <useraccount> -c "/usr/bin/vncserver %i"
      PIDFile=/home/<useraccount>/.vnc/%H%i.pid
      ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
      [Install]
      WantedBy=multi-user.target
      Replace <useraccount> with username
  7. Start vnc server
    systemctl daemon-reload
    systemctl start vncserver@:1.service
  8. If you want vnc server for that user enable at boot time
    systemctl enable vncserver@:1.service
  9. In CentOS7, VNC server access required for multiple users, each user should have separate configuration file and separate system service should run. If you want to create vnc access for multiple users, follow above steps from 4 to 7.
  10. VNC server can access from windows machines using realvnc viewer.
    Download link for realvnc viewer https://www.realvnc.com/en/connect/download/viewer/windows/


Refer:


Home > CentOS > CentOS 7.x > Remote Access > CentOS 7.x tigervnc-server > CentOS 7.x Setup VNC service