Friday, July 31, 2015

Installing Ubuntu on Raspberry Pi 2

During this blog I'll be attempting to explain very basically what is a Raspberry Pi 2 and how to install Ubuntu on the Raspberry Pi (RPI).

What is Raspberry Pi?

The most basic understanding I can give is that a RPI is a small low powered computer that can fit in the palm of our hand. It can do many of the same things a PC or Laptop can do. Just a little slow rate of speed. You'll need to be patient with it.

The purpose of RPI was to encourage and educate people with computer science.

I don't expect for everyone reading this to be a specifications person. Understanding or seeing the specifications of RPI harware, can give you an idea of performance. So here is the break down of specs I can find on the RPI 2.

Broadcom2836 chip is a System on Chip. It mean that it has all necessary electronics on a signal microchip for running a computer. It also has an ARM processor. It is one of a family of CPUs based on the RISC (reduced instruction set computer) architecture developed by Advanced RISC Machines (ARM). Basically a chip that requires less instructions to do similar to same things a regular computer does. putting that knowledge aside how about power and speed?

Power Supply 5V 2.5A

Bare-board draw 330mA <- this is with nothing drawing energy from the RPI board. Things like a video screen connected via the GPIO connectors will use more energy through the RPI.

Max USB Draw 1.2A <- The maximum amount of energy you are allowed to use from the USB ports on the PI. It will very on usage of ports.

The ARM Processor runs at 900MHz and can run as fast as 1 GHz. Just imagine your personal computer running at 1GHz and you will understand this.

its good to know things like this. It might help knowing this information with other projects you might want to use the RPI with.

Now on to putting Ubuntu 14.04 LTS on the Raspberry PI.

RPI come with a SD memory chip. The SD chip has an image of an Operating System call NOOBS. Its made for Noobs who are new to RPI. Put this SD memory chip aside. We're not going to use this one.

I would suggest purchasing another memory SD card. in case of the RPI 2 it would be a Micro SD. Get one that is at least 32GB to give yourself plenty of head room for the Operating System.

With that new Micro SD we're going to place an image of Ubuntu on it.

An  image copy is like a picture, or mirror image. It is an exact bit by bit copy. The result of an image copy is quite different from what you get when you do a file by file data backup or file by file drive copy. Unlike a simple data backup or copy, an image backup also copies any partitions and system information. In essence it is a clone of an original copy.

You can get a copy of the image file here:
https://wiki.ubuntu.com/ARM/RaspberryPi

You are welcome to follow the directions at the website. But for most people, I think you might find it more helpful following this blog.

Uncompress the .zip file and you will find a .bmap and .img file.

I'm going to assume your are running a Windows machine and now that you have downloaded a copy of the Ubuntu Trusty image file. you are still going to need to copy that img file to your Micro SD card.

You can get a helpful and free program here. http://sourceforge.net/projects/win32diskimager/
Install W32 Diskimager and copy the .img file to the Micro SD card.

Yay! you just complete that part that is not usually explained too well. I hoped that it helped. We're only about half done. Now that the image is on the Micro SD card. Plug the Mico SD into the RPI.

After inserting the Micro SD card and booting the RPI. You should see a text prompt asking for a password. The default username and password is ubuntu typed in all lower case.

Now we start building the Ubuntu system on the Micro SD card. You will need to resize the partition on the SD card. you can do so by typing in the following command.

sudo fdisk /dev/mmcblk0

type p to see current partition table.

type d then number 2 to deleted the second partition.

type n for new partition. type p for primary partition. type 2 for partition 2.

hit the enter key to select default for first sector, and enter for default for last sector.

type w to create the partition. type sudo reboot to reboot the RPI.

After reboot and login type sudo resize2fs /dev/mmcblk0p2

type df -h to verify available space on the SD card. Number may not be exact but should be close to 28G available.

Next we need to update the package manager by typing sudo apt-get update

Now we need additional software to setup a swap file. sudo apt-get install dphys-swapfile
 then enter to continue.

restart again sudo reboot

Now we got to install the GUI interface packages
sudo apt-get install xubuntu-desktop openssh-server xserver-xorg-video-fbturbo libraspberrypi-bin libraspberrypi-dev libraspberrypi-bin-nonfree

the above command is on one single command line. it may or may not wrap on your screen.

this will download and install a lot of packages. This took my RPI about an hour to complete. go watch a movie, get yourself something to eat or drink. Be sure to look at the screen once in a while to hit enter key for default response.

That was a long wait.. now type sudo apt-get install mg to install a text editor.

type sudo mg /etc/X11/xorg.conf  <- besure the X in X11 is caps.. :)

this launches a generic text edit screen. there will be a invisible cursor at top.
you will need too add the following text to file. simply start typing.

Section "Device"
 Identifier "Raspberry Pi FBDEV"
 Driver "fbturbo"
 Option "fbdev" "/dev/fb0"
 Option "SwapbuffersWait" "true"
EndSection

hit Control-X on keyboard the s to save the file. C to close the file.

type sudo reboot to reboot machine.

** IMPORTANT** If you do not see yellow screen here. go back and check the file you just edited. sudo mg /etc/X11/xorg.conf

you should see the gui interface and password is still the default password. ( ubuntu )

Congratulations! You have just installed a working copy of Ubuntu 14.04 LTS on a Raspberry PI 2.

Your system may want to complete some more updates. I would say run the system over night. After that you can continue on to other projects you were planning with your Linux Pi machine.

Most of you who visit the blog will know I'm a ham radio operator. I'm using my pi to run a program for Ham Radio contacts.



I'm still working on this project. This Raspberry Pi was a big part of it. It will allow for me to run digital communications, and keep a log, while out in the field. Not only was this a little bit of a challenge for me. It will also be much lighter and more efficient than using a laptop out in the field.

As I reach certain phases in my field project, I'll blog about them at KD6VZQ.com