Friday, April 18, 2014

Setting up the pi - Part II

Now that you've logged in to the shell, where do we go?
So, here's a few more setup-related things we should get out of the way now.

  1. Install the wifi dongle
    At the shell, type -  sudo nano /etc/network/interfaces
    Once in nano, add your network SSID and password, save the file, exit, and shutdown your pi. Plug in the dongle, restart, and verify connectivity using ping (Simply ping google.com)

    Now, at this point, if you've been reading everything I'm saying, you'll be wondering - shutdown from terminal... How do I do that? Well, here it is - sudo shutdown now VOILA!
  2. Now, lets get git on the pi. GIT? Are you crazy man? If thats what just went through your head, its okay.. I'm only making you install git so you can checkout my repo and automate a lot of the installation steps. Now note, most OSs already come with git. Just type in "git" to check.
    Once you have git, just clone my repo from:
    https://github.com/aabhassharma/raspPi
  3. Now, you wouldn't want to plug in the hulking USB cable everytime right? So, lets get ready for some ssh magic. First, run ifconfig on your pi to get the ip address. Then, try pinging that IP address from your laptop (on the same network). Now that you're getting responses from the pi, you're ready to rock! Lets set up some x11 apps so that we can actually see the magic happen. If you look inside setup_scripts on my github repository, the x11.sh file does just that! Change permissions for this script (chmod +x x11.sh) and then just execute using sudo (sudo ./x11.sh). Easy right? :D
  4. Next step - sudo raspi-config - This step is essential! Set up your raspberry pi correctly! Part 1 - Choose option 1 and expand the file system so that all of the memory card is used. Part 2 - Choose option 2 and change the rpi password! Later, we'll come back here and configure the camera :) For now - hit finish and choose yes to reboot.
  5. Install X11 on your mac - http://xquartz.macosforge.org/landing/
  6. SSH in to your rasp pi (sudo ifconfig on the pi to get the ip address, then ssh -X pi@<IP ADDRESS> from your Mac to ssh in to the pi).
  7. Bonus - So you've made it till here. Good job! Now what if you want to see what your desktop looks like? Lets install vncserver on the pi and then use screen sharing to see the pi desktop on the mac! First, on the pi - sudo apt-get install tightvncserver
    Then, on the pi type - tightvncserver
    Then, reboot the pi, and start your vncserver by typing - vncserver :0 -geometry 1024x768 -depth 24
    And finally, in terminal on the mac, type - open "/System/Library/CoreServices/Screen Sharing.app" - Under hostname, type your pi's IP address, and you're ready to go!
    Pretty cool, hunh? 
  8. Set up a static IP! So basically, this is a great analogy - The postman has to deliver you some mail. If you have a new address everytime, he's gonna hate his life! Instead, set up a static IP for your pi (static address). Follow this - http://www.raspberrypi.org/forums/viewtopic.php?f=26&t=22660

And that ends our raspberry pi headless setup! Stay tuned for more!

No comments:

Post a Comment