This took hours to figure out. I was trying to install MJPG-streamer and running VLC command lines and all this crap but nothing worked.
~> sudo apt-get install motion
Then create a config file:
~> mkdir ~/.motion
~> nano ~/.motion/motion.conf
In it, the bare minimum to run a web server and view it on other computers:
Then run motion:
Now you can view the webcam at http://hostname:8081 If it doesn’t work, try rebooting between steps or something.