LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-10-2008, 08:10 AM   #1
JasonC10203
Member
 
Registered: Sep 2007
Distribution: GRML 1.1
Posts: 59

Rep: Reputation: 15
Linux version of VNC Server and Viewer -- How to start it so I can use it?


I just installed VNC on my Linux OS this morning and tried to do it in 5 minutes. lol So I may have done it wrong.

Anyway, I downloaded the source files from www.realvnc.com. I used tar -zxf to extract. I ran:
Code:
#./configure
#make
And then I typed:
Code:
#./vncserver
I checked my running services and it said that vncserver was running. But when I tried to VNC in from a different machine outside my home network, it wasn't able to connect.

Is there something I forgot to do? Did I start it right? Also, how do I configure the server? (e.g. In Windows, you just double click the VNC icon and you can change vncserver settings)

Thanks,


Jason
 
Old 07-10-2008, 08:37 AM   #2
jamesapnic
Member
 
Registered: Jul 2008
Posts: 40

Rep: Reputation: 15
Depending on your distro you may need to allow it through the firewall.

Quote:
iptables -I INPUT -j ACCEPT -p tcp --dport 5900
 
Old 07-10-2008, 11:39 AM   #3
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
If you tell us what your distro is called, other than "my linux OS", you'll get better answers to your questions.
Most distros already come with vnc pre-packaged, and often "tweaked" for that distro. You should not need to compile it from source, just install it with your package-manager.
Quote:
it wasn't able to connect.
Can you connect from another machine on your LAN? If so, it is probably the firewall in your router that is blocking the connection.
Quote:
how do I configure the server?
man vncserver will tell you the options available.
 
Old 07-10-2008, 12:33 PM   #4
JasonC10203
Member
 
Registered: Sep 2007
Distribution: GRML 1.1
Posts: 59

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by tredegar View Post
If you tell us what your distro is called, other than "my linux OS", you'll get better answers to your questions.
Most distros already come with vnc pre-packaged, and often "tweaked" for that distro. You should not need to compile it from source, just install it with your package-manager.

Can you connect from another machine on your LAN? If so, it is probably the firewall in your router that is blocking the connection.

man vncserver will tell you the options available.
I'm running Fedora 8.

I don't know if I can connect from another machine on my LAN cause I only have one. I tried connecting from my computer at work to test it.

Code:
[Jason@localhost ~]$ vncserver

New 'localhost.localdomain:1 (Jason)' desktop is localhost.localdomain:1

Starting applications specified in /home/Jason/.vnc/xstartup
Log file is /home/Jason/.vnc/localhost.localdomain:1.log

[Jason@localhost ~]$
That's what happens when I try to start the server. I guess I just need to know how to connect to it.

Also, I ran yum install vnc and this is what happened.
Code:
Package vnc - 4.1.2-24.fc8.i386 is already installed.
Nothing to do
I noticed that the VNC viewer came pre-installed on my distro, but I was hoping to get the server so I could vnc into it. I already use VNC a lot on my WindowsXP OS and I like it.

Last edited by JasonC10203; 07-10-2008 at 12:46 PM.
 
Old 07-10-2008, 01:53 PM   #5
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
OK, I just tried this on my laptop (cannot be bothered to fire up the rest of the network):
Code:
tred@vaio:~$ vncserver

New 'vaio:1 (tred)' desktop is vaio:1

Starting applications specified in /home/tred/.vnc/xstartup
Log file is /home/tred/.vnc/vaio:1.log
Looks like it is running. So I try connecting (again, from my same laptop)
Code:
tred@vaio:~$ vncviewer vaio:1
VNC Viewer Free Edition 4.1.1 for X - built Apr 16 2008 13:02:40
Copyright (C) 2002-2005 RealVNC Ltd.
See http://www.realvnc.com for information on VNC.

Thu Jul 10 19:44:23 2008
 CConn:       connected to host vaio port 5901
 CConnection: Server supports RFB protocol version 3.8
 CConnection: Using RFB protocol version 3.8

Thu Jul 10 19:44:29 2008
 TXImage:     Using default colormap and visual, TrueColor, depth 24.
 CConn:       Using pixel format depth 6 (8bpp) rgb222
 CConn:       Using ZRLE encoding
 CConn:       Throughput 3111 kbit/s - changing to hextile encoding
 CConn:       Throughput 3111 kbit/s - changing to full colour
 CConn:       Using pixel format depth 24 (32bpp) little-endian rgb888
 CConn:       Using hextile encoding
A new window opens with a new desktop on display :1
So, it's working.

[Edit]If you cannot connect locally with
Code:
vncviewer hostname:displaynumber
then try vncviewer localhost:1 in a terminal after you have started the vncserver program

I suspect you firewall is blocking access, but let's just test it locally first.
[/Edit]

Last edited by tredegar; 07-10-2008 at 02:43 PM.
 
