The most simple solution for securing your firearm is the included cable lock. All new firearms sold in the US today are legally required to come with a safety device, often the simple cable lock which can be threaded through the action, preventing their function. Often, these locks can also be threaded through a bed leg or something similar to help anchor them in position. It should be known that these are more for preventing a child's access, and will not stop a determined attacker. I've personally pulled a cable lock open, and I'm not that strong of a man.
When buying used, your gun may not have an included cable lock. In this case, most gun shops and police departments give them away for free, no questions asked. If you have children in the home, the basic cable lock will be your easiest solution.'
The trigger lock is another inexpensive and simple method of securing firearms. Often times if a firearm doesn't come with a cable lock, then you'll be provided a trigger lock. Operation is simple; place each half of the lock on either side of the trigger guard, then secure in place. The idea here is to prevent the trigger from being pressed, though the firearm can still be loaded and emptied.
Like the cable lock, the trigger lock is not without its downsides. These are more focused on stopping small children from firing the gun, NOT stopping a determined person from gaining access to the firearm. As such, there is typically no way to secure the firearm in place with a trigger lock. Most cable locks are easily defeated with a simple screwdriver, acting as a lever to pop the lock open. Additionally, since the firearm is not locked open when secured, you may lose track of whether or not the gun is loaded.
Personally, I'd use a cable lock over a trigger lock. They offer a little more safety, security, and work with a wider variety of firearms.
Small Gun Safes
When I say "small gun safe" I mean the quick access, metal boxes made for pistols. You'll see these advertised for the nightstand or inside your vehicle. Prices range from $20 to several hundred, often based upon the lockwork in the safe. Some use a small tubular lock, while others offer RFID and fingerprint readers. Shapes and sizes vary widely, with some offering vast amounts of space for all of your home defense needs.
These are often easy to defeat for an attacker, with some being opened by simply dropping the safe on a hard surface. That being said, there are some extremely secure safes, but you'll be paying a pretty penny for quality. Even with stronger locks and materials, these can still be easily taken by an attacker. Some models mitigate this by providing steel cables to lash your safe to a sturdy object, which can help deter theft.
These offer solid protection against young children, as well as serious attackers. I keep two in my vehicle if I have to stow a gun in public. A quick access safe at the bedside can ensure your firearm is securely stored, but readily accessible in an emergency.
Gun cabinets are a step up, security wise, from cable locks. These are typically made from wood or thin metal, and feature some sort of locking device to keep the guns inside. Growing up, our gun cabinet featured a large glass window to display our guns, and a simple wafer lock. This was enough to keep us kids away from the guns, but any burglar would've been like a kid in a candy shop. These glass front cabinets should not be relied upon to protect your firearms from anyone except young children.
Metal gun cabinets, like those from Stack-On may not be the most decorative option, but do provide a little more security than previous options. These fully enclose your firearms in a low gauge metal and typically include some wafer lock for security. This style of cabinet keeps your guns out of sight, and avoids easily shattered glass. However, these are far from the most secure option. The locks are easily defeated, and the metal can be cut open with ease. On top of this, many metal gun cabinets are often lightweight. I can easily lift an 14-gun Stack On cabinet above my head, even with a few firearms inside. Bolting them to the ground or wall can help secure them in place, but the other weaknesses still apply.
Something like this will keep your guns safe from children, though their ability to prevent theft is a little lacking.
Large Gun Safes
A gun safe will be one of the more secure options to store your firearms. They are also one of the more expensive options, though they are worth the investment, in my opinion. Shapes, and sizes vary widely, with some holding just a handful of firearms, and others being nearly the size of a bedroom closet. Weighing hundreds of pounds, the likelihood of a gun safe being carried away is substantially lower than other storage methods. Locking mechanisms are large, steel rods sliding into place against a relatively thick safe wall. Some feature old school dials which must be spun to open, while others feature electronic keypads, RFID keys, and more.
Safes are not invulnerable however. The hulking doors seem nearly impenetrable, but most safes feature relatively thin walls. This allows attackers to cut their way inside, but this requires time, and equipment. Failure to bolt a safe to the wall or floor could also result in it being carted away, as a simple dolly (handtruck, etc) can turn hundreds of pounds into something easily transported. Again, this requires time and equipment on the part of the bad guys.
As far as children are concerned, a gun safe should be an insurmountable obstacle, unless your kid is handy with the Sawzall or safe cracking. Most attackers will likely be deterred or stopped by a good safe as well. Price tags are often high, but the additional security is worthwhile.