Difference between revisions of "VNC"

From Amahi Wiki
Jump to: navigation, search
 
(31 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
{{MessageBox|backgroundcolor = #FBB|
 +
image =Warning.png|
 +
heading =WARNING|
 +
message = '''NOTE:'''  This is for Fedora-based systems ONLY.<br />Guidance may not work for Amahi 7 or greater.  Sorry, but if you break your HDA we cannot provide support}}{{NeedsUpdate}}
 +
 +
 +
----
 +
 +
 
<div style="border: 1px solid #A3B1BF; padding: .8em 1em; background-color: #E6F2FF; margin: 0px 1em;">
 
<div style="border: 1px solid #A3B1BF; padding: .8em 1em; background-color: #E6F2FF; margin: 0px 1em;">
'''NOTE: there is now a one-click [http://www.amahi.org/apps/vnc VNC App]'''
+
'''NOTE:''' The one-click [https://www.amahi.org/apps/vnc VNC App] has been discontinued for Amahi 7 or greater. The reason is that it pulls a lot of packages, including desktop and that breaks DNS in Fedora.</div>
</div>
+
<br />
  
= Using VNC to use a remote desktop in the HDA =
+
:'''NOTE:'''  See [[TigerVNC]] for Amahi 8/9 (Fedora 21/23) guidance.
 +
__TOC__
 +
 
 +
= VNC remote =
  
 
Using [http://realvnc.com/ VNC] is useful if:
 
Using [http://realvnc.com/ VNC] is useful if:
Line 28: Line 40:
  
 
There are various ways to get the server going in your HDA. All of them require the server software.
 
There are various ways to get the server going in your HDA. All of them require the server software.
# [http://www.amahi.org/apps/VNC VNC]:  one-click install
+
# Amahi [http://www.amahi.org/apps/VNC VNC] application.
# Manually as described below (notes may require some revision)
+
# Manually as described below (notes may require some revision).
  
 
=== Manual Install ===
 
=== Manual Install ===
 +
* Complete the steps in [[GUI_Install_for_Express_Disc|Express Disc Desktop]] guidance (Amahi 7 ONLY).
 +
 
* As root, install the server:
 
* As root, install the server:
  
Line 38: Line 52:
 
== Method 1 ==
 
== Method 1 ==
 
* Open a terminal, become root and install the VNC server (tigervnc-server) as stated in the Manual Install section.
 
* Open a terminal, become root and install the VNC server (tigervnc-server) as stated in the Manual Install section.
     When the install has completed, press ctrl-D to end the root session. Leave the terminal open, or open one now.
+
     When the install has completed, press ctrl-D to end the root session.  
 +
    Leave the terminal open, or open one now.
  
 
*The following commands are entered as '''User'''.
 
*The following commands are entered as '''User'''.
Line 52: Line 67:
 
       Starting applications specified in /home/user/.xauthority
 
       Starting applications specified in /home/user/.xauthority
 
       Log file is /home/user/.vnc/host.localdomain:1.log
 
       Log file is /home/user/.vnc/host.localdomain:1.log
 
  
 
* You can edit the configuration files using your choice of editor. Nano is used below.
 
* You can edit the configuration files using your choice of editor. Nano is used below.
Line 66: Line 80:
 
     Press the Y key. The prompt will change, showing you the file name.
 
     Press the Y key. The prompt will change, showing you the file name.
 
     Press the enter key, this will store your change and exit Nano.
 
     Press the enter key, this will store your change and exit Nano.
 
  
 
*The following commands are entered as '''Root'''.
 
*The following commands are entered as '''Root'''.
Line 149: Line 162:
 
* It does involve the dreaded CLI.
 
* It does involve the dreaded CLI.
 
* Since my HDA does not get rebooted often, this is not a huge problem
 
* Since my HDA does not get rebooted often, this is not a huge problem
 
== Ubuntu Alternate Method==
 
A [[Install_VNC_server_on_Ubuntu_Server_12.04|VNC tutorial]] is linked from the main wiki page.  It is one method for setting up VNC on your HDA.  Below is another way dodumented by a user.
 
 
This is just what I found on how to install a VNC for Ubuntu 12.04LTC after figuring out that TigerVNC (the above methods) do not work for Ubuntu. The method is copied from [http://coddswallop.wordpress.com/2012/05/09/ubuntu-12-04-precise-pangolin-complete-vnc-server-setup/ here]. This will result in the gnome GUI, not Unity.
 
 
* First we need to update our repositories and install gnome.
 
 
      sudo apt-get update
 
      sudo apt-get install gnome-core gnome-session-fallback
 
 
* Next we install VNC4Server. Follow the instructions.
 
 
      sudo apt-get install vnc4server
 
 
* We need to test the VNC, and then close the session. In the process we are prompted for a password to use everytime we try to connect using our VNC client.
 
 
      vncserver
 
      vncserver -kill :1
 
 
* We open the startup file that we need to edit to make gnome show up in the VNC, and not just a terminal:
 
 
      cp .vnc/xstartup .vnc/xstartup.bak
 
      nano .vnc/xstartup
 
 
* We edit the file to uncomment the second line, and add "gnome-session -session=gnome-classic &". So it will look like this:
 
 
{{Code|Code=
 
#!/bin/sh
 
 
# Uncomment the following two lines for normal desktop:
 
unset SESSION_MANAGER
 
#exec /etc/X11/xinit/xinitrc
 
gnome-session –session=gnome-classic &
 
 
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
 
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
 
xsetroot -solid grey
 
vncconfig -iconic &
 
#x-terminal-emulator -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
 
#x-window-manager &
 
}}
 
* And finally we quit nano and save the file.
 
      ctrl + x
 
      y (for confirmation that yes, we do want the file to be overwritten with the new information)}}
 
* To start the VNC just type the following into a terminal (using something like [[Key-based SSH Logins With Putty|Putty]]. This will start a new VNC session.
 
      vncserver
 
  
 
= General Instructions =
 
= General Instructions =
Line 203: Line 169:
  
 
This helpful page has helped with [http://www.windowsreference.com/internet-explorer/windows-has-blocked-this-software-because-it-cant-verify-the-publisher/ blocking VNC]
 
This helpful page has helped with [http://www.windowsreference.com/internet-explorer/windows-has-blocked-this-software-because-it-cant-verify-the-publisher/ blocking VNC]
 
= Images for the App =
 
[[Image:VNC-logo.png]]
 
[[Image:VNC-sshot.png]]
 

Latest revision as of 01:11, 8 May 2016

Warning.png WARNING
NOTE: This is for Fedora-based systems ONLY.
Guidance may not work for Amahi 7 or greater. Sorry, but if you break your HDA we cannot provide support


Msgbox.update.png Update Needed
The contents of this page have become outdated or irrelevant. Please consider updating it.




NOTE: The one-click VNC App has been discontinued for Amahi 7 or greater. The reason is that it pulls a lot of packages, including desktop and that breaks DNS in Fedora.


NOTE: See TigerVNC for Amahi 8/9 (Fedora 21/23) guidance.

VNC remote

Using VNC is useful if:

  • You would like a Linux desktop to the HDA remotely
  • You run your HDA headless (no monitor) and like to still use a desktop in it
  • You would like to use a GUI to configure printer(s) or have a scanner or other device that requires a desktop program to configure and the machine is headless

What you need

  • A server
  • A client

Client: Installation

Download the client software and install:

       yum -y install tigervnc

Server Installation

There are various ways to get the server going in your HDA. All of them require the server software.

  1. Amahi VNC application.
  2. Manually as described below (notes may require some revision).

Manual Install

  • As root, install the server:
       yum -y install tigervnc-server

Method 1

  • Open a terminal, become root and install the VNC server (tigervnc-server) as stated in the Manual Install section.
   When the install has completed, press ctrl-D to end the root session. 
   Leave the terminal open, or open one now.
  • The following commands are entered as User.
  • Type vncpasswd and press enter.
   The system will prompt you for a password. Type a password and press the enter key.
   The system will prompt you to verify the password. Type the password a second time and press the enter key.
  • Type vncserver and press the enter key. The system will create the configuration files. You should see output similar to this:
     xauth: creating new authority file /home/user/.xauthority
     New 'host.localdomain:1 (user)' desktop is host.localdomain:1
     Creating default startup script /home/user/.vnc/xstartup
     Starting applications specified in /home/user/.xauthority
     Log file is /home/user/.vnc/host.localdomain:1.log
  • You can edit the configuration files using your choice of editor. Nano is used below.
   Note that when "user" is shown, you need to enter your user name.
  
  • Type nano /home/user/.vnc/xstartup and press the enter key. Nano will open the file.
   Find the following line:
     twm &
   Change that line to read:
     exec gnome-session &
 This change will open the VNC display with a Gnome desktop, even if the server is starting in Init 3 by default. 
   Press ctrl-X to exit Nano. You will see the prompt at the bottom "Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ?
   Press the Y key. The prompt will change, showing you the file name.
   Press the enter key, this will store your change and exit Nano.
  • The following commands are entered as Root.
  • Type su and press the enter key followed by the root password

You can edit the configuration files using your choice of editor. Nano is used below. Note that when "username" is shown, you need to enter your user name.

  • Type nano /etc/sysconfig/vncservers and press the enter key. Nano will open the file.
   Find the following lines:
     '#' VNCSERVERS="1:username"
     '#' VNCSERVERARGS[1]="-geometry 800x600 -nolisten tcp -localhost"
  • Uncomment both lines by removing the # at the beginning of the lines.
   Edit the lines so they appear as follows:
     VNCSERVERS="1:username"
     VNCSERVERARGS[1]="-geometry 1024x768 -nolisten tcp"
 Enter your username in place of "username". After "geometry", you can enter any resolution you desire. You can come back and change this if necessary.
   Press ctrl-X to exit Nano. You will see the prompt at the bottom "Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ?
   Press the Y key. The prompt will change, showing you the file name.
   Press the enter key, this will store your change and exit Nano.
  • Finally, type chkconfig vncserver on and press the enter key. This will make the VNC server start when the computer starts.
  • Press ctrl-D to end the root session, and then press ctrl-D again to close the terminal.
  • That's it - Run your VNC Client and enter hda:1 as the host/IP address. You should now see your HDA Desktop screen.
  • If you are interested in more security for your VNC connection, check the link listed below under "General Instructions"
  • Repeat the configuration for each user you wish to be able to connect via VNC.
  • Note you can have displays for users 1-9 and each will connect to their VNC session at port 590n (some VNC clients 'know' the 590 part and only have you enter n). Make certain that you have forwarded the correct port(s), or the range 5901 through 5909.
  • Add -localhost to options if you are connecting through a ssh tunnel or only locally. This adds some security.

Method 2

  • To start the server in your HDA, you need install tigervnc-server rpm package:
  • From the root user:
       yum -y install xinetd
       chkconfig vncserver off
       service vncserver stop
  • Create /etc/gdm/custom.conf file and add the following:
       #GDM configuration storage
       [xdmcp]
       Enable=true
       [chooser]
       [security]
       DisallowTCP=false
       [debug]
  • Create /etc/xinetd.d/vnc1024 file and add the following (you can change the screen resolution by changing the geometry setting):
       service vnc1024
       {
       disable = no
       socket_type = stream
       protocol = tcp
       group = tty
       wait = no
       user = nobody
       server = /usr/bin/Xvnc
       server_args = -inetd -query localhost -geometry 1024×768 -depth 16 -once -fp /usr/share/X11/fonts/misc -securitytypes=none
       }
  • Edit /etc/services and comment out the two lines as listed below:
       #vnc-server      5900/tcp                # VNC Server
       #vnc-server      5900/udp                # VNC Server
  • Add this line below the two lines you commented out and save the changes:
       vnc1024         5900/tcp                # VNC and GDM
  • Now restart the xinetd service
       service xinetd restart
  • Run your VNC Client and enter your HDA IP address for host/IP address. You should now see your HDA Desktop login screen. If you don't see the login screen, a reboot of the HDA may be required. This can be done via the dashboard or by executing the following as root user:
       reboot now

Method 3 (the cpg method)

  • Every time the HDA is rebooted, when VNC is needed, ssh to the HDA
  • The first time without do:
     vncserver -geometry 1550x1100
  • After the first time, I type vncs. I have an alias in ~/.bashrc:
     alias vncs='vncserver -geometry 1550x1100 &> /dev/null &';

Notes:

  • Why that resolution? That fits my monitors with the VNC window and frame enough to not display scrollbars and move around nicely. Change at will!
  • It does involve the dreaded CLI.
  • Since my HDA does not get rebooted often, this is not a huge problem

General Instructions

More detailed instructions are available here.

Troubleshooting for Vista

This helpful page has helped with blocking VNC