Friday 21 November 2014

Eyepiece - Part 4 - Building from a clean install.


This is the approach when using a Windows system - users of Linux and Mac will need to look for their own software.



NOTE:

There is an issue with automatic log-in when running XDM on Raspbian. The workaround is not to start the XDM service until after the system has logged on the primary user.





Preparing your Raspberry Pi.

After downloading the latest build of Raspbian (Debian Linux for Raspberry Pi), you will need to unzip the disk image and install it onto a SD card with a capacity of at least 4 GB. The download is about 1000MB (1GB) in size.



http://www.raspberrypi.org/downloads/
Raspberry Pi Downloads (O.S.Images)
http://www.7-zip.org/
For unzipping, I use 7zip, a free utility. 


http://sourceforge.net/projects/win32diskimager/To transfer the operating system image onto the bootable SD card, you will need Win 32 Disk Imager.

Once your image is transferred, insert the SD card into the socket on your Raspberry Pi and boot it up. You will need a monitor and keyboard attached just this once.

A screen will appear asking you to choose a number of setup options. Make sure that you change the Host Name to something distinctive so that you can find it in the next step.

Complete your set up and reboot you Pi.

http://www.advanced-ip-scanner.com/At this point, you will need to know the network address of your Raspberry Pi. I use a product called Advanced IP Scanner, though you may have another program that you prefer.

Run this program  (or something similar) for your local network, and make a note of the IP address of your Raspberry Pi. You will need this IP address for the next part.


Updating your Pi.

At this point, you will need to run PuTTY, a program that operates as a remote terminal to communicate with a Linux computer. You will also need to have an active Internet connection on your network.

http://www.chiark.greenend.org.uk/~sgtatham/putty/ PuTTY is also free software, and has more uses than just this.
http://www.chiark.greenend.org.uk/~sgtatham/putty/

When PuTTY starts, you will be presented with a window that asks for Host Name or IP Address. Enter the address you were supplied with by Advanced IP Scanner (above). Make sure that the option SSH is selected (just below where you entered the IP Address).

Click OPEN at the bottom of the window. Accept any warnings about identity and security, this is perfectly normal the first time you communicate with a new computer.

A new window will open and, after a few moments you will be invited to


Logon as:█

As this is a brand new install, the user name is Pi. Type this in and press enter.

You will be asked for a password. 

pi@192.168.1.39's password:█

Enter the password, the default being raspberry. Again, press enter.

You will be given a block of text disclaiming any liability for anything at all and you will be presented with a prompt:

pi@(none) ~ $

You are now able to do things with your Raspberry Pi ... things like getting the remote graphical interface working.

 Now, enter

sudo apt-get update

This command will take a couple of minutes to complete while it installs all of the updates to your new machine - some of the programs on the Pi are updated almost weekly.

Next, enter

sudo apt-get upgrade

You might as well go and make a coffee since this typically takes 10 to 15 minutes to complete.

Your operating system is now fully up to date.

enter

sudo shutdown -r now
This will restart the Raspberry pi.


Installing a Desktop Manager

Once your Pi is up and running again, log in using PuTTY and your previous credentials. Once you get to the system prompt, enter

sudo passwd root
You will then need to type in a password for the root user (super user, administrator, head honcho etc.) ...

... twice.

This is not normally recommended, but since we will be accessing the computer remotely, then this is necessary (at least for now).

Now, you need to enter
su -
Which command logs you in as the root user, who is allowed to do anything at all - including deleting the whole operating system. You have been warned.

Enter

apt-get install xdm
This installs the X Desktop Manager, which will give us remote access to the system's graphical interface. It will also run dpkg-reconfigure xdm.

When  asked to choose a default desktop manager, select XDM and then OK.

You now need to change the contents of two files. Be very careful. You may need to read the simple editor tutorial page (coming soon).

Enter

cd /etc/X11/xdm 
ed xdm-config
 this opens the file /etc/X11/xdm/xdm-config in the default editor.

You need to change the line that reads

DisplayManager.requestPort: 0
to read as
! DisplayManager.requestPort: 0
so enter
,p
You should see the entire file being listed on your screen.  The last line should be the relevant line. If so, then you may use the following script:

l
s/Display/!Display/
,p
The line should have been correctly edited. if so, then you may enter
w
q
 which saves the file and quits the editor.

Now enter


ed /etc/X11/xdm/Xaccess


 the line that reads

#*                       #any host can get a login window
needs to be changed to read
*                        #any host can get a login window
entering
,p
will list the file. The line you want is a little under half way down.

Enter

46
This should display the correct line. If not, you can advance lines by entering + or go back by entering - (minus).

once the correct line is reached, enter:


s/#//
w
q
This should have configured the machine to allow remote desktop access. Be warned that this is an insecure method and anyone on your network would be able to intercept your data.

Enter the following three commands to start the X Desktop Manager service, and to install some useful applications.
service xdm start
apt-get install x11-apps
apt-get install x11-xserver-utils
apt-get install xscreensaver
apt-get install midori
apt-get install python-picamera
apt-get install python3-picamera
apt-get install python-picamera-docs


x11-apps and midori (a web browser) will take a few minutes to install. python3-picamera and python3-picamera are most likely to be already installed. 

Now is the time to check that that XDM is running correctly:

netstat -ulnp | grep 177
This should return the following information:

udp        0      0 0.0.0.0:177         0.0.0.0:*                  2864/xdm
if  you see udp, :177 and xdm then everything is running properly.

Enter
service xdm stop
shutdown -r now
and wait for the system to reboot

Next: Accessing your Pi with Xming and configuring your system

No comments:

Post a Comment

Comments and suggestions are warmly welcomed.