Monday, October 5, 2015

Clean Installation of Raspbian on Raspberry PI 2

Note: this posting outlines the steps to load the Sept 2015 version of Raspbian known as "Jessie". It assumes you are using Windows to create the boot media for the PI.

Download last OS image ZIP file from:
https://www.raspberrypi.org/downloads/raspbian/

Extract the image file from the downloaded ZIP file.
On Windows, I prefer 7-Zip for this step from http://www.7-zip.org/.

Write the image to an SD card as explained on: https://www.raspberrypi.org/documentation/installation/installing-images/windows.md
(Note I do NOT run Win32DiskImager as administrator. Why run things as admin if it does not require it)

Boot the PI

Initial Setup

  • Menu - Preferences - Raspberry Pi Configuration
  • Localisation: set time zone=America, Vancouver, set locale=Country=Canada, set keyboard=United States, English (US)
  • System, Filesystem, Expand Filesystem
  • Boot to CLI
  • Uncheck "Auto Login as user 'pi"', (note: def PW='raspberry', we will change that below)

Update PI software

  • $ sudo apt-get update
  • $ sudo apt-get upgrade



Configure the PI to
  • allow for SSH connection to it can run without a monitor, keyboard, and mouse.
  • have a fixed IP address















Tuesday, September 1, 2015

Raspberry Pi - set static IP address

Set a static IP address on a Raspberry Pi 2 so I can connect to the same address all the time using Putty on Windows.

Editing /etc/network/interfaces seems to no longer work.

One needs to edit /etc/dhcpcd.conf

