Dozens of U.S. warplanes carried out a massive bombing raid on airfields, government command posts and suspected terrorist training camps around the Libyan port cities of Tripoli and Benghazi last night to "preempt and discourage" terrorism, the White House announced.

The bombers, flying from aircraft carriers and U.S. bases in Great Britain, triggered fiery explosions in both cities and ignited what observers on the ground believed was a large fire at an oil storage facility outside Tripoli in the raid, which occurred at 2 a.m. Libyan time (7 p.m. EST).

Libyan radio reported that a number of relatives of Libyan leader Muammar Qaddafi were injured in the air strike when bombs hit a residential compound, but Qaddafi reportedly survived, information director Ibrahim Seger said. "He's okay, he's okay," Seger told the Associated Press in Tripoli.

Defense Secretary Caspar W. Weinberger said that one F111 bomber based in Britain was unaccounted for, and he speculated that the plane could have had mechanical trouble during the long trip back to Britain. As of early this morning, the Pentagon said it still had no word on the missing plane. There were no confirmed American casualties.

In a brief televised address last night, President Reagan said, "Today we have done what we had to do. If necessary, we shall do it again. It gives me no pleasure to say that, and I wish it were otherwise."

Secretary of State George P. Shultz, in a subsequent news conference at the White House, said, "What is clear tonight is that the United States will take military action under certain circumstances. That's established. That's very important."

White House spokesman Larry Speakes in describing the raid said, "This effort on our part is an effort to prevent Qaddafi from making future attacks on us. It is a self-defense move."

The Soviet charge d'affaires in Washington was informed of the raid while it was in progress and told of U.S. evidence linking Libya to a fatal April 5 bombing of a West Berlin discotheque, Shultz said. Thousands of Soviet military and industrial technicians are believed to be in Libya, but it was unclear whether any were casualties.

Early today the Soviet news agency Tass accused the United States of committing "naked aggression" against Libya, but avoided any threats in reply.

The attacking bombers included 15 Navy A6 Intruder and A7 bombers from the aircraft carriers USS America and USS Coral Sea north of the Libyan coast and 18 of the Britain-based Air Force F111s, which were refueled in the air several times by a fleet of several dozen aerial tankers.

The F111s had to fly a circuitous route, Weinberger said, because France would not allow the bombers to fly over its territory, extending the trip to 2,800 nautical miles, about 1,200 more than would have been required if permission had been granted.

The Navy and Air Force bombers were supported by tankers, Navy E2C command-and-control planes, EA6B electronic jamming aircraft as well as F14 and F18 fighters, defense officials said.

French officials in Paris said the French Embassy in Tripoli had also been hit, although it was unclear whether the damage came from the American bombing or from Libyan antiaircraft fire. In a White House briefing last night, Weinberger expressed skepticism that U.S. planes had caused the damage.

At The Hague, European Community foreign ministers "knew nothing at all" about last night's impending attack against Libya when they met yesterday to discuss joint action against Qaddafi, according to a Netherlands government spokesman.

The United States had approached British Prime Minister Margaret Thatcher last winter about using F111s based in Britain when the Joint Chiefs of Staff were drawing up contingency bombing plans to retaliate for the attacks at the Rome and Vienna airports on Dec. 27. She was cool to the idea at the time, U.S. military officials said.

Last night's raid is the first time the United States has bombed another country in an attempt to preempt acts of terrorism and culminates a long debate in the Reagan administration over how to combat terrorists.

Weinberger last night said the U.S. bombers had employed "smart" weapons that are guided to targets by laser beams, heat seekers and television cameras.

"Every effort has been made to limit collateral damage," Speakes said in discussing the raids against Tripoli and Benghazi. Collateral damage is a military term for incidental injuries to people or damage to structures near the targets.

The targets last night included the Azizyah Barracks, which White House officials said was one of Qaddafi's main command centers. Weinberger and other officials said the targets also included the military side of the Tripoli airport in an effort to keep Libyan fighters on the ground; the Sidi Bilal port facility, described as a training base for Libyan commandos; the Jamahiriyah Barracks in Benghazi, described as "an alternative command post" to the Tripoli command center, and the Benina military airfield for what the Pentagon called "military suppression purposes."

Weinberger said the F111s were assigned to targets around Tripoli while the Navy bombers struck targets near Benghazi. The Navy A6 and A7 bombers had tankers available to them for aerial refueling, but the carriers put the attackers within easy reach of Libya, military officials said.

The attack occurred three weeks after the March 24 military skirmish between the U.S. 6th Fleet and Libyan forces in the vicinity of the Gulf of Sidra. In that encounter, U.S. Navy bombers destroyed at least two Libyan patrol boats and also struck Libyan radar sites after several long-range missiles were fired at American aircraft.

