- 05-11-2014, 04:08 PM #1
How to set up a Raspberry Pi
If you want to start playing with electronics, or you just want a cheap but capable computer (the Pi makes a great headless server) I think the Raspberry Pi is a great place to start. And to get started, you'll have to get started. That's what we're going to cover here — taking the $35 computer board out of it's box, and transforming it into a full blown Linux workstation.
- A desire to learn and have fun.
- An existing computer, and basic knowledge of how to use it. Windows, OS X or Linux will work fine.
- A 4GB or higher SD card. MicroSD cards are fine, but you'll need a full-size adapter.
- A standard USB keyboard. Wireless models are fine, as long as they use a USB dongle and the basic HID (Human Interface Driver) specs. Most do.
- A monitor or TV. Preferably with an HDMI input, or a way to convert an HDMI output to whatever input your monitor uses. You can also use composite video (the yellow RCA jack on your TV).
- A network connection. The Raspberry Pi has an on-board ethernet jack, or you can buy a USB wireless dongle that's known to work with Raspian OS.
- A case or non-conductive something to sit the Pi on. Any Pi case will work fine. So will a tupperware container with the anti-static bag the Pi came in lining the bottom. Or a scale model of the Millennium Falcon. Just be sure whatever you use is ESD protected.
Got it? Good. Let's go ...
1. Assembling the Pi and its enclosure
The Raspberry Pi itself needs no assembly — it's ready to connect right out of the box. But as mentioned, you need somewhere to put it to keep the delicate electronics from shorting out.
If you bought a case, follow the directions to put it together. If you're looking for a case recommendation, I like these for use on a desktop because they provide a lot of air flow. This is essential if you are going to overclock your Pi, and it keeps dust from building up. If you want to eventually start up some projects and wire things to the Pi, look at one of these Pi dishes from Adafruit.
If you're using a regular container or even just a static-free mat to place the Pi on, just find a steady and clean spot to put it.
Overclocking the CPU on your Pi is offered as a standard setting during the OS setup. If you're going to overclock your Pi, a few tips:
- Make sure the Pi gets plenty of air
- Use a heatsink on the CPU
- Like any other computer, things may go badly and you'll need to buy more Pi
Overclocking is a good way to squeeze just a little more out of your Pi. We'll talk more about it during the OS setup, but if you're going to do it invest in a small heatsink. You'll need to install this before you tighten all the screws and put together any case unless you like taking things apart. For some reason, I've found these copper-clad aluminum heatsinks work better than a pure copper one (according to my temp. gun). But any heatsink that's the right size is better than no heatsink. [/NOTE]
Now that you have everything unboxed and ready to go, let's get some software on that SD card.
Last edited by Jerry Hildenbrand; 05-11-2014 at 05:00 PM.
- 05-11-2014, 04:09 PM #2
2. Installing NOOBS to your SD card
About the SD card
- You need a full-sized SD card to insert into your Pi. You can use a micro, but you'll need a full-sized adapter.
- Use an SD card that's at least 4GB. If you want to use the Pi as a Linux desktop (a fine way to use a Pi, IMO) you can go bigger. I have one that uses a 64GB card that I use as a media server. Be warned that it takes longer to install the OS on a bigger card, because setup expands the partition to use it all.
- Don't stress over the speed of the card. Use what you have, because read/write speeds aren't going to be the bottleneck in this system. A cheap, 4GB class 4 card is fine.
1. Format your card as a single FAT32 partition in your (or a friends) computer.
Refer to the documentation for your operating system for the correct way to do this. It's also best to do a full format versus a quick format.
2. Download the base NOOBS install
NOOBS (New Out Of Box Software) is a setup program that allows you to choose from a variety of operating systems for your Pi. It's not the speediest way to do things, and hardcore Linux types are better just flashing the .img file of the distro they want directly to the SD card. But for our purposes, NOOBS is perfect.
Grab it here directly from the Raspberry Pi foundation. Choose the torrent if you can. It's waaaaayyyyyy faster. Be sure to seed — my ratio is at 40.025 after just a week, so plenty of people want it.
3. Unzip the download and copy the files to the SD card
Unzip the file you downloaded in the step above, and you'll see a single folder. Open that folder in your file explorer application on the computer.
Open a new file explorer window and navigate to the freshly-formatted SD card. There should be nothing there.
Highlight ALL the files from your download, and drag them to the SD card window. This will take a few minutes.
Don't create any folders on the SD card, and be sure to copy the contents of the folder you downloaded and unzipped — not the folder itself.
When things are finished copying, eject the SD card properly from your computer and get ready to hook everything up and boot up some Pi.
Last edited by Jerry Hildenbrand; 05-11-2014 at 05:02 PM.
- 05-11-2014, 04:09 PM #3
3. Connecting everything and turning it on
This is pretty simple. All you really need to do is consider your video display and network options.
The power connection is the last thing you'll connect. There is no On/Off switch on the Pi, and once you connect power things are live.
1. Put the SD card you burned above into the slot on the bottom of the Pi. Note the notch and insert it the right way. Make sure it's in the whole way. Yes, it sticks out a lot. This is normal.
2. Plug your USB keyboard into one of the USB ports. You can use almost any keyboard. I like this one by Logitech, because it's wireless, has a standard trackpad that works out of the box, and it has an on/off switch for the times I'm not using it.
3. If you're going to use the GUI, plug in a USB mouse in the other USB port. Like the keyboard, most will just work — even wireless models. This is why I like the keyboard above. If you have to buy one, get it.
4. The network connection. The easiest way is to use a CAT5 cable and plug the Pi into your router. This will just work every time, but not everyone has a free plug or is close enough to a router to do this. For those folks, you'll need a USB network adapter. Be sure to get one that says it works with Rasparian OS. If you're using a separate keyboard and mouse, you'll need a USB hub now. As usual, powered USB hubs work best (and you can often use the powered USB hub to power the Pi, that the powered USB hub is plugged into. Mind. Blown.) Plug the USB wireless key directly into the Pi. Plug the hub directly into the Pi. Plug the keyboard and/or mouse into the hub.
5. Video connection. You need to see what the Pi is doing, so you'll need to connect to a TV or monitor. Use either the yellow RCA video connector or the HDMI connector on the Pi and connect the appropriate wire to your screen. You can use adapters to convert HDMI to DVI, or even VGA if that's what your monitor or TV needs. Monoprice or Amazon are your friends.
6. Powered speakers or headphones can be plugged into the blue 3.5mm audio jack on the Pi. USB audio cards (that work with Linux) are another option, or a monitor with speakers (using the HDMI connection) works, too. Audio is optional, and we don't need it to build our Pi. But music makes everything better, and there's a fine media player available for your Pi.
7. Power. You can use the same microUSB cable and charger that came with your cell phone if you have one. You'll want to make sure you supply 1.5A to the Pi if you're using a USB network adapter or sound card. 2A is even better. If you need to buy a USB hub, buy one with a single 2A power port and use it to power your Pi, then connect the USB cable, too. THIS IS THE BOMB. Once you have everything else connected, turn your monitor on and plug the Pi in.
If there was no blue smoke, we're ready for the next step.
Last edited by Jerry Hildenbrand; 05-11-2014 at 06:16 PM.
- 05-11-2014, 04:09 PM #4
4. NOOBS, OS installation, and options
If everything above works correctly, you'll see this after your Pi goes through the first boot. This can take a while, so don't freak out if you don't see the menu right away. This is NOOBS.
NOOBS is just a set of scripts to install an operating system on your Pi. First, select your language on the bottom of the screen. You can use a mouse, or the arrow keys on your keyboard if you didn't connect a mouse. Note that there is both a UK English option as well as a US English option. Select the wrong one, and words like colours or colors may not be spelled correctly. A-LOO-MINI-UM.
Look through the choices if you're curious. None of them are bad choices, and you'll find a ton of support for all of them on the Internet. But for our purposes, we're going to stick to Raspbian. You'll see it on the top of the list. Raspbian is Debian Wheezy (7.5) compiled and built for an ARM processor, and configured for the Raspberry Pi. Debian is an excellent choice for a Linux user, and it's known for being rock stable and secure. It's one of the original Linux distros, and uses BSD style inits. If you know what that means, you should have a peek at how init.d folders work (see BSD, Debian or Slackware Linux documentation). If you don't know what that means, don't worry about it. We'll cover what you need to do to initiate software with every tutorial we write. Don't worry, it's easy as Pi.
Once you've chosen your OS, click the install icon above the list or hit i on your keyboard.
This will take a while. It's expanding your partition table to use the whole SD card (ext4, if you're curious) and copying a bunch of files to their correct location. Go grab a cup of coffee, hit your vape, or get a slice of Pie. When it's done, it will tell you to reboot. Choose yes.
[NOTE]This takes about 5 minutes for an 8GB SD card. It takes about 15 minutes for a 32GB Sd card. Don't interrupt it, it will tell you when it's done.[/NOTE]
This is what things will look like when it's rebooting, and at every boot. Don't worry, you don't need to read the text. It's there for debugging, or to see just where the boot sequence failed if it fails after you screw up your kernel. You'll see warnings, freely ignore them. Warnings are usually informative, not an indication of broken things. Welcome to Linux. When it's all done, you'll come to a new menu full of options. These are the important ones, and we'll visit each of them.
These options setup your OS with it's default configuration. It's important that you make the right choices, but you can always get back to this program from your finished installation. Let's go through them.
Use the arrow keys on your keyboard to navigate the raspi-config menus
1. Expand Filesystem
If you used NOOBS, ignore this option because NOOBS already did it. If not, you use this option to make your OS use the whole SD card.
2. Change User Password
The default username is pi. The default password is raspberry. If you ever plan to connect your Pi to the Internet, or have more than one user on your network, select this and change the default password because pi is a member of the wheel group and can sudo at will once logged in. You can create your own user account with any permissions you like, but still change the default. Linux is as safe as you make it. Don't make it unsafe.
3. Enable Boot to Desktop/Scratch Scratch is a programmer primer. It's pretty cool, but there is no reason to boot directly to it unless you're using your Pi for education. The desktop is just what you think it is, and you can choose to boot directly to the GUI with this option. If you choose neither, starting the GUI is easy from the command line. If you're going to run the Pi headless and use VNC or SSH, don't choose either of these — there's no need for extra overhead running on the system if there is no monitor attached to it.
4. Internationalisation Options
This is where you set languages and keyboards up for your region. Have a look, and choose the correct values.
5. Enable Camera
On your Pi, there is a Zif (Zero Insertion Force) socket for a dedicated camera board. If you have one, or plan to buy one, enable this.
6. Add to Rastrack
Rastrack is a dynamic list of Raspberry Pis from around the world. If you want your Pi to be listed (no personal information is given) you can say yes here.
I know some of us are gonna do this. Hell, I do it to the "Medium" preset just to get the bump in RAM speed. If you have your Pi somewhere it can get plenty of air, and have a heat sink installed, you're pretty safe all the way up to Medium. High and Turbo overvolt the CPU, and can cause everything to go tits up. If you're unsure, skip this part. If you're a pro, skip this part and grab the kernel source and have at it. If you enable overclocking and your Pi isn't stable, run raspi-config from a terminal and change things back.
8. Advanced Options
Don't be put off by the word "Advanced." There's nothing magic in here, and a couple are essential. On the other hand, you can skip this section completely and have a full graphical desktop to work on. Let's have a look.
- A1 Overscan — this is used if the boundary of your screen doesn't match the boundary of your monitor. Set it to remove the black bars you might see.
- A2 Hostname — by default your Pi is named raspberrypi on your network. If you want to change this, or have more than one Pi on the network, change it here. I suggest AMAZEBALLS or YEAHBOY
- A3 Memory Split — sets the amount of RAM to dedicate for video. the default is good, more (just a little more) is better if you want to watch 1080p video. Remember, RAM you use for video is RAM taken away from the rest of the system. Don't get silly.
- A4 SSH — this is where you enable the SSH server on your Pi. You can use SSH to connect to the Pi from any other computer on the network. This is handy if you want your Pi to run 24/7 with no keyboard or monitor connected. It's essential if you want to build something that has the Pi enclosed somewhere doing something like running your Christmas lights. I suggest everyone enable this, but only if you changed the default password above. Any server is less secure than no server, even SSH.
- A5 SPI — this loads kernel modules for input/output through things like a PiFace. If you don't know what this is, and don't care, ignore it. If you will be connecting a peripheral that needs the SPI kernel modules, enable them here. You can always go back later and enable them.
- A6 Audio — here is where you can force audio through either the 3.5mm jack or HDMI. Useful if things don't just switch correctly.
- A7 Update — run this to make sure you have the latest version of the raspi-config utility.
9. About raspi-config
The name of the utility you're using right now is raspi-config. This tells you a little about it.
When you've set your options just the way you want them, use the arrow keys to highlight "Finish" (Not Finnish. Or Norwegian.) and hit the Enter key. The Pi will do a few things and reboot.
And we'll go to the next step, where we do some final setup.
Last edited by Jerry Hildenbrand; 05-11-2014 at 09:41 PM.
- 05-11-2014, 04:10 PM #5
5. NOW, it's a computer
Depending on the options you chose above, you'll see one of these two things when your Pi is done rebooting. OK, you probably won't see as much clutter on your desk, but you know what I mean. We're almost done, and you're almost ready to explore your Pi and make it your own. There will be some keyboard commands that need entered on the command line. Learn to love the command line. It's powerful, and while most things can be done without using it, it's often the easy way to do hard things. If you booted into the GUI, you can access the command line using the LX Terminal icon on your desktop.
Update your package manager
Raspbian uses the Aptitude package manager to install and remove applications and software. We need to make sure it's database is at the latest version. At your terminal, enter the following command and hit enter:
sudo apt-get update
If you're going to use the Pi as a desktop with its own monitor, keyboard and mouse, congrats. You're done. Explore things, play with the desktop, change wallpaper, go wild. Yes, it's a little slow, but it's clearly the best $35 computer you'll ever use. If you're new to Linux, you'll hit some snags. Just drop a post in the Pi forums here, and you'll get an answer. Maybe even the right answer. Only kidding. Mostly. Linux can be fickle, I won't lie.
If you didn't set up your Pi to boot straight to the desktop, you can start the GUI after you login by running this command:
Later, we'll do things like set up automatic file sharing with other computers, or running a small server on your home network. For now, enjoy the work — fun though it was — and play with your Pi.
If you plan to run the Pi headless and remote your way into it, you still have some setup to do.
Find the Pi's IP address, and set it as static in your router
You're going to need to know the address to connect to your Pi via SSH, and you don't want it to change. Right above the login prompt (see the first picture in this post) is your IP address. If you can still see it, jot it down. If not, it's easy to find. Run the following command:
Read the output for the network device you're using (in my case, it's eth0) and you'll see inet addr:xxx.xxx.xxx.xxx. For me, it's 192.168.1.245. Your MAC address is also on the first line labeled HWaddr if you need it for your router settings. Copy them down.
Go to the setup page for your router. Everyone is a little different, but somewhere you can set the DHCP server to always assign the same IP address to a device based on its MAC address. This is what that looks like on an ASUS router.
Yours will be similar (or the same if you have an ASUS RT-AC66U). Set it up, reboot and make sure it sticks before you unplug your Pi from the monitor.
Shutdown and disconnect all the extra stuff
Using the GUI gives you a shutdown button (find it yourself, it's there and you'll see lots of good stuff you need to see while looking around) but from the command line we need to do it manually.
Enter this command to shutdown:
sudo shutdown -h now
After you have the Pi shutdown (only one red LED will be lit) unplug the power. Now you can safely disconnect the keyboard, mouse and video cable — you won't be needing those. Find a place where your Pi is safe and sound (you'll never have to touch it again if you don't want to, so make sure the cat or little brother can't fiddle with it) and make sure your network cable (if you're using one, and since you can put the Pi anywhere why not put it next to the router and use a short CAT5 cable?) is in, the SD card is in, and power it back on.
Give it 60 seconds or so, and SSH into the Pi using the IP address you know is set aside for the Pi. Linux and Mac users can just use the terminal, Windows users need a TTY program like PuTTY. For those using PuTTY, follow the directions here to access your Pi (scroll to Chapter 2). If you're using Linux or OS X (or any other UNIX) open the terminal application and type:
ssh 192.168.1.245 -l pi
The very first time you you connect to your Pi via SSH you'll get a warning about not having the RSA key for this server. That's because you have never talked to this server before. Continue, and it will put the key on your computer so you know to trust your Pi from now on. Note that if you reinstall the OS on the Pi or use another SD card to boot up, the RSA key will not match. You'll need to delete your preferred hosts key file and create a new one. Consult the documentation for your computer for details.
Next, enter the password you assigned to the pi account (please don't tell me you didn't change the password. I'll cry.) and after a moment or two, you'll be right back at the command line inside your Pi. To quit the session, type "exit".
One last thing you might want to do before YOU can call it done — install a VNC server. That's next.
Last edited by Jerry Hildenbrand; 05-12-2014 at 08:40 PM.
- 05-11-2014, 04:10 PM #6
6. Remote desktop, anyone?
You can access the GUI on your Pi if you're not sitting in front of it — or even if you don't have a monitor or keyboard attached — using what's called VNC (Virtual Network Computing). Setting this up on your Pi is ridiculously easy, which means there's no reason not to do it.
VNC requires a server on the computer you want to view (in our case the Raspberry Pi) and a client on the machine you want to see things on. Another computer, your phone or your tablet are all more than capable of running a VNC client. There are also plenty of options when it comes to VNC servers, but most folks — us included — will recommend Tight VNC for use on a Pi. It's lightweight, robust, and it's right in the package manager for an easy install.
Installing the server
Open the LX Terminal app if you are in the GUI, or use your console if you're not, and enter the following commands one at a time:
sudo apt-get update sudo apt-get install tightvncserver
Running the server automatically at boot
This requires a little configuration, but nothing difficult. You need to write a small config file and get it into the right directory. In your terminal, enter the following commands one at a time:
mkdir /home/pi/.config/autostart cd /home/pi/.config/autostart
The second command puts you inside the new folder you created. That's where we need to create the configuration file to start VNC at boot.
[TIP]This sounds and looks like a lot of crazy voodoo, but you'll find most programs in Linux use configuration files to determine how they look and act. You only have to know where to put the file, and what to write in it — which you'll always find in the programs documentation.[/TIP]
You can create this file right inside the terminal with the nano app. Nano is great for quick and dirty edits and file creation, like we're doing here. And it's already installed on your Pi. Fire it up by typing:
[Desktop Entry] Type=Application Name=TightVNC Exec=vncserver :1 StartupNotify=false
This tells your computer to start TightVNC at boot, and not bug you to let you know it's running. And now you have a VNC server setup, that will restart automagically if you reboot your Pi.
There are literally hundreds of VNC clients available. The best thing you can do is head to the iMore, WPC and Android Central forums and ask folks what they are using on their machines. Here are the ones I use:
Android — VNC Viewer from Real VNC
iOS — VNC Viewer from Real VNC
Windows 7 — Real VNC
OS X — Real VNC
Linux — Real VNC
See a pattern there? I use what is simple and easy, because I mostly stay out of the GUI. Ask around and you might find better.
That's it for now. Follow these instructions and you'll have a fully functional Linux computer to do the things you need a fully functional Linux computer to do. We'll dive deeper soon.
Last edited by Jerry Hildenbrand; 05-12-2014 at 08:34 PM.
- 05-11-2014, 05:58 PM #7
Wow cool, subscribing!
And, since that sub forum has enough posts, I have moved this special thread to a special place! Thanks again, Jerry.
Sent from pin:2AD743B7 via Tapatalk Pro
Last edited by zocster; 05-12-2014 at 01:19 AM.
- 05-12-2014, 06:19 PM #9
Thanks guys. I hope to get interest in the Pi stirred up a little, and maybe we can provide a forum for folks to get started. There are plenty others for people that are past the beginner stage, and now there is one for everyone else
- 05-13-2014, 07:29 PM #14
I use X11VNC on my RPI's:
sudo apt-get install x11vnc
# Make X11 desktop available via VNC. sleep 60 && su -l pi -c "x11vnc -q -nevershared -forever -bg -display :0 >/dev/null 2>&1"
Last edited by jomcty; 05-13-2014 at 07:48 PM.
- 05-14-2014, 04:24 PM #15
This is great. I have a Pi that I am really trying to figure out what I want to do with it. I was originally thinking of something like a Chromecast but with more functionality, but now that I have one of those anyway......
- Junior Member
08-07-2016, 08:21 AM #21
- 2 Posts
Sorry to dig up this old thread. But it is rather useful for me. I followed the steps in configuring SSH for my Pi 3 and I managed to do it, but only when I use putty to SSH within my home network (which means both Pi and my laptop are on the same home wifi network). When I use an outside network, I cannot SSH into my Pi. I get error message from my Putty stating "Network Error. Connection Time Out."
Same goes for my andriod VNC, it works if I am using the same home network, once I am off the home network, it won't connect.
Did I miss any step?
- 08-07-2016, 09:21 PM #22
Do you have a vpn server running on your router? Because if you aren't vpn-ing into your home network, your router sees your ssh connections as attacks. Which is what it is supposed to do.
If your router doesn't have a vpn server, see if it is flashable to tomato or ddwrt; there are vpn server versions of those firmwares. If not, hit a deal site like slickdeals and set up a watch for wrt or tomato to find a cheap router you can flash. I got a TPlink for like $10 that can be flashed.
- By pkcable in forum Raspberry PiReplies: 18Last Post: 05-16-2014, 03:21 PM
- By edyb in forum Raspberry PiReplies: 4Last Post: 05-14-2014, 08:31 AM
- By edyb in forum Raspberry PiReplies: 5Last Post: 05-14-2014, 12:00 AM
- By edyb in forum Raspberry PiReplies: 2Last Post: 05-13-2014, 11:59 PM
- By edyb in forum Raspberry PiReplies: 1Last Post: 05-06-2014, 11:29 AM