Changes

From Amahi Wiki
Jump to: navigation, search
no edit summary
<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]'''</div>
<br />
{{MessageBox|
heading =WARNING|
message = This is recommended only for advanced users, proceed with caution.}}
__TOC__
=Method 1=
Reboot
{{Code|Code = sudo reboot now -h}}
From here on I used vim but you can use any editor you are comfortable with just replace vim with your choice.
Copy and paste
{{Code|Code = sudo apt-get update}}
when complete
{{Code|Code = sudo aptitude safe-upgrade}}
reboot server type
{{Code|Code = sudo reboot now -h}}
A: Install Gnome basic desktop.
First off we need to install the Gnome components for our virtual desktop. Type or copy and paste:
{{Code|Code = sudo apt-get install gnome-core}}
when prompted type Y and then press Enter. This will install the gnome desktop components.
Reboot
{{Code|Code = sudo reboot now -h}}
To keep the desktop and login window from opening in Ubuntu everytime it starts we want to mask out the few lines which start the service.
{{Code|Code = sudo vim /etc/init/gdm.conf}}
The first few lines of the script should look like this once you've edited it:
{{Code|Code = <pre>
# gdm - GNOME Display Manager
#
emits login-session-start
 }}</pre>
esc :wq to save the changes or :q! to start over. Now the desktop and login won't start in Ubuntu.
Reboot
{{Code|Code = sudo reboot now -h}}
B: We need to install VNC server to be able to interact with the gnome components for the desktop.
{{Code|Code = sudo apt-get install vnc4server}}
When prompted type Y and press Enter. This will install VNC Server which is required for running a virtual desktop on another machine.
Next type:
{{Code|Code = vncserver}}
You'll then be prompted to create and verify a new password.
So, type the following command to kill the session:
{{Code|Code = vncserver -kill :1}}
Now type the following command to open up the file we need to edit:
{{Code|Code = sudo vim .vnc/xstartup}}
Change it to look like this:
{{Code|Code = <pre>
#!/bin/sh
#x-terminal-emulator -geometry 1280x1024+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
}}</pre>
When you're done editing the file press the Esc key once and type :wq
Next type the following command to create the VNC Session once more:
{{Code|Code = vncserver -geometry 1680x1050}}
where 1280x1024 is the resolution of your DESKTOP COMPUTER.
So, from a Putty session:
{{Code|Code = cd /home/xxxx}}
where xxxx is your Ubuntu username. This command switches us into that directory.
Next we'll create a folder called MyScripts below your home folder. So type:
{{Code|Code = mkdir scripts}}
Switch into the folder we've just created type:
{{Code|Code = cd scripts}}
Next type:
{{Code|Code = vim StartVNC.sh}}
This will create a new file called StartVNC.sh and open it for editing.
Press the i key once and copy and paste the following contents:
{{Code|Code = <pre>
#!/bin/sh
echo "JOB RUN AT $(date)"
echo ""
/usr/bin/vncserver -geometry 1680x1050
</pre>
}}
NOTE: change the 1680x1050 to match the screen resolution of your Desktop computer
Next we need to make the file executable so, assuming you called your script StartVNC.sh then you'd type:
{{Code|Code = chmod a+x StartVNC.sh}}
Test the script by typing the following:
{{Code|Code = vncserver -kill :1}}
To make sure vncserver isn't running, then:
{{Code|Code = ./StartVNC.sh}}
A new vnc session should start.
Stop vncserver
{{Code|Code = vncserver -kill :1}}
Now open your browser and go to your HDA and click on the webmin app you already installed, click continue to this website at the cert warning.
Type or paste the name of your script including the full path
{{Code|Code = /home/xxxx/scripts/StartVNC.sh >/dev/null}}
into the Command box, replacing xxxx with your own usernam. The ">/dev/null" parameter will discard any output the script may produce.
Now let's check the script works on boot. So from the System -> Bootup and Shutdown menu within Webmin scroll down to the bottom of the screen and click the Reboot System button. Alternatively type
{{Code|Code = sudo reboot now -h}}
in a Putty/Terminal session.
Most of this information was obtained from: www.havetheknowhow.com.
 = Alternate Method2 =
This is just what I found on how to install a VNC for Ubuntu 12.04LTS 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.
{{Code| sudo apt-get update sudo apt-get install gnome-core gnome-session-fallback}}
* Next we install VNC4Server. Follow the instructions.
{{Code| 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.
{{Code| 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:
{{Code| 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:
{{Text|Text=<nowikipre>#</nowiki>!/bin/sh
<nowiki>#</nowiki> Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
<nowiki>#</nowiki>exec /etc/X11/xinit/xinitrc
gnome-session –session=gnome-classic &
xsetroot -solid grey
vncconfig -iconic &
<nowiki>#</nowiki>x-terminal-emulator -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &<nowiki>#</nowiki>x-window-manager &}}</pre>
* 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.
{{Code| vncserver}} However, if you have installed the desktop version you can also follow the above method except the edit in the xstartup file will look like the following: <pre>#!/bin/sh # Uncomment the following two lines for normal desktop:unset SESSION_MANAGER#exec /etc/X11/xinit/xinitrcgnome-session –session=ubuntu-2d & [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresourcesxsetroot -solid greyvncconfig -iconic &#x-terminal-emulator -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &#x-window-manager &</pre> This will now give you a connection with the Unity desktop being displayed =Tips and Tricks = VNC does not respect the normal rules of elevating the current user through the use of entering the admin password. The only way to run many graphical programs that require the super user is to open a command line terminal within the VNC session and start the program with the "sudo" command. Two programs that may come in handy that work in this fashion are gparted and Synaptic Package Manager. To start gparted: In a VNC terminal window type:  sudo gparted  To start Synaptic Package Manager: In a VNC terminal window type: sudo synaptic
12,424

edits