Creating a password protected YUM repository

Setup http authentication in httpd.conf file (encouraged rather than using .htaccess):

<Directory /var/www/repo>
AuthType Basic
AuthName "Password Required"
AuthUserFile /etc/apache2/passwords/repo
Require valid-user
</Directory>

Create auth user password file:

htpasswd -c /etc/apache2/passwords/repo repouser

Restart apache.
Create repo:

yum install createrepo # or equivalent
mkdir /var/www/repo
cp *.rpm /var/www/repo
createrepo /var/www/repo

To use the repo, on the [...]