Armed police were also responding to the earlier shooting of a policeman in the town of Carcassonne, 15 minutes drive away, which took place at around 11 am (1000 GMT).
It was unclear if the two incidents were linked.
In Trebes, a picturesque medieval town of around 5,000 people, the man "entered the Super U supermarket at around 11.15 am and shots were heard," a source said on condition of anonymity.
A witness reported he shouted "Allahu Akbar" (God is greatest) before going into the premises, the source added.
The gunman claimed allegiance to the Islamic State group, the local prosecutor’s office said, and the incident was being treated as a terror attack.
Local authorities tweeted that the area around the supermarket was off-limits to the public, while Prime Minister Edouard Philippe said it was a "serious" incident.
The shootings come with France still on high alert after a string of jihadist attacks since 2015, starting in January that year with the assault on satirical magazine Charlie Hebdo that left 12 people dead.
France also suffered major attacks in Paris in November 2015 when IS jihadists killed 130 people in bombings and shootings at bars, restaurants, the Bataclan concert venue and the national stadium.
In July 2016, in another attack claimed by IS, a man drove a truck through revellers celebrating Bastille Day in the Riviera resort of Nice, killing 84 people.
A state of emergency put in place just after the Paris attacks was finally lifted in October last year, but soldiers continue to patrol major tourist sites and transport hubs under an anti-terror mission.
If the link to Islamic State is confirmed, the hostage-taking would be the first deadly attack in France since October, when two young women were stabbed to death outside Marseille’s main train station.
Interior Minister Gerard Collomb was heading to the scene, he wrote on Twitter.
The area of southwest France where Friday’s shootings took place has been scarred by Islamic extremism before.
In 2012, Mohamed Merah shot dead seven people including three Jewish schoolchildren in the nearby city of Toulouse.