Download and watch the episode here:
Know How... 77
DESCRIPTION: On this episode of Know How..., know how to make an OS X Maverick boot disc play with DHCP and oh yeah, it's Raspberry Pi!
Netcasts you love, from people you trust. This is TWiT.
Bandwidth for Know How is brought to you by CacheFly.com. This episode if brought to you by Linda.com, learn what you want, when you want it with access to over 2,000 high quality online courses all for one low monthly price. To try it free for seven days, visit Linda.com/knowhow. And by LegalZoom, visit Legalzoom.com to save on your legalese and gain access to a network of legal plan attorneys for guidance. Legalzoom is not a law firm but provides self-help services at your specific direction. Visit legalzoom.com and use offer code “knowhow” to receive $10 off at checkout.
FATHER ROBERT BALLECER: Welcome to Know How... it's a Twit show where we build, bend, break and upgrade. I'm your host, Father Robert Ballecer and we've got an action packed show, starting with the stuff that you see in front of me. Now, a lot of you have been wanting some Raspberry Pi projects and I know, we've had a dearth of them but, this time we're going to be showing you how to make your own little Raspberry Pi web cam server. Now, the cool thing about a project like this is it's very easy for you to do and it probably uses products you have lying around your home lab. But first, I thought we needed to do something for our Mac friends out there so, I asked cranky hippo (Bryan Burnett) if he could show us how to turn a USB drive into a boot disc for OS X Mavericks.
BRYAN BURNETT: Has your Mac been running sluggish? If you're in a situation like me, I have a 2011 MacBook Air that has seen quite a few updates and it could use a little bit of a refresh. Well, Apple released OS X Mavericks back in October 2013, and that was a good opportunity to either update your current system or do a complete clean install, like I'm going to show you how to do right now. All you're going to need is a Mac running OS X 10.6 or higher and an 8 GB USB drive. So, to get started you're going to want to go to the Apple Apps Store and download OS X Mavericks for free. This does take a couple of hours, it's about 5.5 GB to download so, be aware of that. Once that is completed, you will be approached by this screen. You don't want to go any further from this because, we're going to be installing from the USB drive. So close that, open disc utility--select the external drive--then choose the partition tab--select one partition--and from the layout menu then, click options and choose GUID partition table and select OK. I'm going to leave my name of the drive untitled and later on that will make things easier when I am copying code to Terminal. The next step is to open Terminal and copy this script that I have kind of provided you. Make sure that whatever name you have for your USB drive matches the Volumes/ and then the name of your drive. I'm going to leave it Untitled to make things easier for myself. Copy it over, the entire string with no breaks, Terminal will ask you for your password and next you will see an "Erasing Disc" and it gives you a progression of percentage, then just sit back and wait. This takes a little bit of time so, definitely go make a sandwich or something while you're waiting. Once you've exited out of Terminal, you'll see a finder of the USB drive that used to say 'Untitled', now says 'Install OS X Mavericks'. So that means the USB drive is now bootable as a OS X installer and can be used for upgrading older versions of the Mac OS or doing a clean install, like I'm going to show you here in a second. Before we do that, we definitely want to back up anything that you definitely want to keep. Next, you will want to reboot your Mac and make sure the USB is plugged in, and hold the 'Option' Key while the Mac is booting up, and you'll be approached by this boot selection menu. Select the 'OS X Mavericks' USB drive and once again I want to remind you, doing a format and clean install of the OS will erase everything so make sure you're backed up. Choose the 'Disc Utility' option--select your main hard drive--then choose the erase tab. Select 'Format Type: Mac Os Extended Journaled and name the drive what you would like it to be, I'm just going to leave it 'Macintosh HD' to keep it simple, and choose 'Erase'. Now that you have completely erased the main hard drive, quit from 'Disc Utility', and choose the 'Install OS X' option. So now you have begun the process of installing Mavericks onto the hard drive. Your computer will reboot once and it will finish the process again. Go through the Apple options of your keyboard, language settings, set it up the way you like. Now when the computer reboots and comes into the main OS, you'll see you have a clean install of Mavericks and this is basically what it would look like if you went to the Apple Store and bought it brand new. Now, a couple of things that I would recommend doing before you start doing anything else is, definitely turn on your firewall in the security options and encrypt your drive. After talking to Shannon Morris about an exploit that can happen to Macs if your drive isn't encrypted, I highly recommend it. After that, enjoy your fresh new install of Mavericks on your laptop and your laptop should feel a little more snappy hopefully.
Fr ROBERT: You know, I just ran into this issue the other week. I was playing with a MacBook Pro that I was upgrading the Optical drive to a hard disc drive, and the hard disc drive to an SSD. I got a lot of fan mail from people saying, "hey, don't do a fresh install, just clone over the drive and it works just as fine, it's OS X, it's perfect." Brian, let me ask you, if you were going to do a fresh install on your laptop, let's say you were going to upgrade your hard disc drive to an SSD, would you clone or would you want a fresh install?
BRYAN: I'd go with a fresh install. I kind of like to start over every time I do it, and reinstall things because sometimes there's programs that I've had that don't update correctly so if I do a clean install and redownload Photoshop and everything, it just seems to work a little bit better.
Fr. ROBERT: Yeah, I understand why people might not want to do that. I know there's people out there who are like, "Wait a minute, I don't want to do anything with the tinkering of the computer. I just want it to work properly." I've always found, be it Linux, Windows or OS X, if you get that fresh install, it kind of reminds me of all the things I had to do to set it up properly i the first place and I always end up with a better install every time I do it. I don't know, maybe it's just because I'm a Windows guy and I've gotten used to installing every other day but, I just feel better. You know what else makes me feel better? Lynda.com, you see, here at Know How... we're all about teaching you the knowledge and so when we've got a supporter that comes in and says, "hey ,we want to give your know-it-alls, the knowledge that they need as well." Well, it's really a no brainer. What do you want to learn this year? You want to learn photography? Audio and video editing? Maybe software skills? With the easy to follow video tutorials on lynda.com, you can learn at your own pace, on your own terms, from top industry experts. With a lynda.com subscription, members receive unlimited access to thousands of online video courses that cover a variety of software, creative and business skills. Personally, I am big into their Adobe Premiere projects. You all know that I like Premiere, it's the software that I use. I edit all my segments, any time you see me do a review or segment on Know How..., I've done it in Premiere. Well, just because I've been using it for years, it doesn't mean I know everything there is to know about it. That's why I like to go to Lynda.com and watch their courses because, they teach me the shortcuts. They teach me the little bits of knowledge, I wouldn't get otherwise and I've got to tell you, when I'm learning from people who are actually doing this in the field, not just teaching it in a classroom, it makes all the difference. With Lynda you get to improve your skills, you get to learn new software and you get to keep up with technology. They have over 2,000 courses with new courses added daily. Their new courses include foundations of audio, eq and filters, illustrator in design and photoshop creative cloud updates and up and running with go to meeting. Instructors are working professionals at the top of their fields and expert teachers. You get high quality video production from state of the art studios. These aren't the homemade videos you'll find on Youtube, where the lighting is not quite right or the audio is horrible, no, everything is pure and pristine. They know that you want to watch high quality content when you're learning about the things you want to learn about. They have curated course content. Each lynda.com course is carefully structured so that users can learn from start to finish or jump to specific chapters for quick answers. You also get easy to follow videos that help you find the answers that you need. With searchable transcripts, which allow you t search inside a video to save time and find exactly what you're looking for. You'll know what i'm talking about if you have ever searched through Youtube for that instructional video to help you with a project that you're having and none of them quite hit the angle or the topic that you want them to cover. Well, with searchable, indexable courses, you can search through the content that's inside the videos, rather than just depending on the titles of the videos. They also have courses for all experience levels that cover a wide range of technical skills, creative techniques, business strategies and more. You can watch from your computer, tablet or mobile device. You can switch and pick up on the chapter where you left off, you get to learn at your own pace, on your schedule. So here's what we want you to do, if you are a real know it all. Learn something new in 2014 with lynda.com. It's only $25 a month for access to the entire lynda.com course library or for $37.50 a month, you can subscribe to the premium plan which includes exercise files that let you follow along with instructors' projects using the exact same assets. You can try Lynda.com right now with the free seven day trial. Visit Lynda.com/KnowHow to access the entire library. That's over 2,000 courses free for seven days. They've also created a playlist with some suggested courses to get you started. It's all at Lynda.com/KnowHow. We picked Lynda for their support of Know How....
Now we're going to pull something right out of the G plus page. After our episode last week on some interesting network configuration we got a lot of requests for doing DHCP right. DHCP- Dynamic Host Control Protocol is the way devices get an address from your network. So, let's say I have an iPhone connecting over the Wifi network, or my laptop connecting over my wired network. When I connect to that router, it requests an address. With that address, I can get all the information I need to connect to that network. Well, that's great, and it's wonderful and it works very easily and for 99% of the time, DHCP is just what the doctor ordered. But, there are those who are going to want to play with statics. Statics mean that you hard code an address into your device, into your computer, into your iPhone or into your tablet. Which allows it to keep that same device over and over and over, no matter what network you move to, no matter what time you plug in, no matter which port you're connected to. It's a very useful technique especially, if you're going to be doing some sort of port 40 like for example, you've got a game server, or say a webcam server. Static IPs are something that you need to know. Now, there are different ways to do Static IPs but, i'm going to show you the old school way. We're not going to be using a Mac address to dynamically assign Statics inside the router. I'm going to show you how you actually get the information you need to assing the Static to your device. Now, the first thing we're going to want to do is, you want to get into you're router. This, again, is DD-WRT on this old Lynksis WRT 54 G, that i've been using on pretty much every episode. It's an old bit of firmware so, if it's on this old firmware, you know you're going to have it on your newer. The thing you want to look for is in the 'Network Setup'. There are a few pieces of information here that you can lean. The first is, that you have got a range that is going to start at 192.168.222.1. That's the very first address, which is actually going to be my router, it's going to be my gateway. Below that, you should see something that says 'DHCP Settings' or 'Network Address Server Settings' just, kind of eyeball it to find out what it is, in your particular version of software. The server should be on and it should tell you a start address. Now, the start address is the very first address that this router, that this gateway, is going to give to a device requesting a DHCP address. So, let's say I clear the power, let's say I turn this thing off, turn it back on, connect my laptop. My laptop is the very first device to request an address. The DHCP server will give it 192.168.222.100. You should also have another little bit of an entry there, that tells either the max number of users or the max range. You know, basically, it's going to say, "If i start at 22.214.171.124, how far up can I go?" On this particular router, I've told it that it could have a maximum of 50 users which means my DHCP range is 192.168.222.100 to 149 which is, 50 users. Now, that's great and that shows you what you need to have in order to have a dynamically, statically IP address on your network aside from your DHCP address. How do you use that in a network device? The simplest way to do that, and i'm going to show you in a windows box but, this command exists in linux and OS X, is to bring up a command prompt or your command line. Just type IPconfig, and it will give you all the different networks you're connected to. Right here is the information that you need. It tells me the address my computer has been assigned, 192.168.222.108 but, importantly it tells me my subnet mask, you need to copy it down. Most of the time, for a home router, it's going to be 255.255.255.0 and it tells me my default gateway which is, 192.168.222.1. You need those two pieces of information because you need to enter that into every device you are going to statically assign an IP address to. The other bit of information is your DNS server which, most of the time, again 99% of the time, if you're using a home router is going to be the same as the gateway. So, my gateway is 192.168.222.1, my DNS server will also be 192.168.222.1. But, Bryan if you cut back to my command prompt, if you've got one of those .1% networks that doesn't do that, the command that you want to use is IP config/all. That will actually show you everything, not just that short summary. It's going to show you my IP address. It's going to show you my subnet mask, my gateway, the DHCP server and it shows you the DNS serves that you've got connected, in this case, 192.168.222.1. With that information, you can now go into the configuration utility of your windows box, whatever that might be and in this case, I'm going to drop into my network and sharing options and under IPPB4 settings, I have the ability to not use an automatically assigned address, but to enter a static address, here. This is where I would put any information that I leaned from that command prompt. 192.168.222. whatever address, as long as it's not in the DHCP range 255.255.255.0 for my subnet mask, 192.168.222.1 for my default gateway and DNS server. It's a very simple way for you to assign an address that you know that device will exist on, all the time. I wouldn't suggest you do it on your laptop unless, you're troubleshooting. I would suggest you think about it for things like webcam servers or say media devices that you want to know where they are at all times. Now, that's a quick way to handle some DHCP/Static Addressing on your network but, what we want to do right now is, take a break to talk about our second sponsor which is legalzoom.com.
Now, we want to welcome legalzoom.com to the show, we haven't had them before, and it's always great to have a new sponsor. Now, if you're like our average know it all, you probably made a couple of new year’s resolutions. You know, getting fitter, getting trimmer, getting smarter. Well, we want to suggest another new year resolution that you may want to consider. Some things like starting a business or protecting your family with the will, aren't like your other new year resolutions. You can't afford to blow them off. I mean, if you stop going to the gym it's one thing but, if you forget to do a will, if you forget to protect your estate well, that's just unforgivable. That's why we got legalzoom.com instead of less snacking and more exercise, you can put them at the top of your list. Legalzoom.com helps you incorporate or form an LLC with their simple questionaire, starting at just $99. Now over one million euntrepenours have done it, you should to if you've got that idea, if you've got that future startup, that billion dollar idea, why not protect it with a little bit of an LLC, and legalzoom.com can help you. 90% of customers reccomend legalzoom to friends and family so that tells you that people who try it are happy with the service. You can also create a will starting at just $69 or even a living trust, quickly and easily and get a piece of mind and protection. There are no surprise fees, there are no hassles and no headaches. Legalzoom step by step process was created by a team of experts in law and technology. In other words, it wasn't just a bunch of lawyers in a room doing legal speak, it was people who actually understand how we, in the real world talk, making sure that the language was easy for you to understand and the process was easy to follow. Legalzoom is not a lawfirm but, it can connect you with a third party attorney and provide you with self-help services from wills to business formation, trademarks to power of attorney and more. All at legalzoom.com. So, here's what we'd like you to do. Visit legalzoom.com to save on your legal needs. Like wills for $69, LLCS for $99 plus filing fees and also get access to a network of legal plan attorneys for guidance. Don't put off the things that you need to do, do them now. Go to legalzoom.com and use the discount code 'KnowHow'. That's legalzoom.com, discount code 'KnowHow' to recieve $10 off at checkout. We thank legalzoom.com for their support of Know How...
Let's get to the meat of the episode. I know that a lot of you have been looking at this little setup we've got on the table. This, as promised, is a raspberry pi. It's not just any raspberry pi, we didn't just hook it up and start running a couple of linux commands. We've actually created a web server. Now, this one is hooked up to a webcam and there are a few parts you need to have before you start going through this process. Make sure you have them all at the beginning because, there's nothing worse than starting a project and not having everything you need. So, if you come out to my wide product shot, I'm going to show you some of the things you're going to have to have in your possession before you get started. The first thing, of course, is the raspberry pi. You want the pi and you want a memory card. I've chosen to have a 16 GB memory card just because, I'm going to be doing pictures and video and I want to make sure that I have enough space. You also want to make sure you have a powered USB hub. There are plenty of USB hubs out there that you can just plug in that require an adapter but, you're going to want something with supplemental power just because, if you're ever going to plug in more than two devices, because there’s only two USB ports on this board, and you're going to require external power, you're going to wish you had one of these. It just makes it a lot simpler. You're also going to need a webcam. I'm using this Logitech Pro 9000. I've had it for quite a while. Try to avoid the off brands just because, they're probably not going to have that much support with linux and get rid of the hassle, get yourself a decent webcam. You're also going to need something to do input with. I have a USB keyboard and a USB mouse along with something to connect it to. i have an network router here that is allowing me to connect out to the internet, because some of the setup that i'm about to show you is going to require you to be connected to an archive. So, these are the parts that you need to do a raspberry pi webcam server. Now, here's the process. The first step is, to download the files that you will need. You'll need the SD formatter software and a copy of NOOBS. The new out of box software install. You can find them all on the raspberry pi downloads page and the link will be in the show notes. Install the SD formatter software then use it to prepare your SD card, making sure to check the option to let it do a full format size adjustment. Copy the contents of the NOOBS folder into the root directory of the SD card. Then plug the SD card into your raspberry pi. Connect the mouse and keyboard into the powered hub. Then plug the powered hub and web camera into the onboard ports on the raspberry pi. Connect the HDMI port to your monitor and the ethernet port to your network. Finally, connect your power cable from the raspberry pi into the powered hub. I know this sounds strange but, it will work just fine. After the raspberry pi reboots, you can see a screen that lets you choose your distro. Select the second raspbian distro and click 'Install'. The install will take some time, but, be patient and know that you're just a few minutes away from ras pi awesomeness. Once the install is finished, click 'OK' and the ras pi will re boot into the configuration tool, where you can set your language, keyboard, time zone and pretty much everything you would associate with a new computer. The first thing you want to do is to change the default password. Select 'Option 2' and change it. Your user name is now 'Pi' and your password is whatever you just chose. Next, go into 'Option 4' and select your time zone. Then, get back to the main menu and select finish and hit 'Enter'. You should now be at the raspian command prompt. We need to verify that it recognizes your web camera, so type 'DMESG' enter. A status screen will scroll. You want to look for a line that says 'lynux video capture device'. If you see that, it means that your webcam is supported and recognized. Now, we're going to install 'Motion', the software that will become your webcam server. Type in 'Sudo Aptitude Install Motion'. It will tell you that it needs to get files from the archive, hit 'Y' and 'Enter'. Rasbian will automatically download and install the package. Now that motion is installed, you need to activate the daemon by typing 'sudo nano /etc/default/motion' and 'Enter'. You'll drop into the nano editor screen and there you'll see the line 'start_motion_daemon=no' change it to 'start_motion_daemon=yes' and then hit 'Control X' and type 'y' when it asks you if you want to save the modified buffer. You will now need to make and prepare the directory that will store pictures and videos. Type 'sudo mkdir /srv/motion' hit 'enter'. then type 'sudo chown motion.motion /srv/motion' hit 'enter'. With the software installed the daemon activated and the storage area defined, we now need to configure motion. Type 'sudo nano /etc/motion/motion.conf hit 'enter'. Now, here's where it gets a little complicated. What you see before you are all the parameters that run motion. For the most part, you can leave these settings alone but, i'm going to show you the things that you should change. The configuration file is divided into different sections. I'm going to show you what you need to change in each one. First, in the daemon section, change 'daemon off' to 'daemon on'. In the caption device options section, change 'width 320' to 'width 352'. Then change 'height to 240' to 'height 288'. Finally, change 'framerate' to 'framerate 5'. In the Image file output section, chage 'output_normal_on' to 'output_normal_off'. Also, change 'quality 75' to 'quality 100'. In the Target Directories and filenames For Images And Films section, change 'target_dir' to 'target_dir /srv/motion'. You've just told motion to store the images and videos into the directory that you prepared for it. In the Live Webcam Server section, change 'webcam_quality 50' to 'webcam_quality 100'. Then, change 'webcam_maxrate 5' to ' webcam_maxrate 15'. Finally, change 'webcam_localhost on' to 'webcam_localhost off'. In the HTTP Based Control section, change 'control_localhost on' to 'control_localhost off'. Now, save the file by hitting 'Control X' and verifying with 'Y' and 'Enter'. With the configuration file prepared, you now need to restart the daemon so the settings will be activated. Type ' sudo /etc/init.d/motion restart hit 'enter'. The last step is to find your IP address. Type 'ifconfig' and you'll see an IP address listed for ethernet zero. Type that address into your browser of choice, following the address with '8080' to reach the config page and '8081' to reach the live feed. I know a lot of people are freaking out right now because, this seems really, really complicated but, don't worry about it, we've got all these steps. Actually, step by step by step, and putting all the things that you have to type in the show notes. In fact, you could just go to the show notes and follow those instructions as is, and it would create the raspberry pi webcam server as we're showing it. Now, go ahead and switch back to my wide, and let me show off a few things about this project that you're going to want to take advantage of. The first thing is that it allows you not just to use webcams that you connect, like Logitech 9000 pro, but, you could actually have it connect to network cameras. So, if you've got a network accessible camera, something from access or something from Dlink with a standard interface, you can actually tell motion to connect to those and give you one of those grid views. It's a super, super cheap way to be able to get a little bit of security. Now, you can also have it record video and pictures if it detects motion. So, if something comes into the field, it will start recording those images so that you have a little bit of a security feed from about $40 bucks. That's not a bad deal at all. There are a few things that I want to show you that you need to know about linux, that you need to know about raspbian, and that you need to know about the raspberry pi. If you could go ahead and switch over to my raspberry pi feed, there are a few things that you probably saw me do. First is this sudo command. You're going to see me type it a lot. Sudo actually just means super user do. It's a way of getting access to the super user without having to log in as the administrator. Anyone who runs a Mac or definitely a Windows PC knows that, as much as possible you don't want to be running as administrator because if you're the administrator, you can do really, really bad things to your system. So, sudo is just a command to say, take this as a super user. Now, please, whatever you do, don't just shut down your pi. If you need to turn it off, the command is 'sudo halt'. If you enter in this command it will safely shut everything down so that you don't accidentally corrupt your SD card. Please, please, please, please, do that because, if you don't, I'm going to get a lot of e-mails saying, "hey, I just did this project and how come everything's dead?" It's dead because, you just pulled the power. The last thing I want to show you about this project is, if you go into the motion configuration file, this is the big complicated file that we had in the segment. I know it looks really complicated, but, if you look through this file, it actually gives you the instructions, it tells you what each of these settings do. Go ahead and play around with the settings and try to find the perfect setting for you. In this configuration file, you can tell it how many cameras it’s going to connect to, you can tell it what kind of output you want. Do you want it as a flash file, do you want it as mpeg file, do you want it as a jpeg 2 file. You can tell it how fast of a frame rate you want it, how many pictures you want, what kind of resolution you want from your camera, the address at which people are going to find your server. These are all things that you can play with at your own leisure. What I would suggest is to start poking around, that's always the best way to learn about raspberry pi. Now, again, let me stress, all of these notes will be in the show notes. Don't panic, you're not going to have to play the video multiple times, although we suggest that you do. Just look at the show notes, you're going to have your raspberry pi up and running in all time. I also want to tell people that you should visit our show notes page. Not just because we like when you come visit us, but, because you can find show notes, you can find all of our episodes, you find ways to have every episode of Know How... downloaded into the device of choice. Just go to Twit.tv/KH and you'll find the individual episodes and the drop down menus for getting it onto your iPad, your iPhone, your Android phone or tablet, your laptop, your desktop. We love you, that's why we want to give you Know How... Also, reach out to us. There are several different ways that you can contact us. The first way is, of course, through e-mail. Yes, we still do e-mail here, we're kind of old school. Just find us at Knowhow@twit.tv, I promise to get back to you as soon as possible. However, even better than e-mail is to jump into our G plus page. Our Google plus community is perhaps one of the most active, it's got 5,000 plus members and they're all rabid about making things. If you ask a question, if you propose a project, it's not just going to be me responding, and by the way, I'm always in there, it's going to be the entire community of know-it-alls. It's a great way to find out how something works or maybe find an answer to that troublesome problem. Just go to Gplus.to/twitkh and join. Finally, I want to say that you can find me on Twitter. If you reach out to me at padresj, go ahead and follow me, and tell me what you want to see. I pull many of my episodes directly off my feed. If you tell me you want to see something about DHCP, you'll see something about DHCP. If you want more raspberry pi projects, that's the place to tell me. Finally, I want to thank everyone here who made this show possible. To Shannon, my awesome producer, to Bryan, my TD, the crankyhippo himself. I'm father Robert Ballacer just saying, now that you know.