Development Enviroment.

All of my ducks were lined up, I had a game plan.  Now, I simply needed to build out the 3 machines from scratch and set them up for development.

I decided to redo all the machines from scratch, the idea was to get a properly configured device, then back it up so that I could lay that image onto any new machines.  Doing this would save me hours of time setting up new Pi's.

Here is the steps I took.

OS Install
  • Install NOOBS onto a 32 Gig Card to use as the base install on one of the Pi's.
  • Used the NOOBS micro SD to install Linux.

Updating A very good bit of documentation on updating the Pi can be found here. https://www.raspberrypi.org/documentation/raspbian/updating.md

  • sudo apt-get update Used to update the Distribution lists.
  • sudo apt-get dist-upgrade Used to upgrade the distribution.
  • sudo rpiupdate Used to upgrade the Firmware.
Next was creating the users and groups I would need.  I don't like using the default user Pi, and I don't like the fact that everyone knows that password for the Pi.
  • sudo passwd Pi, this will allow you to give the Pi user a new password.
  • sudo adduser <username>  Creates a new user.
  • This next step is important, we will be creating a group, this group will be used between machines for samba shares and this is the glue that allows it to work correctly.
  • sudo groupadd -g 2016 pi-share, this will create a new group called pi-share, this group will have an group id of 2016.  You will see why this is important later.
  • Next Add Pi to the new group sudo usermod -a -G pi-share Pi
  • Next add all the groups to the newly created user.  I base all my new users on the Pi user id.
  • usermod -a -G pi,adm,dialout,cdrom,sudo,audio,video,plugdev,games,users,input,netdev,spi,i2c,gpio,pi-share <username>
The Pi by default will boot to a GUI, it will automatically log you in as Pi.  This behavior is not what I want and as such I turn this feature off.
  • sudo nano /etc/lightdm/lightdm.conf
  • Find the line autologin-user=pi, comment that line out by placing a # at the beginning of the line.
Once you reboot, you will be presented with a logon screen.

Next, the time zone setting should be adjusted. 
  • sudo dpkg-reconfigure tzdata
  • Simply select the values that are for your time zone and save the settings.
The Machine name is defaulted and should be changed,  this is especially true if you have multiple Pi's running around.  There are several ways to do this, I used this.
  • sudo raspi-config
  • Select Advanced Options.
  • Select Host Name.
  • Put a name you can remember and don't forget to add .local to the end of it.

If you remember, I created a special group and assigned it an ID.  I will now explain why and what this was for.

I will have many Pi's around, I suspect I will have at least 20 in my house alone.  I need a way to share code and files.  True, I can use my source code repository, however with that many devices it would be a pain to constantly need to update the code.  I also was concerned with the Pi's loosing power and trashing the SD card.  I needed a better way.

I utilize several Linux boxes at my home, one is specifically for data storage, the machine has mirrored drives, using software raid.  I use this machine for code, and file sharing.  I use it to store files I don't want to lost in the event of a machine crash.  This machine is also backed up once a week.

I decided to make a share on my file server for the Pi's.  However, with multiple Pi's and possible multiple users it requires you to do some specific things.  So this is what I did on my Linux File Server.

File Server
  • Created a new Group called the pi-share, I assigned it the group ID 2016, the same as the Pi.
  • I then created a folder called Pi-Shares.
  • I set the owner to root.
  • I set the group to pi-share and tell it groups can create and access files and folders.
  • sudo chmod 750 to for the Directory Pi-Share, this tells the folder to maintain the group permissions on all files and folders created.
  • Set this new directory up in Samba so that it is part of the samba sharing.

With the server configuration complete, I now had to do the same thing but a bit different on the Pi.
  • Created a directory in /mnt I called it Pi-Share
  • Set the group permissions on the Directory so that all members of the group could access this mount point.
  • I wanted this to mount at boot time.  So I added the following line to fstab.
  • //VengNas.local/PiShare  /mnt/Pi-Share cifs username=<username>,password=<password>
  • To test to make sure the mount point is correct you can issue sudo mount -a this will redo all the mounts.
With this done, it was time to setup the development environment.  A good document on QT can be found here. https://www.raspberrypi.org/forums/viewtopic.php?f=31&t=43545

  • sudo apt-get install qt4-dev-tools
  • sudo apt-get install subversion
  • sudo apt-get install qtcreator

With this, I had a basic fresh install that I could now backup and use for future Pi's.  I also had my source code in a secure location that was properly protected from disk failure as well as it being backup up and in my svn source code repository.


The development environment is done, now time for the real work.

Project Start.








No comments:

Post a Comment