Programming blank atmega328 microcontroller
This is not intended to be a full answer to your question, but hopefully it's enough to get you going in the right direction. I mention some specific pieces of software in here, but I'm sure there are alternatives available for everything I mention.

Atmel AVRs (most, anyway) are programmed via a mechanism known as In-circuit Serial Programming, or ISP. To program your chip (which includes installing a bootloader), you need an ISP programmer.

If you just want to use your chip as a replacement Arduino and program it using the Arduino language (which is C++ by the way, not C), you can easily do this using your Arduino with the ArduinoISP sketch. You need to hook up your chip to the Arduino in a specific way, and then you should be able to burn the Arduino bootloader to it using ArduinoISP. More details are on the Arduino site.



If you want to program the AVR as a stand-alone unit, you'll need to program it using ISP for the main program. You can also use your Arduino with the ArduinoISP sketch for that, but you'll have to use a programming tool such as avrdude (the actual AVR programming tool that Arduino uses) directly. You don't need a bootloader on your chip for this.

I ended up with something like this:

avrdude -p m328p -c stk500v1 -e -P /dev/ttyUSB0 -b 19200 -U flash:w:yourprogram.hex:i


The yourprogram.hex files are compiled binary files, you can generate them by running your C programs through avr-gcc. You could also use the Arduino IDE (which uses avr-gcc internally) to generate them for you. It dumps them somewhere in /tmp/ where you can snatch them.

In either case, you'll have to learn about fuse bits, and how to program them. There are plenty of fuse calculators out there that can help you determine what fuse settings you need, and you can actually program them using avrdude.