On this tutorial we are going to install VNC server on a Centos 5.6 Linux VPS. The objective is to install minimum packages to save disk space and keep the package installation minimum.
To install VNC server and Gnome desktop, run this command:
yum install vnc-server gnome-desktop xorg-x11-xinit xterm gnome-applets gnome-session gnome-themes gnome-panel gdm firefox dbus-x11
Then create a normal user to run the VNC service and create password to login to VNC remote session:
adduser johndoe
passwd johndoe
su - johndoe
vncpasswd
ls .vnc/
You’ll see: passwd this file is storing the password for login to VNC session
exit
Next is editing VNC server configuration /etc/sysconfig/vncservers and add the new user to list of VNC server:
nano /etc/sysconfig/vncservers
Add the user to list of VNC server:
VNCSERVERS="1:johndoe"
Now let’s start the vncserver service to generate xstartup script where we’ll configure it to start Gnome desktop environment.
service vncserver start
service vncserver stop
su - johndoe
ls .vnc/
You’ll see: <hostname>:1.log passwd xstartup
We need to modify the xstartup script so Gnome session is called when we start the VNC server
nano .vnc/xstartup
modify:
#!/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" &
twm &
to:
#!/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 1024x768 -ls -title "$VNCDESKTOP Desktop" &
gnome-session &
Save the modification, go back as root and let’s start the VNC server
exit
service vncserver start
Download Tight VNC client here: http://www.tightvnc.com/download.html
After you installed the Tight VNC client, run it and you’ll see this form:
On the VNC Server field, insert your VPS IP address followed with ‘:1’ and then click on Connect. You’ll be asked for a password, this is the password you created when you run vncpasswd command.
If you need VPS hosting with VNC remote desktop installed, please contact HalfDedi at www.halfdedi.com or email info@halfdedi.com, they have a great VPS service
sorry i cant……….
when i write vncpasswd =====> -bash: vncpasswd: command not found
and when i write ls .vnc/ ======> ls: .vnc/: No such file or directory
can you help me
that means you haven’t install vnc server, please run the yum command on the very first step above.
Nope.
That means he uses centos 6.
So, the server is: tigervnc-server not: vnc-server
I installed everything, and when i connect to server i can see the black screen, and nothing else
what virtualization do you use? and how much ram do you have on your vps?
I have the same problem. When connecting to the VNC server it just shows a blank grey screen.
My VPS’s virtualization is OpenVZ with 512MB RAM(1GB Burst).
any help would be much appreciated.
Thanks.
Hi there!!
This tutorial works for me!!
My info:
VPS Server
OS:centos-5-x86
Thx.
+10 Like!
Hello, i tried to install it, but when i’m tried this comand
ls .vnc/
show :
[root@149 ~]# su – johndoe
[johndoe@149 ~]$ ls .vnc/
ls: .vnc/: No such file or directory
how can i resolve it ? thank’s
su – johndoe
vncpasswd
ls .vnc/
When i’lm runing service vncserver start i get :
root@149 ~]# service vncserver start
Starting VNC server: no displays configured [ OK ]
that means you didn’t follow the steps carefully:
nano /etc/sysconfig/vncservers
add:
VNCSERVERS=”1:johndoe”
I successfully completed all steps,but still “failed to connect to server 192.168.100.100:1”,m running centOS 6 as VNCSERVER and windows 7 as a client viewer.Help will be appreciatedd…
I have this set up, but do not have the nano editor, so I cannot edit files. I do not have vi either. How do I get an editor?
Thanks
run this command to install nano:
yum install nano
i installed succesfuly , but when connect i don’t see destkop , i have only console -.- like ssh :/
-bash-3.2# service vncserver stop
Shutting down VNC server: 1:johndoe [FAILED]
-bash-3.2# service vncserver start
Starting VNC server: 1:johndoe A VNC server is already running as :1
[FAILED]
Why? 🙁
run this command to see if vnc server already running: ps aux | grep ‘vnc’
make sure you execute the commands as root