Home>

Here take centos 6.5 as an example

Install gnome desktop environment

yum groupinstall "x window system" "desktop"

centos install xfce desktop environment,Optional

yum groupinstall xfce

Install tigervnc

yum install tigervnc-server tigervnc

Set up remote login to gnome desktop configuration,Add the following two lines to the end:

vim/etc/sysconfig/vncservers

vncservers="1:root"
vncserverargs [1]="-geometry 1024x768 -alwaysshared -depth 24"

Modify the remote desktop display configuration file:modify to the following and save

vim /root/.vnc/xstartup

#!/bin/sh
#uncomment the following two lines for normal desktop:
unset session_manager
exec/etc/x11/xinit/xinitrc
[-x/etc/vnc/xstartup]&&exec/etc/vnc/xstartup
[-r $home/.xresources]&&xrdb $home/.xresources
xsetroot -solid grey
vncconfig -iconic&
xterm -geometry 80x24 + 10 + 10 -ls -title "$vncdesktop desktop" &
gnome-session&#set starting gnome desktop
#startkde & #kde desktop
#twm & #text interface
#/usr/bin/startxfce4
#exec/usr/bin/fluxbox

New service,Perform multiple services to build multiple services,The order is:1:2:3, and each time you start, you will be prompted to set a password.

vncserver

Close specific vncserver commands

vncserver -kill:1
vncserver -kill:2

boot

chkconfig vncserver on

Firewall settings

After you start the vnc service, you can use the netstat -tunlp command to view the ports used by the vnc service.It can be found that there are 5801, 5901, 6001 and so on. Use the following command to open these ports:

Restart the firewall:

#netstat --tunlp
proto recv-q send-q local address foreign address state pid/program name
tcp 0 0 0.0.0.0:5901 0.0.0.0:* listen 2092/xvnc
tcp 0 0 0.0.0.0:111 0.0.0.0:* listen 1459/rpcbind
tcp 0 0 0.0.0.0:6001 0.0.0.0:* listen 2092/xvnc
tcp 0 0 0.0.0.0:22 0.0.0.0:* listen 1711/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* listen 1557/cupsd
#vim/etc/sysconfig/iptables
-a rh-firewall-l-input -p tcp -m tcp --dport 5801 -j accept
-a rh-firewall-l-input -p tcp -m tcp --dport 5901 -j accept
-a rh-firewall-l-input -p tcp -m tcp --dport 6001 -j accept
#/etc/init.d/iptables restart

Install the windows client:

Launch trigervnc viewer

Enter the server ip:01, for example:192.168.1.10:1

After connecting, enter the password set every time you start vncserver to connect to the centos desktop.

  • Previous Detailed usage of Yii's Srbac plugin
  • Next Build ASPNET Core environment under cloud server