Title:/srv - Services Home Directory Support
Last-Modified:2004/11/11 21:35:53
Author:Stuart Herbert <stuart at>, Rob Holland <tigger at>
Type:Standards Track
Post-History:21-Feb-2004, 11-Nov-2004


Thanks To

Thanks to Robin H. Johnson ( for his assistance in writing this GLEP.


This GLEP proposes a new root-level directory - /srv - as an optional home for the data (and sometimes the software too) for software that provides services.

/srv will be supported via a USE flag. This gives users the choice of using a dedicated service home hierarchy or not.

/srv is defined in FHS 2.3, which is part of the upcoming LSB v2.0 release (


Gentoo currently does not provide sufficiently flexible support for sites which wish to consolidate the data for their service-orientated software under one simple, easy to administer, location.

Adding optional support for the /srv directory structure will give sites increased flexibility on how to layout their machines.


A new global USE flag - srvdir - will be added to Portage.

Ebuilds that choose to support the srvdir USE flag will configure the package to install and use their data under the /srv directory.

Ebuilds that choose to support the srvdir USE flag - and which install packages that need write access to the same directories that the software is installed into - will configure the package to install the software under the /srv directory.

All packages configured to support the srvdir USE flag will support this breakdown of /srv:

/srv/<fqdn>/<service>/<service-specific tree>
<fqdn> is the fully-qualified domain name <service> is the name of the service <service-specific tree> is unique to the package

Ebuilds that install anything into /srv will install into /srv/localhost. /srv/localhost - or any of the <service> directories underneath it - may be symlinks created by the local administrator.


For example, backup packages which support the srvdir USE flag could save backup data under the /srv/<hostname>/backups directory for each host on the network that they perform backups for.

For example, web-based applications which support the srvdir USE flag could install their software under the /srv/localhost/www/htdocs directory. Ebuilds for web-based applications which also support the vhost USE flag will allow the user to install software under other service domains through the webapp-config package. See GLEP #11 and the vhost-config tool for more information on how this works.

There are many other packages that could support the srvdir USE flag - including Portage itself.

For packages that do not support the srvdir USE flag, there is currently no recommended default location to use - although /var/localhost may prove a useful alternative.


Introducing optional support for the /srv directory will benefit a number of groups of Gentoo users.

The Gentoo Philosophy clearly states that Gentoo Linux will be a highly-configurable meta-distribution. Adding optional support for /srv is very much in keeping with our Philosophy.


A new USE flag - srvdir - will be added to Portage.

Ebuilds and eclasses will choose to support the srvdir USE flag or not on an individual basis.

(Author's note: If this GLEP is approved, all web-based applications will support the srvdir USE flag through the work being carried out under GLEP #11)

There has been some debate about whether the /srv directory should be provided by the basesystem package or not. Because this support is optional, and because different sites will have different storage requirements, we believe that it should be left to the local Gentoo system administrator to manually create the /srv directory.

If baselayout feels that it must install a /srv, then we propose that baselayout installs /srv as a symlink to /var/srv. This approach will support installations that mount the root filesystem read-only.

Backwards Compatibility

Users who choose not to use the new srvdir USE flag will see little to no change. It is likely that some ebuilds will change their non-srvdir directory layout to reduce the amount of effort required to support both options.


This document is licensed under the Creative Commons - Attribution / Share Alike license. (