Set-up a Ubuntu webcam security system

Have you ever wanted to spy see on what is going on in your home while you are away? Motion is a piece of open source software that acts as a motion detector. It enables you to set-up a webcam server that you can have all your cameras connected too, so you can view them remotely and also upload them to a remote server. Motion should run on most linux distributions but for this exercise I’m using the desktop version of Ubuntu linux.


* Extra computer that we’ll use as the server.
* Distro of linux installed on the server. (Recommended, Ubuntu)
* USB webcam with a linux driver
* Static IP set for the server
* General knowledge of Linux like OS’s.
* A bit of free time

Step One

Okay lets start off by downloading the linux driver for your webcam. This great man wrote a single driver that is compatible with 244 different webcams! You can download it here onto the desktop of your server. If this does network for your camera please search Google for the right driver for yours.

Step Two

Once you’ve downloaded the driver we can start compiling it, but first make sure you have the package build-essential installed you can do so by typing in sudo apt-get install build-essential into the terminal, information on this package can be located here.


We are ready to start compiling the source code for the driver. Once we extract the .tar.gz file by right-clicking on it, then select Extract Here. This should take a few seconds to complete, then open up terminal again and type in cd ~/Desktop/gspcav1-20070508/ push enter on your keyboard and then type ./configure push enter this should take a minute or two (don’t worry if this does not work just precede to compiling). After that start compiling it by typing in make. After it’s been compiled you can install it by typing in sudo make install this will install the package and you should have a webcam that is recognized by linux now!

cd unix

Step Three

Installing , the software your are going to use to monitor your webcam for motion. Type in sudo apt-get install motion into terminal, then press enter.

sudo apt-get install motion

Step Four

It’s now time to setup Motion’s configuration files. You can download my config files that I’ve already filled in; here (read through the entire motion.conf file and change the settings to fit your needs). Put the files in the Motion Config.zip file in your /etc/motion/ folder on your server by first extracting the files onto the desktop, then typing sudo mv ~/Desktop/Motion Config.zip_FILES /etc/motion/ into the terminal.

sudo mv motion config

Please note this if you only have more than a single webcam you will need one more thread.conf for each extra cam (example; thread0.conf, thread1.conf, thread2.conf) You will also need to add the links to these files at end of the motion.conf file.

Step Five (optional)

Install wput a command line FTP client that you can use to upload the photos, to an remote FTP server, that have been taken by Motion. Install this by typing sudo apt-get install wput into the terminal. You can configure Motion to use wput to upload photos that have been taken by adding

# Command to be executed when a picture (.ppm|.jpg) is saved (default: none)# The filename of the picture is appended as an argument for the command.on_picture_save wput ftp://USERNAME:PASSWORD@REMOTE SERVER %f

to you motion.conf file (if your using the motion.conf I provided this is already in there, just replace the server info in the ftp:// section)Step SixTo add Motion to startup automatically start with the server, just open “System” from the menu bar on the top of the screen, then “Preferences,” then “Sessions.” Create a new startup program type in a name for it and then type motion in the command section. Click“OK.” Then restart the server.

Motion Autostart

Step Seven

You should now be able to open a web interface for Motion now by typing in localhost:8000 from the server itself or XXX.XXX.X.XXX:8000 from another computers web browser. To view a live stream of your webcam type localhost:8001 from the server itself or XXX.XXX.X.XXX:8001 from another computers web browser. You can change settings from this interface here too, you can even make Motion generate it’s own config files to fit your setup exactly!


Enjoy the web interface for viewing you webcam as-well as you new home-brew security system! All thanks to , , , and all the other great open source developers. Keep up the great work! If you need more information about getting Motion running visit; here. There is also a ton of configuration options. From taking movies instead of photos, to launching a script when motion is detected; here.

Edit: You can have as many webcams hooked up to the server as it can handle, USB 1 inputs will only handle one camera per. USB 2 inputs will allow many more than that. For more information on setting up multiple cameras with Motion visit; here and also read step 4 again.

Ujie Caprone | © 2011 Blogger Template by Ujiecaprone.com