Sunday, September 21, 2014

Install Apache in Gentoo by emerge

My experience of installing Apache in Gentoo by emerge.

By emerge to install apache in gentoo is very straightforward, just "emerge --ask apache" and done.
But the default, there is no any mod_auth_digest.so.

lets build mod_auth_digest.so for apache.

localhost ~ # emerge -pv apache

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] www-servers/apache-2.2.27-r4:2  USE="ssl -debug -doc -ldap (-selinux) -static -suexec -threads" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias -asis -auth_digest -authn_dbd -cern_meta -charset_lite -dbd -dumpio -ident -imagemap -log_forensic -proxy -proxy_ajp -proxy_balancer -proxy_connect -proxy_ftp -proxy_http -proxy_scgi -reqtimeout -substitute -version" APACHE2_MPMS="-event -itk -peruser -prefork -worker" 0 kB

Total: 1 package (1 reinstall), Size of downloads: 0 kB

 * IMPORTANT: 5 news items need reading for repository 'gentoo'.
 * Use eselect news to read news items.


From the output of "emerge -pv apache", the "-auth_digest" means the auth_digest is not enable.
So a way to enable it is,

in /etc/portage/make.conf, add

APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias auth_digest"

Lets check again.

[Check 1]
localhost ~ # emerge --ask apache

 * IMPORTANT: 5 news items need reading for repository 'gentoo'.
 * Use eselect news to read news items.


These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] www-servers/apache-2.2.27-r4  APACHE2_MODULES="auth_digest*"

[Check 2]
localhost ~ # emerge -pv apache

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] www-servers/apache-2.2.27-r4:2  USE="ssl -debug -doc -ldap (-selinux) -static -suexec -threads" APACHE2_MODULES="actions alias auth_basic auth_digest* authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias -asis -authn_dbd -cern_meta -charset_lite -dbd -dumpio -ident -imagemap -log_forensic -proxy -proxy_ajp -proxy_balancer -proxy_connect -proxy_ftp -proxy_http -proxy_scgi -reqtimeout -substitute -version" APACHE2_MPMS="-event -itk -peruser -prefork -worker" 0 kB

Total: 1 package (1 reinstall), Size of downloads: 0 kB

 * IMPORTANT: 5 news items need reading for repository 'gentoo'.
 * Use eselect news to read news items.

Lets run "emerge --ask apache" again, and the result is like

localhost ~ # ls /usr/lib/apache2/modules/
libphp5.so          mod_authn_anon.so     mod_authz_groupfile.so  mod_cgi.so       mod_dir.so         mod_filter.so      mod_mem_cache.so    mod_speling.so    mod_vhost_alias.so
mod_actions.so      mod_authn_dbm.so      mod_authz_host.so       mod_cgid.so      mod_disk_cache.so  mod_headers.so     mod_mime.so         mod_ssl.so
mod_alias.so        mod_authn_default.so  mod_authz_owner.so      mod_dav.so       mod_env.so         mod_include.so     mod_mime_magic.so   mod_status.so
mod_auth_basic.so   mod_authn_file.so     mod_authz_user.so       mod_dav_fs.so    mod_expires.so     mod_info.so        mod_negotiation.so  mod_unique_id.so
mod_auth_digest.so  mod_authz_dbm.so      mod_autoindex.so        mod_dav_lock.so  mod_ext_filter.so  mod_log_config.so  mod_rewrite.so      mod_userdir.so
mod_authn_alias.so  mod_authz_default.so  mod_cache.so            mod_deflate.so   mod_file_cache.so  mod_logio.so       mod_setenvif.so     mod_usertrack.so

So there is mod_auth_basic.so built.
But this is not enough.

in /etc/conf.d/apache2, add
...
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE -D AUTH_DIGEST"
...

This setting will affect /etc/apache2/httpd.conf to load mod_auth_digest.so

in /etc/apache2/httpd.conf
...
LoadModule auth_digest_module modules/mod_auth_digest.so
...

No comments: