Installing mod_dav on a Red Hat 7.0 Apache Web Server

by Charlton Rose

WebDAV, or the Web-based Distributed Authoring and Versioning protocol, is a relatively new technology that allows users to update their web sites using HTTP requests; it is a classy alternative to FTP and is similar to Microsoft FrontPage. Many modern web site development tools, and most of the new ones, support WebDAV.

Configuring your Red Hat 7.0 Apache web server to support WebDAV is not a trivial task; the documentation available on the WebDAV web site (webdav.org) offers very little help when it comes to installing and configuring this software, and is sometimes even misleading.

This document contains a quick-and-dirty summary of the installation steps that were necessary to get mod_dav running on my Apache server. These steps worked on my Red Hat 7.0 Apache web server; they may require adaptation to your particular configuration. This document is written as a personal reference, and published in the hope that it might be useful to others.

Step 0 -- Verify the givens.

The following steps assume that you have already installed Red Hat Linux 7.0 and that you chose "Install Everything" when you installed it. It is also assumed that your Apache web server is configured correctly, running beautifully, and that you have not tweaked your configuration too much.

It is also assumed that you have root access to the machine you are configuring and that you will perform all of the following steps as root.

If any of these assumptions are not true for you, you should fix the problem(s) before continuing. Visit LinuxDocs.org for additional help on these topics.

Step 1 -- Obtain the mod_dav sources.

There are some RPMs floating around for mod_dav. You might be tempted to use them for easy installation. Don't do it! Things will not work as expected. You should obtain the sources and compile them yourself.

You can always download the latest version of mod_dav from WebDAV.org. However, if you want to use the same version as me, you can download my archived copy.

Step 2 -- Build and install the mod_dav binaries.

Assuming you have downloaded my copy of mod_dav and that you are running a shell in the directory where you saved it, type the following:

tar xzf mod_dav-1.0.2-1.3.6.tar.gz
cd mod_dav-1.0.2-1.3.6
./configure
make
make install

Look for funny errors while executing these steps. If you get one, you are on your own. A couple of warnings may occur. Just ignore them.

Step 3 -- Edit httpd.conf.

Add the following line to the global section of your Apache configuration file (httpd.conf):

DAVLockDB /var/www/mod_dav/DAVLock

Add the following lines to the global section of your Apache configuration file or into any of your virtual host sections, depending on your needs.

<Location />
	DAV On
	<LimitExcept GET HEAD OPTIONS>
		AuthName "WebDAV access"
		AuthType basic
		AuthUserFile /var/www/mod_dav/.htpasswd
		require user webdav_user
	</LimitExcept>
</Location>

Save your changes but do not restart Apache at this time.

Step 4 -- Create lock directory.

Type the following commands:

cd /var/www
mkdir mod_dav
chown apache.apache mod_dav

Step 5 -- Set password.

Again, type the following:

cd /var/www/mod_dav
htpasswd -cb .htaccess webdav_user webdav_password

(Replace webdav_password with your desired password.)

Step 6 -- Give Apache permission to modify your web folders.

Change into the directory containing your web pages. (If you want to use WebDAV only with a certain subdirectory, change into that instead.) Then type the following:

chgrp -R apache .
chmod -R g+rwX .
find . -type d -exec chmod g+s {} ";"

Verify the permissions on the files to make sure they are the way you want them. The above commands, if executed blindly, will give Apache permission to modify or delete any existing file or subdirectory, recursively, in the current directory. This may not be exactly what you want. Modify the permissions to suite your needs.

Remember, in Red Hat 7.0, Apache runs as user apache and as group apache.

Step 7 -- Restart Apache.

That should be it. Restart Apache by typing the following:

/etc/init.d/httpd restart

And you should be good to go! Use Internet Explorer 5 in Windows 98, web folders in Windows 2000, cadaver in Unix, or any other WebDAV client to test your installation. I hope it worked for you!

Copyright © 2000 Sharkysoft. All rights reserved.

[ Sharkysoft home | more Linux tips ]