see:



    Install Pycharm on Ubuntu

    Download gz file from http://www.jetbrains.com/pycharm/download/

    INSTALLATION INSTRUCTIONS
    • Copy the pycharm-*.tar.gz to the desired installation location
      (make sure you have rw permissions for that directory)
    • Unpack the pycharm-*.tar.gz using the following command:
      tar xfz pycharm-*.tar.gz
    • Remove the pycharm-*.tar.gz to save disk space (optional)
    • Run pycharm.sh from the bin subdirectory
    NOTE: PyCharm on Linux doesn't need special installation or running any installation script. It runs out of the pycharm-*.tar.gz

    Thursday, February 13, 2014

    Install MongoDB on Ubuntu

    $ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10

    $ echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
    $ sudo apt-get update

    $ sudo apt-get install mongodb-10gen

    $ mongo --version

    Ubuntu

    Build a Ubuntu System

    Download Ubuntu 13.10 64 bit from:

    Use UNetbootin to create a bootable USB Memory Stick with the ISO image just downloaded.

    Shutdown Laptop, attach eSATA drive that will be used for Ubuntu

    Reboot off the USB Memory stick (F12 at boot to get a hardware boot menu)

    Install Ubuntu



    Steps to Upgrade to Linux Mint 15

    This process assumes you have an existing Linux installation on a disk that has enough free space to create a new partition for version 15. In this way you can boot 15 and copy over items from the other Linux environment.

    1. While running Windows 7, Download the ISO image for Linux Mint 15, 64 bit, Cinnamon from here.
    1. Use UNetbootin to create a bootable USB Memory Stick with the ISO image just downloaded.
    1. Reboot off the USB Memory stick (F12 at boot to get a hardware boot menu)
    1. Run Install Linux Mint
    1. select installation type "Something Else" in order to manage which HD and partition Mint is installed to.
    1. Reboot Mint from Hard disk
    1. Activate recommended NVidia video drivers
    1. Menu -> Preferences-> Driver Manager
    1. Apply any pending updates
    1. $ sudo apt-get update
    1. $ sudo apt-get upgrade 
    1. Using Firefox, Install Google-Chrome
    1. Download and run the 64 bit Ubuntu-Debian DEB file
    1. Note: the Google install updates software sources so later runs of apt-get upgrade will get updated versions of chrome.
    1. Install MongoDB
    1. Instructions here.
    1. Install Pycharm
    1. su
    1. mkdir /opt/pycharm
    1. cd /opt/pycharm
    1. mv /home/gbiglow/Downloads/pycharm-2.7.2.tar.gz .
    1. tar xfz pycharm-*.tar.gz
    1. rm pycharm-2.7.2.tar.gz
    1. Run pycharm.sh from the bin subdirectory
    1. do this in a shell once to see if pycharm complains about the wrong JDK
    1. note: look in following log to see if pycharm is logging any start-up errors
    1. /home/gbiglow/.PyCharm20/system/log/idea.log
    1. 'Install' Oracle JDK (pycharm wants the official Oracle one - too bad)
    1. Background
    1. Some notes on installing Oracle JDK - here.
    1. Some other notes on JDK - here (note remove OpenJDK step!)
    1. I took the KISS approach which requires manual repeats to update Oracle Java but does not screw with the official Linux Mint installed OpenJDK
    1. download jdk-7u21-linux-x64.tar.gz from Oracle
    1. expand it into /opt/java
    1. add following to ~./bashrc
    1. export PATH=/opt/java/jdk1.7.0_21/bin:$PATH
    1. Install tools using $ sudo apt-get install <tool-name>
    1. Development tools:
    1. python-pip
    1. python-virtualenv
    1. git
    1. terminator
    1. meld
    1. ipython
    1. Sys Admin tools:
    1. gparted
    1. htop
    1. hardinfo (shows in start menu as "System Information")
    1. Install Heroku Toolbelt
    1. $ sudo wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh
    1. $ heroku login
    1. Fully Copy home dir from old linux installation...
    1. Fix up GRUB and Windows b


    Still Todo:

    Install Node.js on Ubuntu



    $ sudo apt-get update

    $ sudo apt-get install -y python-software-properties python g++ make

    $ sudo add-apt-repository ppa:chris-lea/node.js

    $ sudo apt-get update

    $ sudo apt-get install nodejs

    $ node -v


    reference:

    https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager

    Tuesday, February 11, 2014

    Delete some default Ubuntu home dir folders

    To permanently delete dirs from ~

    • music
    • pictures
    • videos


    $ cd ~
    $ rmdir Music Videos Pictures


    /etc/xdg/user-dirs.conf (overrided by ~/.config/user-dirs.conf) - Allows you to enable or disable the automatic folder (re-)creation. If you set enabled=False, either globally of for your own user only, special folders will not be re-created at login anymore in case you delete or rename the folders.

    edit /etc/xdg/user-dirs.conf so it reads as followes:

    gcb@T510:/etc/xdg$ cat /etc/xdg/user-dirs.conf

    # This controls the behaviour of xdg-user-dirs-update which is run on user login
    # You can also have per-user config in ~/.config/user-dirs.conf, or specify
    # the XDG_CONFIG_HOME and/or XDG_CONFIG_DIRS to override this
    #

    # 11-Feb-2014 gcb change from default of True to now be false. disable of special dirs in $HOME for all users
    #enabled=True
    enabled=False

    # This sets the filename encoding to use. You can specify an explicit
    # encoding, or "locale" which means the encoding of the users locale
    # will be used
    filename_encoding=UTF-8


    Ubuntu, Remove crap

    $ sudo apt-get purge libreoffice-*
    $ sudo apt-get purge firefox*
    $ sudo apt-get purge thunderbird*






    List all installed packages (pipe to grep to search for a specific pattern):
    $ dpkg --get-selections | grep <pattern>

    remove all libreoffice packages:

    $ sudo apt-get purge libreoffice-*

    remove orphaned packages, i.e. installed packages that used to be installed as an dependency, but aren't any longer. Use this after removing a package which had installed dependencies you're no longer interested in:
    $ sudo apt-get autoremove

    see what packages are available to install matching a  pattern
    $ apt-cache search <pattern>

    To see all the files installed by a package like python-kivy-examples:
    $ dpkg-query -L  <package name>

    Change Ubuntu Devicename (Hostname)

    Change the “device name” in the details window of System settings

    $ sudo sed -i 's/present-host-name/new-host-name/' /etc/hosts
    $ sudo sed -i 's/present-host-name/new-host-name/' /etc/hostname
    $ reboot

    Hmmm. attempt on the 2nd sed command failed and the /etc/hostname file was already correct. Perhaps it was changed automatically in response to the first sed.

    You can check your present-host-name by
    $ cat /etc/hostname
    or
    $ hostname


    Thursday, August 15, 2013

    Linux & Windows partition changes, boot fun

    To remove GRUB from the MBR on primary disk in the laptop that hold Windows 7:

    • boot with recovery DVD
    • get to a command window
    • issue commands to re-write the MBR

    To write GRUB to the external HD containing Linux Mint:
    • Boot Machine off Mint Live DVD (can't use virtual box for this)
    • Launch GPARTED to determine disk and partition holding Mint
    • Open terminal window
    • sudo mount   /dev/sdb1   /mnt
    • sudo grub-install /dev/sdb  --root-directory=/mnt
    grub probe does report some errors but installation of grub works.


    to refresh the grub menu on the external drive (if it needs updating...):
    • sudo update-grub

    to add an entry for linux into the Windows boot menu (otherwise one needs to get the boot list (f12 at startup)):


    Tuesday, August 6, 2013

    Powershell (Windows... ugg)

    Powershell ISE

    Powershell 2.0 was loaded on my Win7 SP1 machine so...

    Windows Management Framework 3.0 (includes PS 3.0)
    http://www.microsoft.com/en-us/download/details.aspx?id=34595



    How to determine what version of PowerShell is installed:
    PS C:\> $psversiontable

    To Update help in PS, start an elevated PS session (not the ISE!) and enter:

    PS> Update-Help






    Thursday, July 4, 2013

    A Basic Node.js site

    A basic Node.js site using:

    • Mongoose - object data modeling (ODM) library to access a mongoDB data store
    • Express web app framework
    • Jade template engine
    • Connect middleware (cookies, favicon, static files, session management, etc) Note: This is installed by NPM as a dependency for Express.
    • twitter bootstrap front end framework
    • tbd - login using Google, Facebook, etc (passport?)
    • best practices for packages.json (support dev & prod, proper dependency version wild-carding etc.)
    Steps:

    $ cd ~/dev          (assumes ~/dev exists)
    $ express appName   (pick any valid app name)
    $ cd appName

    edit package.json to include following dependency line
    "mongoose": "*"

    $ npm install     (install all dependencies)
    $ npm start       (just test the server starts and works the ^c out of it)

    $ mkdir model     (create a dir to hold model related files)
    $ cd model

    edit db.js to contain:


    var mongoose = require( 'mongoose' );
    var todoSchema = new mongoose.Schema({
     item: String,
     complete: Boolean,
     date: { type: Date, default: Date.now }
    });
    mongoose.model( 'Todo', todoSchema );
    mongoose.connect( 'mongodb://localhost/todoDB' );



    add to app.js:
    , db = require('./model/db')


    Tuesday, July 2, 2013

    PyCharm - bought it.



    Yes its great and all the free IDE options were lacking somehow so I bought a license. I like it for python and javascript. Lots of useful add-ins for MongoDB, Jade, etc etc.

    PyCharm !


    Friday, June 28, 2013

    Thursday, June 27, 2013

    node.js supervisor

    Node Supervisor is used to restart programs when they crash.
    It can also be used to restart programs when a *.js file changes.

    Installation:
    $ sudo npm install supervisor -g

    Usage:
    $ supervisor [options] <program>

    jshint

    JSHint

    Installation:
    $ sudo npm install -g jshint

    Why?
    use it for JavaScript and node.js

    (works within pycharm as well)