In my case I have a fresh installed CentOS6.5 Server on which I will be installing the VNC-server so that I can access the CentOS server with GUI. you can follow the guide for the basic installation of the CentOS server till Chapter 7. please don't install the Development Tools. all of the cases are same as per the guide. my details are as follows:
IP address 192.168.0.100
Gateway 192.168.0.1
DNS 8.8.8.8 8.4.4
Hostname server1.example.com
VNC-server benefits
- Remote GUI administration makes work easy & convenient.
- Clipboard sharing between host CentOS server & VNC-client machine.
- GUI tools can be installed on the host CentOS server to make the administration more powerful
- Host CentOS server can be administered through any OS having the VNC-client installed.
- More reliable over ssh graphics.
- More reliable over RDP connections.
2 Installation
I am logged in my system with root, & now I will be installing the VNC-server.
Yum groupinstall Desktop
Further install
Yum install gnome-core xfce4 firefox
Yum install tigervnc-server
Now make the service on after every reboot
Chkconfig vncserver on
3 Adding VNC user
In my case I am using user = srijan it will differ in your case. You can use any username for the same.
Useradd srijan
Now I will assign the vncpassword for the user with the user I just created before:
Su-srijan
Vncpasswd
[[Email protected] ~] # Su-srijan
[[Email protected] ~] $ Vncpasswd
Password:<-- Yourvncpassword
Verify:<-- Yourvncpassword
[[Email protected] ~] $
Now I will make the configuration file for the vncserver by creating file as follows:
Vi/etc/sysconfig/vncservers
Give the entries like this.
[...] VNCSERVERS = "1: srijan" VNCSERVERARGS [1] = "-geometry 1024x768" |
Here your port comes to be 5901 & 1024x768 resolution for the VNC client, you can choose resolution of your own choice.
Now I will restart the VNC server service as root user:
Service vncserver restart
[[Email protected] ~] # Service vncserver restartShutting down VNC server: [OK] Starting VNC server: 1: srijan xauth: creating new authority file/home/srijan /. xauthorityNew 'server1 .example.com: 1 (srijan) 'desktop is server1.example.com: 1 Creating default startup script/home/srijan /. vnc/xstartupStarting applications specified in/home/srijan /. vnc/xstartupLog file is/home/srijan /. vnc/server1.example.com: 1.log [OK] [[e Mail protected] ~] #
Now to make the changes affective I will kill VNC & do some more configurations as follows:
Pkill vnc
Open the file comment the line # twm & add the line exec gnome-session as follows:
Vi/home/srijan/. vnc/xstartup
#! /Bin/sh [-r/etc/sysconfig/i18n] &. /etc/sysconfig/i18nexport LANGexport SYSFONTvncconfig-iconic & unset SESSION_MANAGERunset DBUS_SESSION_BUS_ADDRESSOS = 'uname-s' if [$ OS = 'Linux ']; then case "$ WINDOWMANAGER" in * gnome *) if [-e/etc/SuSE-release]; then PATH = $ PATH:/opt/gnome/bin export PATH fi ;; esacfiif [-x/etc/X11/xinit/xinitrc]; then exec/etc/X11/xinit/xinitrcfiif [-f/etc/X11/xinit/xinitrc]; then exec sh/etc/X11/xinit/xinitrcfi [-r $ HOME /. xresources] & xrdb $ HOME /. xresourcesxsetroot-solid greyxterm-geometry 80x24 + 10 + 10-ls-title "$ VNCDESKTOP Desktop" & # twm & exec gnome-session & |
& Finally reboot the machine.
Reboot
4 VNC Client
At client end my OS is Ubuntu14.04 with vino installed on my client machine. otherwise you can install any VNC-client of your choice. in case other OS say windows-7 you can install Realvnc-client or any other of your choice.
Again start the vncservice with the user srijan:
Su-srijan
Vncserver
[[Email protected] ~] # Su-srijan
[[Email protected] ~] $ Vncserver
New 'server1 .example.com: 1 (srijan) 'desktop is server1.example.com: 1
Starting applications specified in/home/srijan/. vnc/xstartup
Log file is/home/srijan/. vnc/server1.example.com: 1.log
[[Email protected] ~] $
Now I am going to connect with the VNC server through my VNC-client
It will prompt for the password as follows:
Put yourvncpassword the same which you gave at the time of adding the user srijan.
Now you are connected with the CentOS6.5 Server. in case you want to add more users to access the vnc-console you need to add the user, assign the vncpassword for the new-user as mentioned above & append the entry in the file:
Vi/etc/sysconfig/vncservers
For instance I am using user kishore, entries will be like this
[...]
VNCSERVERS = "2: kishore" VNCSERVERARGS [2] = "-geometry 1024x768" |
This will enable user kishore to get the access to the VNC-server with the port 5902. In the same way you can add the root user also.
Congrats you have configured the VNC-server successfully :)
Copyright © 2014 howtoforge
All Rights Reserved.
VNC Server Installation on CentOS 6.5