If VNCServer is not installed, you can only connect via VNC after logging into the desktop on the machine; otherwise, you will not be able to connect.
Please install the graphical desktop environment first. For details, see: CentOS 6.5 GNOME Graphical Interface Installation Tutorial.
Install:
yum install tigervnc-server
Run and set a password:
vncserver
Set a VNC access password:
vncpasswd
This section configures the password for the root remote user mentioned above, so it's done under the root account. Similarly, to configure passwords for other accounts, you need to set the passwords under those accounts.
Edit the file that launches the VNC graphical interface.
vi /root/.vnc/xstartup
Comment out the last line "twm &", then add a new line.
gnome-session &
Then save and exit.
Edit another VNC configuration file.
vi /etc/sysconfig/vncservers
Modify the last two lines as follows:
VNCSERVERS='1:root 2:root'VNCSERVERARGS[2]='-geometry 800x600 -nolisten tcp -localhost'
Then save and exit.
The format of the VNCSERVERS parameter is:
VNCSERVERS=”X:user01 Y:user02…”
VNCSERVERARGS[X]="-geometry resolution …"
VNCSERVERARGS[Y]="-geometry resolution …"
x, y are numbers
Note that when using VNC for remote access, the default port for the first interface is 5901, the second interface is 5902, and so on. Therefore, be careful when using a VNC client for remote access; otherwise, the connection will fail.
Configure the service to start automatically:
chkconfig vncserver on
This siteOriginal articleAll follow "Attribution-NonCommercial-ShareAlike 4.0 License (CC BY-NC-SA 4.0)Please retain the following annotations when sharing or adapting:
Original author:Jake Tao,source:Installing and configuring VNCServer on CentOS 6.5