Install vnc server on CentOS 5
NOTE: CentOS 5 reached its End of Life on March 31, 2017. For installing VNC desktop on CentOS 7, see Install Xfce VNC remote desktop on CentOS 7
Install GUI on Sever
To find available desktop environments
1 |
yum grouplist |
To install gnome
1 |
yum groupinstall "GNOME Desktop Environment" |
For KDE
1 |
yum groupinstall "KDE (K Desktop Environment)" |
For XFCE, install
1 |
yum groupinstall "XFCE" |
XFCE file size in fedora 12 Total download size: 105 M, Installed size: 363 M
Install VNC Server
1 |
yum install vnc vnc-server |
Start VNC Server
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
[root@pc7 ~]# vncserver You will require a password to access your desktops. Password: Verify: xauth: creating new authority file /root/.Xauthority New 'pc7.localdomain:1 (root)' desktop is pc7.localdomain:1 Creating default startup script /root/.vnc/xstartup Starting applications specified in /root/.vnc/xstartup Log file is /root/.vnc/pc7.localdomain:1.log [root@pc7 ~]# |
Now stop vnc server with
1 2 |
pkill -9 vnc rm -rf /tmp/.X* |
Set Password for VNC Server
1 |
vncpasswd /root/.vnc/passwd |
1 2 3 4 |
[root@pc7 ~]# vncpasswd /root/.vnc/passwd Password: Verify: [root@pc7 ~]# |
Edit xstartup
1 |
vi /root/.vnc/xstartup |
Find
1 |
twm & |
Replace it with
For Gnome
1 |
gnome-session & |
For XFCE
1 |
startxfce4 & |
For KDE
1 |
startkde & |
For FVWM2
1 |
fvwm2 & |
After change, it will look like
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
[root@pc7 ~]# cat /root/.vnc/xstartup #!/bin/sh vncconfig -iconic & # 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 xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & gnome-session & [root@pc7 ~]# |
Create VNC Users
1 |
vi /etc/sysconfig/vncservers |
Add
1 |
VNCSERVERS="1:flashwebhost" |
Start VNC Server
1 2 3 4 5 6 7 8 |
[root@pc7 ~]# vncserver New 'pc7.localdomain:1 (root)' desktop is pc7.localdomain:1 Starting applications specified in /root/.vnc/xstartup Log file is /root/.vnc/pc7.localdomain:1.log [root@pc7 ~]# |
Connecting
Start tightVNC Viewer, connect to IP-ADDR:1 to connect as user root.
See VNC server