Old 07-10-2008, 02:21 PM   #6
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,363

Rep: Reputation: 172Reputation: 172
You could have installed it by yum install vncserver.
 
Old 07-10-2008, 02:42 PM   #7
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Quote:
You could have installed it by yum install vncserver.
Thanks, but it is already installed. Probably twice by now. His problem is that he doesn't know how to get it to work.
 
Old 07-10-2008, 04:42 PM   #8
JasonC10203
Member
 
Registered: Sep 2007
Distribution: GRML 1.1
Posts: 59

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by tredegar View Post

[Edit]If you cannot connect locally with
Code:
vncviewer hostname:displaynumber
then try vncviewer localhost:1 in a terminal after you have started the vncserver program

I suspect you firewall is blocking access, but let's just test it locally first.
[/Edit]
I am able to connect locally with
Code:
vncviewer hostname:displaynumber
so I am guessing you are right about it being a firewall issue. How do I allow access through my firewall?
 
Old 07-10-2008, 05:26 PM   #9
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Good information.
vncserver is working locally, we just need to find out why you cannot access it from elsewhere.
Where is your firewall?
If you have no idea -it's probably in your modem / router: read the manual.

You can check if your PC has a firewall like this (in a terminal, as root)
Code:
root@vaio:~# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
root@vaio:~#
If your output looks like the above, you PC isn't runing one -it's in your modem /router
 
Old 07-10-2008, 07:59 PM   #10
JasonC10203
Member
 
Registered: Sep 2007
Distribution: GRML 1.1
Posts: 59

Original Poster
Rep: Reputation: 15
This is what happened when I tried to run the command you suggested.

Code:
[root@localhost Jason]# iptables -L
bash: iptables: command not found
As far as the router, I've already edited the settings in that. I am forwarding the port ranges to my internal IP address which is set statically on my WindowsXP OS.

My internal IP address is probably different in the Linux OS, isn't it? While we are working this out, I might as well as how to view my IP information via a terminal in Linux. I know that in Windows I can just go to the command prompt and type ipconfig, but I don't know the equivalent of that in Linux.

Last edited by JasonC10203; 07-10-2008 at 08:19 PM. Reason: Realized I had another (related) question.
 
Old 07-11-2008, 03:46 AM   #11
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
You do not appear to have a firewall running on your PC. So I expect there's one in your router.

ifconfig will give you details of your IP address and interfaces (I think you could have found this out for yourself).

Depending on how the dhcp server in your router is set up, your PC may or may not be allocated the same address between boots. For this reason many people prefer to set up static addressing on their LAN - it makes port-forwarding simpler.
 
Old 07-11-2008, 01:30 PM   #12
JasonC10203
Member
 
Registered: Sep 2007
Distribution: GRML 1.1
Posts: 59

Original Poster
Rep: Reputation: 15
I got the ifconfig figured out. I set it up to have a static IP address and all that and restarted my vncserver. After lunch I came back to work and tried to connect and this is the error I got.

Code:
unable to connect to host: connection timed out(10060)
So, at least I think I'm moving forward cause it isn't simply timing out now. But I'm not completely sure where to go from here. When I type vncserver in the terminal and hit enter, it starts up with the following line as output:

New 'vaio:1 (tred)' desktop is vaio:1

Except in my case, "vaio" is replaced by "localhost.localdomain". I haven't tried to find where my firewall is yet cause the first time I tried the command "iptables -L" nothing happened since my path wasn't set right. I now know I need to type "/sbin/iptables -L", so I will give that a try after work and post my results.

Thanks so much for your help so far. I really appreciate it.

Jason
 
Old 07-12-2008, 12:56 PM   #13
JasonC10203
Member
 
Registered: Sep 2007
Distribution: GRML 1.1
Posts: 59

Original Poster
Rep: Reputation: 15
Here is the output I got after running the command iptables -L

Code:
[root@localhost Jason]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     udp  --  anywhere             anywhere            udp dpt:domain 
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:domain 
ACCEPT     udp  --  anywhere             anywhere            udp dpt:bootps 
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:bootps 
RH-Firewall-1-INPUT  all  --  anywhere             anywhere            

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             192.168.122.0/24    state RELATED,ESTABLISHED 
ACCEPT     all  --  192.168.122.0/24     anywhere            
ACCEPT     all  --  anywhere             anywhere            
REJECT     all  --  anywhere             anywhere            reject-with icmp-port-unreachable 
REJECT     all  --  anywhere             anywhere            reject-with icmp-port-unreachable 
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited 

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Chain RH-Firewall-1-INPUT (1 references)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     icmp --  anywhere             anywhere            icmp any 
ACCEPT     esp  --  anywhere             anywhere            
ACCEPT     ah   --  anywhere             anywhere            
ACCEPT     udp  --  anywhere             224.0.0.251         udp dpt:mdns 
ACCEPT     udp  --  anywhere             anywhere            udp dpt:ipp 
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ipp 
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED 
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ftp 
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:smtp 
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:https 
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh 
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:http 
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:telnet 
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:5800 
ACCEPT     udp  --  anywhere             anywhere            state NEW udp dpt:5800 
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:5900 
ACCEPT     udp  --  anywhere             anywhere            state NEW udp dpt:5900 
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited
 