The attack also came in the wake of the early morning bombing on April 5 of the La Belle nightclub in Berlin, where a U.S. Army sergeant and a Turkish woman were killed and more than 200 others injured. Last night, Reagan said the U.S. government has "conclusive" evidence that the bombing was on "direct order by the Libyan regime."

"Our evidence is direct, it is precise, it is irrefutable," Reagan said.

In addressing the selection of the targets for last night's raid, Speakes said, "These specific targets were chosen because they strike at the very heart of Qaddafi's ability to conduct terrorism. They were the very structure of Qaddafi's command and control. They were the infrastructure."

Senate Majority Leader Robert J. Dole (R-Kan.) said that John M. Poindexter, the White House national security affairs adviser, had informed the congressional leadership of plans for the attack two to three hours in advance.

"As Adm. Poindexter said, there would still be time to call off the strike if there was a substantial amount of opposition," Dole said. "There wasn't any opposition, although there was a feeling that they should have been consulted earlier."

In Europe, Vernon Walters, a senior diplomatic troubleshooter and Reagan's ambassador to the United Nations, was in Paris for meetings with President Francois Mitterrand and Premier Jacques Chirac, believed to be opponents of military action against Libya. Walters was also talking to officials in London and Rome in an effort to rally support for Reagan's anti-Qaddafi policy.

Shultz said last night that "all of our embassies are on alert, of course," because of evidence of Libyan plans to attack up to 30 U.S. embassies. Weinberger added that U.S. military installations around the world also are on "full alert."

Sen. Richard G. Lugar (R-Ind.), chairman of the Foreign Relations Committee, said after the meeting between congressional leaders and Reagan that "the strike indicates to Qaddafi that the United States will respond in appropriate and proportional ways to the indiscriminate violence of terrorism. Terrorism is unacceptable. That is the message we have sent tonight."

Shultz, when asked why the military had not acted sooner on warnings about a bombing attack in the West Berlin entertainment district frequented by American GIs, said "Berlin is a big place." Weinberger said the U.S. military came within 15 minutes of vacating the La Belle disco before the bomb went off.

The Central Intelligence Agency, officials said, has told government authorities that the warning about attacks in the entertainment district was given a low priority in the military traffic. Sen. Carl Levin (D-Mich.), a member of the Armed Services Committee, said yesterday he asked the Pentagon to give him a chronology of how the intelligence warning was dispatched and handled along the military chain of command.

The joint Navy-Air Force bombing strike had been in planning for months, with the discotheque bombing causing the Pentagon to update plans, including all-day sessions last weekend, military officials said.

The risk of a night raid was considered small because the Libyan air force seldom flies at night, Libyan SA5 antiaircraft missiles are ineffective against low-altitude bombing raids and Libyan antiaircraft guns could be suppressed by dropping cluster bombs just before the main waves of bombers flew to their targets. Weinberger said that none of the Libyan air force planes was able to take off last night against the American attackers.

Both the A6 and F11l bombers have elaborate electronic gear for precision night bombing, forward-looking infrared radar (FLIR) which etches the landscape by the heat objects give off at night. Weinberger said the targets were chosen to exploit those capabilities.

The Joint Chiefs of Staff started drawing up the target list that was used last night right after terrorist attacks on the Rome and Vienna airports, according to military sources. They recommended against hitting terrorist training bases at that time, sources said, partly because the satellite photos used in making the target folders were not enough to tell whether people unrelated to the terrorist group responsible for the airport attacks would be inside the tents and buildings.

The aircraft carriers steamed southward from Sicily toward Libya under cover of darkness Sunday night, sources said. An A6 loaded with bombs can easily fly 300 miles to the target and back to the carrier without having to refuel enroute.

Speakes, in speaking of the Berlin bombing, said of yesterday's raid, "In light of this reprehensible act of violence and and clear evidence that Libya is planning future attacks the United States has chosen to exercise its right of self defense. It is our hope this action will preempt and discourage Libyan attacks against innocent civilians in the future."

The attack came after weeks of growing tensions between the United States and Libya. Following the Rome and Vienna airport attacks in December, the administration launched in late March a "freedom of navigation" exercise in the Gulf of Sidra, challenging Qaddafi's claim to territorial waters there. That led to the brief, violent firefight three weeks ago.

Qaddafi vowed to strike back, and U.S. officials braced for another terrorist attack with increased security at American embassies and installations around the world. On April 2, a bomb exploded in the passenger cabin of a TWA jetliner, but U.S. officials expressed uncertainty about whether Libya was behind the attack.

In a news conference last week, Reagan called Qaddafi the "mad dog of the Middle East" and promised to retaliate if the evidence directly linked Libya to the bombing. Walters was then dispatched to Europe to share with the allies the evidence linking Qaddafi to the Berlin bombing, and Reagan met with his advisers to plan the retaliation.