Aircraft cabins are pressurized by pumping compressed air into the cabin (usually fresh air from the compressor stages of the engines, but sometimes from auxiliary power units). At the same time, adjustable valves let air escape from the cabin. By adjusting the opening of the valves, the pressure inside the cabin can be raised or lowered (when they are very open, the pressure is almost the same as outside, but when they are nearly closed, the pressure is much higher).
The doors in most airliners are like plugs: when the airplane is pressurized in flight, the doors are pressed tightly against the frames and cannot be opened. However, if the airplane is on the ground and only slightly pressurized, it may be possible to open the doors, which can cause them to blow open suddenly and take whoever is opening them with them (flight attendants have been killed in this way on some occasions, blown onto the ramp when they opened the doors on arrival before the plane was completely depressurized). For this reason, the airplane is not pressurized until the doors are all closed and the aircraft is ready to depart (after the crew is certain that it won't have to open the doors again on the ground).
When the aircraft is pressurized, the pressure inside is always higher than the pressure outside; it is not possible to maintain a lower pressure inside the cabin. And the cabin is not sealed shut: valves control the pressure inside and they are normally slightly open. Thus, there is no possibility that the airplane will be crushed by surface pressure, as the pressure inside is always at least as high as the pressure outside.
Airplanes are often pressurized as they leave the gate and taxi (although the pressurization is very slight while on the ground), or upon leaving the runway at take-off. They are depressurized as soon as they land.
The amount of pressurization is controlled by regulations and by airplane capabilities. The cabin typically can tolerate a pressure about 8 psi higher than the pressure outside. Regulations require that the pressure inside the cabin never be less than that experienced at an altitude of 8000 feet. At low altitudes, the aircraft can maintain lower cabin altitudes; at high altitudes, the cabin altitude must be raised to 8000 feet to keep the differential pressure (the difference between inside and outside) within the 8-psi limit.
So, on the ground, the cabin altitude will be the same as the altitude of the airport. Once the plane takes off, the cabin altitude will increase, but much more slowly than the altitude outside, and it will never go about 8000 feet. If the plane is flying at a fairly low altitude (24,000 feet, for example), the cabin altitude may only rise slightly, to 2000 (the altitude of Las Vegas) or 5000 feet (the altitude of Denver). If the plane flies very high, the cabin altitude may reach 8000 feet (slightly below the altitude of Telluride in Colorado). As the plane descends again, the pressure is again equalized with the pressure outside.
In some cases, the pressure at arrival is lower than at departure. For example, if the airliner leaves Los Angeles for Denver, the cabin altitude will be near sea level on departure. If the altitude of the flight isn't very high, the cabin altitude might rise to 4000 feet in the middle of the flight. But since Denver is above 5000 feet, the cabin altitude will actually be increased before arrival, instead of being decreased, and will end up at the altitude of Denver.
In most modern airliners, all of this is controlled by computer. In the old days, flight engineers had to adjust the cabin altitude by hand during the flight.