Old 07-16-2008, 08:21 AM   #14
JasonC10203
Member
 
Registered: Sep 2007
Distribution: GRML 1.1
Posts: 59

Original Poster
Rep: Reputation: 15
I got it working. I figured I would include a final post stating how I got it to work just in case someone else who is having the same problem stumbles onto this thread.

There are two ways to install vncserver (for Fedora):
1.) yum install vnc-server
2.) Download the source files and compile them yourself

I personally used option number 2 because I didn't think of option number 1 until after I had already finished option number 2.

After it is installed, I changed into the following directory:
/etc/sysconfig
and edited the file vncservers. This must be done as root, and I recommend logging in to your normal account and using su.

In this file, add the following lines:
Code:
VNCSERVERS="3:leopard"
VNCSERVERARGS[3]="-geometry 1024×768 -depth 16"
You can replace the 3 in VNCSERVERS="3:leapord" with any number other than 0. Whatever you use, you must use the same number in "VNCSERVERARGS[3]" as well. The geometry can also be what you want. It just specifies the screen size.

--Note--
Whatever number you use, it will be appended to the end of the port number required to connect. So if you use 3, the ports will be 5803, and 5903. If you use 1, the ports will be 5801, and 5901.
--------

Once you have done this, simply execute the following command:
service vncserver restart

If it was never started, it will say that it failed to stop the service (this is just because there was nothing to stop). In either case, after stopping the service (or trying to stop it and failing) it will start it and tell you where the log file is located.

Next you have to edit your firewall and make sure the correct ports are open. Also, make sure your router (if you have one) is configured to forward these ports to your machine.

After all this, to connect simply use the following (assuming you used 3 in the config file):
192.168.1.23:5803:3

Where the IP address is your machine's outside IP address (which can be found by going to www.whatismyip.com).

--Note--
Once you are connected, you will get a terminal. Never close or log out or anything. When you are done, simply close the VNC window. If you type "exit" in the terminal or any equivalent, you will not be able to connect again until you restart the vncserver.
--------

I hope this helps. If you have any questions you can email me. I have mine configured to not give me a terminal when I connect but start up a gnome-session instead giving me a complete GUI.

If you want to do the same, the following page helped me out a great deal. If, after looking at it you still can't get it to do what you want, go ahead and shoot me that email.
http://www.g-loaded.eu/2005/11/10/co...ver-in-fedora/

Thanks to all those who provided advice and input. Your time was greatly appreciated.

Jason

Last edited by JasonC10203; 07-16-2008 at 08:22 AM. Reason: Providing addition help.
 
Old 07-16-2008, 03:05 PM   #15
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Quote:
I got it working. I figured I would include a final post stating how I got it to work just in case someone else who is having the same problem stumbles onto this thread.
Good idea, thanks.

I cannot comment on your firewall rules, because I rely on the one in my router. It seems to be working just fine, so I do not run iptables on my LAN PC's. That said, from a quick look at your rules, I think your firewall is installed, but not really doing anything useful. You might want to look into this, or at least check if your modem/router is providing a firewall service for you.

I am pleased you managed to get your vncserver sorted out, and thanks for posting the follow-up, but it would be helpful if you posted your distro in your profile (see mine, at the left?), because some of your instructions for what worked for you are distro-specific (I'm guessing Red Hat?).

Until you begin to understand what is going on, linux can be a PITA, and difficult to get working. Once you begin to understand the principles, it starts to fall into place, and if it is not working, you can usually find out just why, and then fix it fairly easily. A far cry from windows: "Just reboot it".

Please look into your firewall(s): A poorly configured firewall is perhaps worse than none at all (because it gives you a false sense of security).
There are many firewall tutorials on the web, and there are GUI clients as well (guarddog, firestarter et al.)

Have fun.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
VNC Server on CentOS - Viewer on XP pdelassus Linux - Software 12 05-28-2011 04:45 AM
VNC connection to SUSE Linux 10 from a Windows XP VNC Viewer determin2excel Linux - Software 13 10-03-2007 09:38 AM
VNC server/viewer riluve Linux - Software 1 03-09-2005 03:31 PM
Newbie help RE VNC viewer/server indespair Linux - Networking 3 08-25-2004 06:27 PM
is there a GUI version of VNC? im using RH8.. the viewer works perfectly.. kublador Linux - Networking 1 04-09-2003 06:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration