Sunday, February 3, 2019

Install and configure Tiger vnc server in Linux. How to install vnc in linux? How to install yum vnc server in linux? Install vnc server in RHEL 7. Yum install vnc server.





In this post we will install Tiger VNC server in linux system. I’ll show everything according to my system RHEL 7. 


At first you need yum package “tigervnc-server.x86_64



Now confirm you have root access. Then follow below steps and details.




[root@reyaz appsdba]# yum install tigervnc-server.x86_64


Installing yum package…….

Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
ol7_UEKR5                                                                                         | 1.2 kB  00:00:00    
ol7_addons                                                                                        | 1.2 kB  00:00:00    
ol7_latest                                                                                        | 1.4 kB  00:00:00    
(1/2): ol7_latest/x86_64/updateinfo                                                               | 784 kB  00:00:12    
(2/2): ol7_latest/x86_64/primary                                                                  |  11 MB  00:01:47    
ol7_latest                                                                                                   12163/12163
Resolving Dependencies
--> Running transaction check
---> Package tigervnc-server.x86_64 0:1.8.0-13.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================================================
 Package                         Arch                   Version                         Repository                  Size
=========================================================================================================================
Installing:
 tigervnc-server                 x86_64                 1.8.0-13.el7                    ol7_latest                 214 k

Transaction Summary
=========================================================================================================================
Install  1 Package

Total download size: 214 k
Installed size: 509 k
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7Server/ol7_latest/packages/tigervnc-server-1.8.0-13.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Public key for tigervnc-server-1.8.0-13.el7.x86_64.rpm is not installed
tigervnc-server-1.8.0-13.el7.x86_64.rpm                                                           | 214 kB  00:00:04    
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
Importing GPG key 0xEC551F03:
 Userid     : "Oracle OSS group (Open Source Software group) <build@oss.oracle.com>"
 Fingerprint: 4214 4123 fecf c55b 9086 313d 72f9 7b74 ec55 1f03
 Package    : 7:oraclelinux-release-7.6-1.0.15.el7.x86_64 (@ol7_latest)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : tigervnc-server-1.8.0-13.el7.x86_64                                                                   1/1
  Verifying  : tigervnc-server-1.8.0-13.el7.x86_64                                                                   1/1

Installed:
  tigervnc-server.x86_64 0:1.8.0-13.el7                                                                                  

Complete!
[root@reyaz appsdba]#


Installation of yum package complete.





Setup vnc server configuration file.


Copy vncserver file

[root@reyaz ~]# cp /lib/systemd/system/vncserver@.service  etc/systemd/system/vncserver@:1.service
[root@reyaz ~]#




Now edit the file to change username. Use the username that you have. In this case I have the username “appsdba”. To know how to create user please follow my another blog post here.  




[root@reyaz ~]# vi /etc/systemd/system/vncserver@:1.service


# The vncserver service unit file
#
# Quick HowTo:
# 1. Copy this file to /etc/systemd/system/vncserver@.service
# 2. Replace <USER> with the actual user name and edit vncserver
#    parameters appropriately
#    (ExecStart=/usr/sbin/runuser -l <USER> -c "/usr/bin/vncserver %i"
#     PIDFile=/home/<USER>/.vnc/%H%i.pid)
# 3. Run `systemctl daemon-reload`
# 4. Run `systemctl enable vncserver@:<display>.service`
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted!  For a secure way of using VNC, you should
# limit connections to the local host and then tunnel from
# the machine you want to view VNC on (host A) to the machine
# whose VNC output you want to view (host B)
#
# [user@hostA ~]$ ssh -v -C -L 590N:localhost:590M hostB
# this will open a connection on port 590N of your hostA to hostB's port 590M
# (in fact, it ssh-connects to hostB and then connects to localhost (on hostB).
# See the ssh man page for details on port forwarding)
#
# You can then point a VNC client on hostA at vncdisplay N of localhost and with
# the help of ssh, you end up seeing what hostB makes available on port 590M
#
# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
#
# Use "-localhost" to prevent remote VNC clients connecting except when
# doing so through a secure tunnel.  See the "-via" option in the
# `man vncviewer' manual page.


[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 appsdba -c "/usr/bin/vncserver %i"
PIDFile=/home/appsdba/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'

[Install]
WantedBy=multi-user.target
 

Save and exit. 
in above I have added my username "appsdba"


Now wrok with Firewall 


[root@reyaz ~]# firewall-cmd --permanent --zone=public --add-service vnc-server
success
[root@reyaz ~]#

[root@reyaz ~]# firewall-cmd --reload
success
[root@reyaz ~]#



Change user access to start vncserver


[root@reyaz ~]# su appsdba

[appsdba@reyaz root]$ vncserver


You will require a password to access your desktops.

Password:
Verify:


New 'reyaz.xyz.com:1 (appsdba)' desktop is reyaz.xyz.com:1

Creating default startup script /home/appsdba/.vnc/xstartup
Creating default config /home/appsdba/.vnc/config
Starting applications specified in /home/appsdba/.vnc/xstartup
Log file is /home/appsdba/.vnc/reyaz.xyz.com:1.log

[appsdba@reyaz root]$



If required use this command after restart your system.
[root@reyaz ~]# systemctl start vncserver@:1.service
 


Done.......
 

You can find me on Fiverr & LinkedIn

 

 

No comments:

Post a Comment