From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page Webapp-config and the translation is 33% complete.
Other languages:

Warning: Display title "webapp-config/ja" overrides earlier display title "webapp-config".


webapp-config は Gentoo の Web ベースのアプリケーション用インストーラ です。仮想ホスティング環境でのウェブアプリケーションの自動セットアップに使用されます。元々はbashスクリプトとして書かれていましたが、webapp-configはPythonベースになり、Gentooのebuildリポジトリで利用可能になりました。


webapp-config は、ウェブサーバ管理者が同一の IP アドレスで複数のウェブサイトを実行する (仮想ホスティング) のに必要なパッケージ管理機能を提供することを目的としています。

Two-stage install

RPMやPortageなどのパッケージマネージャーは、パッケージの1つのコピーをインストールし、それを固定の場所にインストールするように設計されています。 これは、管理者が1つのパッケージを複数の場所にインストールして、複数のWebサイトの一部にすることができる仮想ホスティング環境のニーズと競合します。 そうは言っても、パッケージマネージャーはオペレーティングシステムを長期にわたって維持するために不可欠です。どのようにして両方の長所を活かすことができるのでしょうか。

The answer is a two-stage install. The traditional package manager installs a master copy into /usr/share/webapps/ This master copy is not fit to run - but it is ready to be used by the webapp-config utility to install a single package multiple times in multiple places.

Multiple installations of the same package

webapp-config allows the administrator to install multiple copies of the same package on the same system at the same time. The administrator decides which directories to install each copy into.

In the web application world, these multiple installations are called "virtual copies".

同じパッケージの異なるバージョンを同じシステムに同時にインストールできます。 これにより、Web管理者はサイト間でパッケージの新しいバージョンを段階的に展開できます。 すべてのサイトを一度にアップグレードする必要はありません。

webapp-configは、複製されるファイルの数を最小限に抑えます。 これにより、ディスク領域の使用率が低く抑えられます。 ファイルの大部分はマスターコピーにハードリンクされています。 構成ファイルと、パッケージが書き込む必要のあるファイルのみがバーチャルコピーにコピーされます。


手作業でWebベースのアプリケーションをインストールすることに慣れている管理者は、適切なユーザーが適切な権限ですべてのファイルを所有するのが面倒な場合があることを知っています。 一部のファイルは、Webサーバーを実行しているユーザーが所有する必要があります。 他のユーザーは特定のシェルアカウントに所有されている必要があるため、これらのユーザーはログインして構成ファイルを編集できます。 LinuxディストリビューションがWebサーバーの選択肢を提供している場合(それぞれが異なるユーザーで実行されている場合)、インストーラーさえそれを正しく取得するのに苦労する可能性があります。

webapp-configを使用すると、管理者はインストーラに、使用するWebサーバーと、構成ファイルを編集するために必要なシェルアカウントを指示します。 次に、webapp-configは、正しい所有権と権限でファイルをインストールします。

Protected configuration files

webapp-config automatically ensures that configuration files are never overwritten during an upgrade - even if the files have not been edited since the original installation. Additionally, webapp-config will never overwrite any file that it did not install, or that has been changed since it was installed by webapp-config. webapp-config uses MD5 check sums to determine whether a file has been changed or not. In the case of symbolic links, webapp-config will not replace a symlink that points to a different file.

When an upgrade does attempt to overwrite a protected file, webapp-config creates a ._cfg file with the new file inside. etc-update can be used to complete the install, just as a regular emerge.

File copying options

A virtual copy is built mostly by creating hard links to files under /usr/share/webapps. If a hard link cannot be created, the file is copied from /usr/share/webapps instead.

Hard links can only be created to files on the same file system. If /usr/share/webapps and /var/www on kept on different file systems, webapp-config cannot use hard links, and will be forced to copy the files instead.

There are three ways to get around the hard link problem.

The easiest way is to make /usr/share/webapps a symlink to a directory under /var/www. For most administrators, this will ensure that everything is on the same file system.

However, if the hosted websites are kept on separate file systems, then webapp-config is never going to be able to hard-link files.

As an alternative the --soft command-line option can be used. This tells webapp-config to create symbolic links instead of hard links. Symbolic links work across file systems.

The problem with using symbolic links is that some packages do not work when the virtual copy is made from symbolic links. Many users, and system administrators alas, have also complained that they find directories full of symbolic links confusing. For these reasons, symbolic links are not used by default in webapp-config any more.

The --copy command-line option can also be chosen. This particular switch tells webapp-config to directly copy the files from /usr/share/webapps/ instead of hard links. Copying directly works across file systems with the drawback of using more space. This may be desired instead of relying on symbolic links in order to separate the virtualhost files, which admins can then modify, and files in /usr/share/webapps/.

Virtual file voodoo

By default, the master copy contains the metadata that decides which files get linked into a virtual copy and which files do not. Files are either owned by the web server (server-owned), are configuration files (config-owned), or are linked in (virtual). Directories can be server-owned or config-owned, but most of the time they need to be just plain directories (default-owned) created inside the installation directory (set with the -d option). webapp-config provides a number of switches which allows for overriding the master copy's metadata - in the case the overriding is ever needed.

The --default-dirs and --virtual-files switches allow the administrator to decide what webapp-config will do if (respectively) a directory or a file is marked as being default or virtual. webapp-config can be instructed to make the directory or file any of the other choices - server-owned or config-owned - instead.


webapp-config is intended to fully support ${ROOT}. For administrators unsure what that means see the emerge man page (man emerge).


Using the vhost USE flag webapp-config is capable of managing the following applications:

