To create the file. htpasswd file, simply run the command
# htpasswd -c /path/to/.htpasswd user
The htpasswd command is present in the bin directory of Apache, the -c option creates the file, note that you must specify the user name and password to the application.
The file is created by the command, from there restart Apache.