Raspberry Pi 2 setup
from micro SD card to JDK installation.
Prepare Micro SD card
This set up was done on Ubuntu 14.04
, should work fine on most Linux systems.
-
Micro SD Card
Insert the Micro SD Card into the computer. Find the micro SD card device name and unmount it.df -h # Output line corresponding to micro SD card shown as below. # /dev/mmcblk0p1 31G 32K 31G 1% /media/sakthipriyan/STRONTIUM umount /dev/mmcblk0p1
-
Raspbian Image
Now download and unpack the Raspbian Lite latest Imagewget https://downloads.raspberrypi.org/raspbian_lite_latest unzip 2015-11-21-raspbian-jessie-lite.zip
-
Lets roll it
Put the Raspbian image on the micro SD card.sudo dd bs=4M if=2015-11-21-raspbian-jessie-lite.img of=/dev/mmcblk0 347+1 records in 347+1 records out 1458569216 bytes (1.5 GB) copied, 200.461 s, 7.3 MB/s
It took me
3m 20s
, please be patient.
Boot up the Raspberry Pi
- Insert the Micro SD card into the Raspberry Pi.
- Connect
- USB Keyboard
- HDMI cable from the Monitor
- LAN cable
- Now connect the power supply via Micro USB cable.
Login, configuration and Java installation.
- Use, username
pi
and passwordraspberry
to login to Raspberry Pi. - Run,
sudo raspi-config
to config the system settings like timezone, disk partitions, etc., -
Update/upgrade the system and install Java 8
sudo apt-get update && sudo apt-get upgrade sudo apt-get install oracle-java8-jdk
-
By default, ssh server is enabled. Find the IP using
ifconfig
and login from any computer into this device usingssh
.
Running Java.
Apparently, Java 1.8.0 is available in Raspbian repository, but not the latest updates.
# Create a Test.java file with content shown in `cat Test.java`.
cat Test.java
public class Test {
public static void main(String[] args){
System.out.println("Hello World from c4rpi");
}
}
# Compile it using Java Compiler (javac)
javac Test.java
# Run the Test class to see the output printed to the screen.
java Test
Hello World from c4rpi
Once the Hello World
program is done, you can go ahead and do some serious stuff.
Permanent set up.
I generally use Raspberry Pi as low cost, low power 24x7 computer running in my house.
Only following two things are connected to Raspberry Pi,
- Power Supply, use quality power adapter with good quality USB cable.
- Network Cable, use quality RJ45 cable to connect it to a router.
Login to Raspberry Pi via ssh from other computer and set up things to run as required.
C4Rpi
C4Rpi
is a simple 4 node Raspberry Pi 2 cluster, based out of this post. Coming soon.