Application Package Homepage Description
ampache www-apps/ampache http://www.ampache.org/ Ampache is a PHP-based tool for managing, updating and playing audio files via a web interface.
b2evolution www-apps/b2evolution http://www.b2evolution.net Multilingual multiuser multi-blog engine.
Bugzilla www-apps/bugzilla http://www.bugzilla.org Bugzilla is the Bug-Tracking System from the Mozilla project.
cgit www-apps/cgit http://git.zx2c4.com/cgit/about A fast web-interface for git repositories.
coppermine www-apps/coppermine http://coppermine.sourceforge.net/ Web picture gallery written in PHP with a MySQL backend.
cvsweb www-apps/cvsweb http://www.freebsd.org/projects/cvsweb.html WWW interface to a CVS tree
dokuwiki www-apps/dokuwiki http://wiki.splitbrain.org/wiki:dokuwiki DokuWiki is a simple to use Wiki aimed at a small company's documentation needs.
dragonflycms www-apps/dragonflycms http://dragonflycms.org A feature-rich open source content management system based off of PHP-Nuke 6.5
Drupal www-apps/drupal http://drupal.org/ PHP-based open-source platform and content management system.
egroupware www-apps/egroupware http://www.egroupware.org/ Web-based GroupWare suite.
eyeos www-apps/eyeos http://www.eyeos.org AJAX web-based desktop environment.
groupoffice www-apps/groupoffice http://group-office.sourceforge.net/ Group-Office is a powerful modular Intranet application framework.
Joomla www-apps/joomla http://www.joomla.org/ Joomla is a powerful Open Source Content Management System.
mantisbt www-apps/mantisbt http://www.mantisbt.org/ PHP/MySQL/Web based bugtracking system.
MediaWiki www-apps/mediawiki http://www.mediawiki.org The MediaWiki wiki web application (as used on wikipedia.org).
mirmon www-apps/mirmon http://people.cs.uu.nl/henkp/mirmon/ Simple webapp to monitor the status of mirrors.
Moodle www-apps/moodle http://moodle.org The Moodle Course Management System.
mythweb www-apps/mythweb http://www.mythtv.org PHP scripts intended to manage MythTV from a web browser.
Nextcloud www-apps/nextcloud https://nextcloud.com/ Web-based personal cloud that runs on your own server.
otrs www-apps/otrs http://otrs.org/ OTRS is an Open source Ticket Request System.
Owncloud www-apps/owncloud http://owncloud.org Web-based storage application where all your data is under your own control.
phpBB www-apps/phpBB http://www.phpbb.com/ phpBB is an open-source bulletin board package.
phpmp www-apps/phpmp http://www.musicpd.org/ phpMp is a client program for Music Player Daemon (mpd).
phpsysinfo www-apps/phpsysinfo http://rk4an.github.com/phpsysinfo/ phpSysInfo is a nice package that will display your system stats via PHP.
postfixadmin www-apps/postfixadmin http://postfixadmin.sourceforge.net Web Based Management tool for Postfix style virtual domains and users.
rutorrent www-apps/rutorrent https://github.com/Novik/ruTorrent ruTorrent is a front-end for the popular Bittorrent client rTorrent.
trac www-apps/trac http://trac.edgewall.com/ Trac is a minimalistic web-based project management, wiki and bug/issue tracking system.
tt-rss www-apps/tt-rss http://tt-rss.org/ Tiny Tiny RSS - A web-based news feed (RSS/Atom) aggregator using AJAX.
venus www-apps/venus http://intertwingly.net/code/venus/ A feed aggregator application.
viewvc www-apps/viewvc http://viewvc.org/ ViewVC, a web interface to CVS and Subversion.
wiliki www-apps/wiliki http://practical-scheme.net/wiliki/ WiLiKi is a lightweight Wiki engine written in and running on Gauche Scheme.
WordPress www-apps/wordpress http://wordpress.org/ Wordpress php and mysql based content management system (CMS).


USE フラグ

USE flags for app-admin/webapp-config Gentoo's installer for web-based applications

portage Propagate python_targets dependencies to sys-apps/portage


Install webapp-config:

root #emerge --ask app-admin/webapp-config


Web server setup


If a web server has not been set up previous to this step in the webapp-config process, do so before continuing to proceed through this article. Visit the links referenced above to install and configure the web server. Once the web server has been set up return to this article

Edit the following line in the /etc/vhosts/webapp-config file to set a web server. This example would be the correct modification to make if lighttpd (www-servers/lighttpd) was the web server of choice:

ファイル /etc/vhosts/webapp-configSetting webapp-config's web server preference



-I, --install
Activate install mode.
-U, --upgrade
Activate upgrade mode.
-C, --clean
Activate remove mode.


For the following examples Owncloud will be used as the web application. Owncloud can be substituted with any of the applications listed in the table above.
Replace the <version> placeholder with the web application version to action upon.

To install a webapp:

root #webapp-config -I owncloud <version>

To list installed webapps:

root #webapp-config --list-installs

To show installed webapps:

root #webapp-config --show-installed

To update a previously installed webapp:

root #webapp-config -U owncloud <version>

To remove an installed webapp:

root #webapp-config -C owncloud <version>


Ghost installs

Entries still exist when running webapp-config --list-installs when the files in /var/www/ directory have been deleted.

The trouble probably was generated from an improper deletion of a webapp. If the files in /var/www/ are manually deleted then the webapp-config program can become confused. Uninstalls should be managed by running webapp-config -C <application_name> <application_version>.

Uninstall webapp-config:

root #emerge --depclean --verbose app-admin/webapp-config

Once removed, delete any left over installation files that may be found in the /var/db/webapps/ directory.

root #rm -rf /var/db/webapps/

Reinstall webapp-config and run the command with the --list-installs. All ghost installs should be gone.