Ermey was convinced that the scenes in boot camp wouldn't be believable unless the actors were actually frightened of him. According to the commentary on the blu-ray, when he was acting as the technical adviser and training them to drill, or whatever he was training them to do, he never raised his voice. As soon as the camera was rolling, he started screaming at the actors. Much to Ermey's pleasure, the fear you see on the screen is real. Many times in the shooting the actors would become so flustered by Ermey that they would blow their lines. Ermey recalls that he's seen the other actors in the film around Hollywood from time to time, and they still won't speak to him.
R. Lee Ermey actually wrote all of Gunny Hartman's dialog himself. Ermey was involved in a serious car accident right before shooting, so Kubrick invited Ermey to come stay at his house in England to recover. While recovering Ermey read the script over and over, and he remarked that the Drill Instructor's dialog that was in the script was obviously the work of a screenwriter with a cliche imagination who obviously had no idea what boot camp was really like. So Kubrick allowed Ermey to re-write all of the dialog himself.
Many of the extras in the boot camp scenes were actually serving members in the British Territorial Army. They were chosen because it was assumed that they would be familiar with drill. However the English drill practices were so different from the American Marine corps practices that R. Lee Ermey himself had to re-train the British troops to march in Marine Fashion. Ermey said it was twice as much work trying to re-train them than it would have been just training raw recruits.
In some scenes, you can see that R. Lee Ermey does not move one of his arms. That's because he got in a car accident that broke several of his ribs. Being the strong person that he was, he forced himself to not pass out and wait for help to arrive.
The Vietnam scenes were shot in England, at the old disused British gas works in Beckton, East London. To the east of what is now London City Airport. Kubrick had full-grown palm trees planted for those scenes.
According to Ermey, during the shooting of the scene in the head where Pyle kills Hartman, Ermey walked in wearing his Drill Instructor Smokey cover. Kubrick immediately called a cut, and said that it didn't make any sense for a Drill Instructor to still be wearing his Smokey in the middle of the night, while he's in his underwear. Ermey had to inform Kubrick that a D.I. always has his smokey on, as it's his symbol of authority. Anyone who's ever been in the Marines knows that the D.I's Smokey is basically part of their head. The only time you actually see Hartman without his Smokey is when he's dead.
R. Lee Ermey was given his role after he took it upon himself to interview the extras as Gunnery Sergeant Hartman. Having been a Marine Drill Instructor, he was the technical adviser and it was up to him to interview background extras to be Marine recruits for the movie, and so he donned the DI uniform and the familiar Brown Round, lined up the extras the same way they would be at reception on Parris Island, and interviewed them as a Marine DI. The entire time he had Leon Vitali, Kubrick's right hand man, recording it, and the very next day Stanley called Ermey to say he needed him to be DI Hartman.