LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Linux Answers > Networking
User Name
Password

Notices

By doublejoon at 2004-09-02 10:37
VNC Server Quickstart Instructions
I performed this on Red Hat Advanced Server 2.1 and Fedora Core 1 and 2. It should work on Red Hat 7.3, 8,9 and Enterprise 3.

Note: I would only recommend using VNC between hosts behind a firewalled environment. Passwords are transmitted in clear text.
If you simply must use VNC to use a GUI remotely outside of a firewall I would recommend connecting via SSHv2 to the VNC Server, then initiating VNC inside the SSH Tunnel.

On VNC Server machine with vnc-server installed
1)Type vncserver -geometry 800x600 (or whatever resolution you prefer)
2) There will be a session number displayed .This will create a .vnc directory in your home directory. (/home/yourself/.vnc)
3) Type cd /home/yourself/.vnc
4)Type ls -alc
-You should see a script called xstartup
5)Type vi xstartup or use whatever text editor you prefer
-This is where we will setup your vnc session to use your window manager of choice
-Find the section where it says twm & and replace it with your choice. I know there are more, but these seem to be the most popular ones. Don't include what I have in the parenthesis
-startkde & (used for the KDE window manager)
-exec gnome-session & (used for the Gnome window manager)
-startxfce4 & (used for the XFCE4 window manager, my favorite choice)

6)Now type vncserver -kill:1 (1 is our session number)
-This stops the VNC Server so that the xstartup script we just edited can be re-read when we restart the server
7)Type vncserver (to start the session back up)
8)Type ps ax | grep vnc (check if your session is up and running)

Let's connect to the VNC Server!

From a Linux Box with the vncviewer package installed
1)Type vncviewer hostname or IP address:1 (1 meaning whatever session number you chose)
2)Enter your Linux local account password assigned on VNC Server machine

From a Windows Box with TightVnc or RealVnc client installed
1)Start your VNC client and type the VNC Server hostname or IP address:1 (1 meaning whatever session number you chose)
or
From a Java Enabled Browser on any platform (not the best but it works)
1)Type http://IP address of VNC Server:580x (x will indicate session number)
ex..http://192.168.1.6:5801 ( for session 1)
ex..http://192.168.1.6:5802 ( for session 2)
Note:
1)I keep getting new session numbers every time I type vncserver. I just want session 1 running
-By default each session is still active even after disconnecting from remote vnc session. -You only type vncserver if you want to use multiple sessions
-You can kill the extra sessions by typing vncserver -kill:session number or ps ax | grep vnc to see which sessions are running, then type kill -9 ID number of the session you don't want
-If it all gets messed up you can start over with the sessions by typing rm -rf .vnc in your home directory on the VNC Server machine. Then go into your /tmp/.X11-unix directory and remove X1,X2...etc for each session number (Don't try and remove the X0 file!)
repeat steps 1-8 on the VNC server machine setup

I'm still a N00b on this Linux stuff (just 2yrs). I found this procedure fairly easy for successful VNC Server deployment. Have at it!!!

by fhiggins on Sat, 2005-05-21 16:57
Hello,

When I use the web based applet all I get is a grey screen with an command prompt winddow with and & prompt. Am I doing something wrong?
Frank Higgins

by Buckyjunior on Wed, 2005-06-15 02:42
Apparently the default vnc window is a simple terminal. To get a graphic window, you need to edit the xstartup file in the .vnc directory. To view that file :
cat ~/.vnc/xstartup

Note the period before vnc. That makes it hidden for most purposes.

The file will suggest that you uncomment (remove the starting #) on two lines for a "normal" (graphic) login. As stated in the tutorial, you may want to change the last line in the xstartup file from twm & to something else.
Bucky

by raptor95368 on Wed, 2005-11-16 13:10
A very good and concise how-to...fixed my problem with VNC in less than 5 minutes...BRAVO!!!


  



All times are GMT -5. The time now is 11:28 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration