Octagon boxes are often used for supporting ceiling fixtures and making electrical connections, but they do have their weight limits. These boxes are usually found on walls and on ceiling for connections and use with light fixtures. The wiring must comply with the National Electrical Code guidelines to ensure safety. Installing light fixtures isn't all that hard with these boxes, but ceiling fans should have a bracketed box capable of holding the additional weight they have.
In order to install wiring in the box, connectors must be used via the knockout holes that are prepunched for your convenience. You can add either EMT connectors or cable clamp connectors to these holes to fasten the cable securely to the box or the piping to the box.
Octagon boxes must be secured to studs or ceiling joists, or wood blocking because this box will have to support the light fixture that is directly conected to it. The box should be mounted so it is flush with the finished wall or ceiling surface. If a wooden support isn't in close proximity to the light fixture opening, there are bracketed octagon box combos available that allow you to nail the bracket to two joists and adjust the box to a position between the bracket supports. Usually joists will be centered at 16".
As I mentioned before, these boxes have their weight limit. In fact, they are designed only to hold up to 35 pounds safely. If you have a light fixture weighing more than this, it is just like supporting a ceiling fan, you must use a ceiling fan support box that is specifically rated to hold much heavier fixtures and fans. Noone wants a fan or light falling off the wall or ceiling!
Oh and one more thing, please be sure that there are no knockout holes left open. There are different sized knockout fillers available in stores that snap right in and keep insulation, bugs and cold air from entering the octagon box.