2

I'm trying to run a GUI for my CentOS 6 server. I've installed VNC, and I have followed this guide through to the end - http://wiki.centos.org/HowTos/VNC-Server

Once the VNC server is started, I try to access it through the command:

vncviewer -via username@xxx.xxx.xxx.xx localhost:1

... just like the guide said. Once this runs, it asks for my password for the account, and then displays this error:

vncviewer: unable to open display ""

I've installed GNOME display as stated in the guide, by using the command:

yum groupinstall Desktop

Any ideas?

Edit: I'm on the CentOS server in question, which looks like terminal at the moment.

I'm trying to get a GUI display running on it, I've entered the command after starting the server vncviewer -via user@ip localhost:1 but it resulted with the same error:

vncviewer: unable to open display ""

In my /etc/sysconfig/vncservers file, I have:

VNCSERVERS="1:user" 
VNCSERVERARGS[1]="-geometry 800x600 -localhost"

Output of netstat -plunt | grep 5901 :

tcp        0      0 127.0.0.1:5901       0.0.0.0:*    LISTEN      29577/Xvnc

Edit #2: After installing the new packages and running 'startx', it ran for a while. I then recieved a few errors:

Fatal server error:
(EE) no screens found(EE)
Server terminated with error (1). Closing log file.

It looks like it created a log file of the error. Forgot to mention: After this process errored, Putty encountered a fatal error, causing a connection abort.

Edit #3: Running the command 'init 5' seems to break my server. Had a 'connection error' after running it. Cannot connect back, going to have to get the admins to restart it from their side.

George Foster
  • 21
  • 1
  • 1
  • 3

2 Answers2

1

This is the correct way to install vnc server:

Install the following packages:

yum install pixman pixman-devel libXfont tigervnc-server.x86_64 -y

Edit the file /etc/sysconfig/vncservers and add the following lines:

VNCSERVERS="6:<LOGIN_NAME>"
VNCSERVERARGS[6]="-geometry 1152x864"

In the first line, "6:" means that the vnc server daemon will listen on port 590[6] and will log into the specified user's desktop.

Example:

Having "5:itai" there will make the server listen on port 590[5] and connect to itai's desktop.

Then run in order to make sure vncserver starts with boot:

chkconfig vncserver on

Then, set a password for that user, run it from the user's shell (the user you specified in /etc/sysconfig/vncservers):

/usr/bin/vncpasswd

And restart the daemon:

/etc/init.d/vncserver start

Edit #1:

It seems like you installed only the Desktop packages, as far as I know you will need these as well:

yum -y groupinstall "Desktop" "Desktop Platform" "X Window System" "Fonts"

Then run:

init 5
startx
Itai Ganot
  • 10,644
  • 29
  • 93
  • 146
  • Hi, thanks for the response. I've just installed the pixman server, however my old /etc/sysconfig/vncserver is still there. Is there a way to uninstall the old version of the vncserver, or should I continue using this one? Thanks, George – George Foster Jul 16 '15 at 14:50
  • You're welcome. pixman is not a server, it's a package which contains a library that provides low-level pixel manipulation features such as image compositing and trapezoid rasterization. You don't need to uninstall anything. Are you able to connect to the vnc server now? – Itai Ganot Jul 16 '15 at 15:43
  • Hi, sorry for getting back to you so late. I'm on the Cent0s server, which is just a cmd at the moment. I'm trying to get a GUI display running for it. I've entered the command after starting the server 'vncviewer -via user@ip localhost:1'. This still resulted in 'vncviewer: unable to open display ""' – George Foster Jul 17 '15 at 14:17
  • In my /etc/sysconfig/vncservers file, I have: VNCSERVERS="1:user" VNCSERVERARGS[1]="-geometry 800x600 -localhost" – George Foster Jul 17 '15 at 14:18
  • Please add your last reply to your question and remove it from the comments and please add any other information by editing the question itself in order to avoid flooding the comments section. Thanks. – Itai Ganot Jul 17 '15 at 14:21
  • Sorry, changes have been made. – George Foster Jul 17 '15 at 14:29
  • More changes made. – George Foster Jul 17 '15 at 14:50
0

try to add -listen tcp in VNCSERVERARGS:

VNCSERVERARGS[2]="-geometry 800x600 -listen tcp"
kenlukas
  • 3,101
  • 2
  • 16
  • 26