Tuesday, November 15, 2011

How to protect a web page with htaccess with a password

  1. Create a .htpasswd file:
    $ htpasswd -c .htpasswd <username>
  2. Create or add these lines to .htaccess file:
    • To protect a directory:
      AuthUserFile /full/path/to/.htpasswd
      AuthType Basic
      AuthName "Protected Folder"
      Require valid-user
    • To protect a file:
      AuthUserFile /full/path/to/.htpasswd
      AuthType Basic
      AuthName "Protected Page"
      <Files "protected_page.html">
        Require valid-user

Sunday, November 13, 2011

Linux Yum commands

Display available updates for installed software
$ yum list updates
Apply updates
$ yum update 
List installed packages
$ yum list installed <package-name>
# e.g.
$ yum list installed httpd
$ rpm -qa | grep httpd*

Check for and update a package
$ yum update <package-name>

Search a package or list all
$ yum list <package-name/regex/wildcard>
$ yum list all

# list group packages
$ yum grouplist

Install a package
$ yum install <package-name>

Remove/Uninstall a package
$ yum remove <package-name>

Install/Update group packages
$ yum groupinstall "Development Tools"
$ yum groupupdate "Development Tools"

List packages that are not official RHN
$ yum list extras

Find out which package is a file from
$ yum whatprovides <filename>