自宅サーバの OS を更新したとき,Apache2 を起動させるのに手間取った。現在はなんとか動いている。そのまとめ。
■ ■ ■
自宅サーバの OS を更新した際 (nlog(n): サーバの OS を Vine Linux 4.2 から 6.2 へ更新),一番初めに動いて欲しい Apache2 がなかなか起動しなかった。エラーをひとつづくクリアしていった過程をまとめておく。
動作環境は Apache 2.2.27 (旧環境は 2.2.3), PHP 5.5.17 (旧 5.2.9), OpenSSL 1.0.0o (旧 0.9.7l), 文字コード UTF-8 (旧 EUC-JP) である。
FastCGI
Apache を起動させようとするとエラーが出る。
# /etc/init.d/apache2 start
Apache2 HTTP Serverを起動中: apache2: Syntax error on line 213 of /etc/apache2/conf/apache2.conf: Syntax error on line 2 of /etc/apache2/conf.d/mod_fcgid.conf: Cannot load /etc/apache2/modules/mod_fcgid.so into server: /etc/apache2/modules/mod_fcgid.so: cannot open shared object file: No such file or directory
[ 失敗 ]
FastCGI のモジュールが入っていないからである。パッケージで導入する。
# apt-get install fcgi mod_fcgid-apache2
FastCGI に関してはこれで完了。
PHP
そして Apache を起動させようとすると,またエラーが出る。
# /etc/init.d/apache2 start
Apache2 HTTP Serverを起動中: apache2: Syntax error on line 213 of /etc/apache2/conf/apache2.conf: Syntax error on line 3 of /etc/apache2/conf.d/php5.conf: Cannot load /etc/apache2/modules/libphp5.so into server: /etc/apache2/modules/libphp5.so: cannot open shared object file: No such file or directory
[ 失敗 ]
PHP がインストールされていないという。これもパッケージでインストール。しかし…。
# apt-get install php5
Reading Package Lists... Done
Building Dependency Tree... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or that some of the repositories
in use are in an inconsistent state at the moment.
Since you only requested a single operation it is extremely likely that
the package is simply not installable and a bug report against
that package should be filed.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
device-mapper-libs: Obsoletes: device-mapper (< 1.02.30-1)
glibc-kernheaders: Obsoletes: kernel-headers
kernel-headers: Obsoletes: glibc-kernheaders
libFS: Obsoletes: XOrg-libs
libICE: Obsoletes: XOrg-libs
libSM: Obsoletes: XOrg-libs
libX11: Obsoletes: XOrg-libs
libXScrnSaver: Obsoletes: XOrg-libs
libXTrap: Obsoletes: XOrg-libs
libXau: Obsoletes: XOrg-libs
libXaw: Obsoletes: XOrg-libs
libXdamage: Obsoletes: XOrg-libs
libXdmcp: Obsoletes: XOrg-libs
libXext: Obsoletes: XOrg-libs
libXfixes: Obsoletes: XOrg-libs
libXrandr: Obsoletes: XOrg-libs
libXxf86vm: Obsoletes: XOrg-libs
libexpat1: Obsoletes: libexpat (< 2.0.0)
libutempter: Obsoletes: utempter
php5: Depends: libcurl.so.4
E: Broken packages
パッケージの依存関係に問題があるらしく「E: Broken packages」とやらで終了してしまい,インストールできない。apt-get update; apt-get upgrade しても改善が見られないので,dist-upgrade してみる。
# apt-get dist-upgrade
Reading Package Lists... Done
Building Dependency Tree... Done
Calculating Upgrade... Done
The following packages will be upgraded
GConf2 ImageMagick ImageMagick-devel MAKEDEV MySQL-client MySQL-devel MySQL-server
ORBit2 TrueType-sazanami acpid alsa-lib alternatives anacron anthy apache2
apache2-devel apache2-manual apr apr-devel apr-util apr-util-devel apt aspell at atk
audiofile authconfig autoconf autofs automake avahi avahi-glib basesystem bash bc
bcm43xx-fwcutter beecrypt binutils bzip2 cairo checkinstall chkconfig chkfontpath
coreutils cpio cpuspeed cracklib cracklib-dicts crontabs cups cups-libs curl
cyrus-sasl cyrus-sasl-devel cyrus-sasl-md5 db4 db4-devel dbus dbus-glib dbus-python
device-mapper dhcpcd diffutils docbook-dtds dosfstools dump e2fsprogs ed eject eog
etcskel expat expat-devel file filesystem findutils foomatic freetype freetype2
ftdumps ftp gamin gawk gc gcc gcc-cpp gd gd-devel gdbm gettext ghostscript
ghostscript-fonts gksu glib glib2 glibc glibc-common glibc-devel gmp gnome-desktop
gnome-desktop-libs gnome-keyring gnome-menus gnome-mime-data gnome-vfs2 gnupg gpm-libs
grep groff grub gtk2 gzip hal hdparm hibernate hicolor-icon-theme hwdata initscripts
install-info intltool iproute iputils ipw2100-firmware ipw2200-firmware
ipw3945-firmware ipw3945d irb irqbalance java-1.6.0-sun java-1.6.0-sun-alsa
java-1.6.0-sun-fonts java-1.6.0-sun-jdbc java-1.6.0-sun-plugin jed jman_pages
jpackage-utils kasumi kernel-doc kudzu lcms less lftp lha libIDL libart_lgpl libbonobo
libbonoboui libc-client libcap libdaemon libevent libexif libexpat libglade2 libgnome
libgnomecanvas libgnomecups libgnomeprint libgnomeprintui libgnomeui libidn
libnfsidmap libpng librsvg2 libruby libtiff libtool libtool-ltdl libusb libuser libxml
libxml2 libxml2-devel libxml2-python libxslt libxslt-devel logrotate lv lvm2 lzo
lzo-devel m4 madwifi mailcap mailx make man-pages mdadm mecab mecab-devel mecab-ipadic
mingetty mkinitrd mktcapdir mod_perl2 mod_ssl-apache2 mpage mtools nautilus ncurses
ndiswrapper neon net-tools newt nkf nscd nss_ldap ntsysv openjade openldap
openldap-devel openssh openssh-clients openssh-server openssl openssl-devel openvpn
pam pango passwd patch pcre perl perl-CGI-Session perl-DBD-MySQL perl-DBD-Pg perl-DBI
perl-FreezeThaw perl-GD perl-HTML-Parser perl-HTML-Tagset perl-MailTools
perl-Parse-Yapp perl-String-CRC32 perl-URI perl-XML-Dumper perl-XML-Encoding
perl-XML-Parser perl-XML-Simple perl-libwww-perl perl-libxml-enno perl-libxml-perl
php5 php5-apache2 php5-devel php5-imap php5-mysql php5-pdo php5-pear pkgconfig popt
postfix postgresql-libs procmail procps psmisc pump pwdb pygtk2 pygtk2-libglade python
pyxf86config rdoc readline reiserfsprogs rhpl rmt rootfiles rpm rpm-build rpm-libs
rsync ruby ruby-devel samba samba-common scim scim-anthy scim-bridge scim-bridge-gtk
sed setup setuptool sgml-common shadow-utils shared-mime-info slang slocate sqlite3
sqlite3-devel startup-notification sudo synaptic sysklogd system-tools-backends tar
tcp_wrappers tcsh telnet time tmpwatch traceroute udev unzip urw-fonts usermode
util-linux vim vim-common vim-man vine-backgrounds vine-keyring vine-logos vine-menus
vine-release vixie-cron vte vutils w3m webalizer wget which wireless-tools words
xinetd xml-common yp-tools ypbind zip zlib zlib-devel
The following packages will be REPLACED:
ImageMagick-perl (by perl-Image-Magick) MySQL-shared (by libmysqlclient16) SysVinit
(by upstart) Vine-manual (by vine-rescue-guide, vine-manual-base) XOrg (by
task-xorg-x11, xorg-x11-xinit, xorg-x11-server-Xorg, xorg-x11-xauth,
xorg-x11-resutils, xorg-x11-drivers, xorg-x11-apps) XOrg-base-fonts (by
xorg-x11-fonts-misc) XOrg-font-utils (by xorg-x11-font-utils, fontconfig) XOrg-gl
(by xorg-x11-libs, mesa-libGLU, mesa-libGL) XOrg-libs (by libXfont, xorg-x11-libs,
libfontenc, libdmx, libXxf86vm, libXxf86misc, libXxf86dga, libXvMC, libXv, libXtst,
libXt, libXres, libXrender, libXrandr, libXpm, libXp, libXmu, libXinerama, libXi,
libXft, libXfontcache, libXfixes, libXext, libXevie, libXdmcp, libXdamage, libXcursor,
libXcomposite, libXaw, libXau, libXTrap, libXScrnSaver, libX11, libSM, libICE, libFS,
fontconfig) XOrg-xfs (by xorg-x11-xfs) ash (by dash-static) bind-libs (by
bind-current-libs) bind-utils (by bind-current-utils) console-tools (by kbd) eel2
(by nautilus) esound (by pulseaudio-esound-compat) foomatic-ppd (by foomatic)
foomatic-ppd-gimp-print-ijs (by foomatic) freetype-utils (by freetype,
freetype2-demos) gail (by gtk2) gimp-print (by gutenprint-foomatic)
glibc-kernheaders (by kernel-headers) hpijs (by hplip) jed-common (by jed)
kbdconfig (by system-config-keyboard) libjpeg (by libjpeg-turbo) libungif (by
giflib) man (by man-db) mktemp (by coreutils) modutils (by module-init-tools)
perl-Compress-Zlib (by perl) perl-DateManip (by perl-Date-Manip) php5-sqlite (by
php5) portmap (by rpcbind) samba-libsmbclient (by libsmbclient) scrollkeeper (by
rarian-compat) suspend2-userui (by tuxonice-userui) suspend2-userui-fbsplash (by
tuxonice-userui-usplash) utempter (by libutempter)
The following packages will be REMOVED:
Xconfigurator apache gnome-cups-manager libxml-devel mod_ssl mouseconfig qpopper
The following NEW packages will be installed:
ConsoleKit ConsoleKit-libs ConsoleKit-x11 MySQL-embedded NetworkManager-glib
OpenEXR-libs SysVinit-tools TrueType-hanaminplus TrueType-ipafont-doc
TrueType-ipafont-mincho TrueType-sazanami-gothic TrueType-sazanami-mincho
TrueType-vlgothic WebKit-gtk acl apt-sourceslist-main apt-sourceslist-plus audit-libs
authconfig-gtk avahi-tools avahi-ui bind-current-libs bind-current-utils
build-essential ca-certificates cdparanoia control-center cyrus-sasl-plain dash-static
db4-cxx db4-utils dbus-x11 desktop-file-utils device-mapper-event
device-mapper-event-libs device-mapper-libs dhclient dmraid e2fsprogs-devel elfutils
elfutils-libelf elfutils-libs enchant ethtool evolution-data-server firstboot
firstboot-tui fontconfig freeglut freetype2-demos fuse gcc-c++ gd21 gdk-pixbuf2 gdm
geoclue gettext-devel gettext-libs giflib glew glibc-headers glx-utils
gnome-disk-utility-libs gnome-doc-utils gnome-icon-theme gnome-keyring-pam
gnome-panel-libs gnome-python gnome-session gnome-settings-daemon gnutls
gobject-introspection graphviz grubby gstreamer gstreamer-plugins-base gutenprint
gutenprint-foomatic gvfs gvfs-archive gvfs-fuse gvfs-gphoto2 gvfs-smb hal-info hplip
hplip-libs ilmbase iptables iso-codes isomd5sum jasper-libs js kbd kernel#2.6.35-21vl6
kernel-headers keyutils-libs keyutils-libs-devel krb5-devel krb5-libs libFS libICE
libICE-devel libSM libSM-devel libX11 libX11-devel libXScrnSaver libXTrap libXau
libXau-devel libXaw libXaw-compat libXcomposite libXcursor libXdamage libXdamage-devel
libXdmcp libXdmcp-devel libXevie libXext libXext-devel libXfixes libXfixes-devel
libXfont libXfontcache libXft libXi libXinerama libXmu libXp libXpm libXrandr
libXrender libXres libXt libXt-devel libXtst libXv libXvMC libXxf86dga libXxf86misc
libXxf86vm libXxf86vm-devel libacl libarchive libasyncns libatasmart libattr libblkid
libcanberra libcanberra-gtk2 libcddb libcdio libcompizconfig libcroco libdmx libdrm
libdrm-devel libedit libexpat1 libffi libfontenc libgcrypt libgdata libgksu
libgnome-keyring libgnomekbd libgomp libgpg-error libgphoto2 libgsf libgssglue
libgtop2 libgudev1 libgweather libical libicu libimobiledevice libjpeg-turbo libmount
libmysqlclient16 libnih libnl libnotify libogg libpaper libpciaccess libplist libproxy
libproxy-bin libproxy-mozjs libproxy-python libsamplerate libsexy libsigsegv
libsmbclient libsndfile libsoup libstdc++-devel libtalloc libtasn1 libtdb libtheora
libtirpc libudev libusb1 libutempter libuuid libvisual libvorbis libwnck libx86 libxcb
libxcb-devel libxcb-doc libxkbfile libxklavier linux-firmware lua lua-rex lvm2-libs
lzma-libs lzo-minilzo man-db mesa-demos mesa-libGL mesa-libGL-devel mesa-libGLU
mesa-libOSMesa metacity module-init-tools mpfr nash nautilus-libs net-snmp
notification-daemon nspr nss ntfsprogs ntp oniguruma openjpeg opensp
openssh-askpass-gnome orc parted pciutils pciutils-libs perl-DBD-SQLite
perl-Date-Manip perl-Image-Magick perl-TimeDate perl-XML-Twig perl-YAML-Syck pixman
plymouth plymouth-core-libs plymouth-graphics-libs plymouth-plugin-script
plymouth-scripts plymouth-system-theme plymouth-theme-script pm-utils polkit
polkit-gnome poppler poppler-data poppler-utils pulseaudio pulseaudio-core-libs
pulseaudio-esound-compat pulseaudio-libs pulseaudio-libs-glib2 pycairo pygobject
pyorbit python-ethtool python-imaging python-iwlib python-numeric python-slip rarian
rarian-compat rhpxl rpcbind rpm-python rsh samba-winbind-clients sane sg3_utils-libs
slang-slsh slang1 smp_utils sound-theme-freedesktop speex system-config-date
system-config-display system-config-keyboard system-config-network
system-config-network-tui system-config-printer-libs system-config-securitylevel
system-config-securitylevel-tui system-config-users system-setup-keyboard
task-xorg-x11 tcl tk ttmkfdir tuxonice-userui tuxonice-userui-usplash twm tzdata
udisks unique upower upstart usbmuxd usermode-gtk usplash vbetool vine-manual-base
vine-rescue-guide xcb-util xdg-utils xfsprogs xkeyboard-config xorg-x11-apps
xorg-x11-drivers xorg-x11-drv-acecad xorg-x11-drv-aiptek xorg-x11-drv-apm
xorg-x11-drv-ast xorg-x11-drv-ati xorg-x11-drv-cirrus xorg-x11-drv-dummy
xorg-x11-drv-elographics xorg-x11-drv-evdev xorg-x11-drv-fbdev xorg-x11-drv-fpit
xorg-x11-drv-geode xorg-x11-drv-glint xorg-x11-drv-hyperpen xorg-x11-drv-i128
xorg-x11-drv-i740 xorg-x11-drv-intel xorg-x11-drv-keyboard xorg-x11-drv-mach64
xorg-x11-drv-mga xorg-x11-drv-mouse xorg-x11-drv-mutouch xorg-x11-drv-neomagic
xorg-x11-drv-nouveau xorg-x11-drv-nv xorg-x11-drv-openchrome xorg-x11-drv-penmount
xorg-x11-drv-r128 xorg-x11-drv-rendition xorg-x11-drv-s3virge xorg-x11-drv-savage
xorg-x11-drv-siliconmotion xorg-x11-drv-sis xorg-x11-drv-sisusb xorg-x11-drv-synaptics
xorg-x11-drv-tdfx xorg-x11-drv-trident xorg-x11-drv-v4l xorg-x11-drv-vesa
xorg-x11-drv-vmmouse xorg-x11-drv-vmware xorg-x11-drv-void xorg-x11-drv-voodoo
xorg-x11-drv-wacom xorg-x11-filesystem xorg-x11-font-utils xorg-x11-fonts-misc
xorg-x11-libs xorg-x11-proto-devel xorg-x11-resutils xorg-x11-server-Xephyr
xorg-x11-server-Xorg xorg-x11-server-common xorg-x11-server-utils xorg-x11-utils
xorg-x11-xauth xorg-x11-xdm xorg-x11-xfs xorg-x11-xinit xorg-x11-xkb-utils
xorg-x11-xsm xterm xz xz-libs yelp
331 upgraded, 394 newly installed, 39 replaced, 7 removed and 0 not upgraded.
Need to get 649MB/736MB of archives.
After unpacking 790MB of additional disk space will be used.
Do you want to continue? [Y/n]y
Done.
importing Vine Linux keyring to rpm keyring.........................................................done.
Reboot required.
W: Some errors occurred while running transaction
どわーっと出たが,最後にエラーが出て終わっている。「Reboot required.」されたのでひとまず OS を再起動。そして再度 upgrade を行う。
# apt-get upgrade
パッケージリストを読みこんでいます... 完了
依存情報ツリーを作成しています... 完了
これらを解決するためには 'apt-get --fix-broken install' を実行する必要があるかもしれません。
以下のパッケージは解決できない依存関係を持っています:
apache: 依存: libdb-4.2.so それをインストールすることができません
console-tools: 廃止: kbd
jed: 廃止: jed-common
kbd: 廃止: console-tools
rpcbind: 廃止: portmap (<= 4.0-65.3)
E: 未解決の依存関係があります。--fix-broken オプションをためして下さい。
[root@localhost ~]# apt-get -f install
パッケージリストを読みこんでいます... 完了
依存情報ツリーを作成しています... 完了
依存関係を解決しています... 完了
以下のパッケージが削除されます:
apache console-tools jed-common portmap
アップグレード: 0 個, 新規インストール: 0 個, 削除: 4 個, 保留: 0 個
0B のアーカイブを取得する必要があります。
展開後に 6251kB が解放されます。
続行しますか? [Y/n]y
変更を適用しています...
準備中 ############################## [100%]
サービス portmap に関する情報の読み込み中にエラーが発生しました: そのようなファイルやディ レクトリはありません
エラー: %preun(portmap-4.0-63vl2.i386) scriptlet failed, exit status 1
install-info: そのようなファイルやディレクトリはありません /usr/share/info/jed.info.gz
エラー: %preun(jed-common-0.99.14-0vl6.i386) scriptlet failed, exit status 1
サービス keytable に関する情報の読み込み中にエラーが発生しました: そのようなファイルやディレクトリはありません
エラー: %preun(console-tools-19990829-29vl4.i386) scriptlet failed, exit status 1
サービス httpd に関する情報の読み込み中にエラーが発生しました: そのようなファイルやディレ クトリはありません
エラー: %preun(apache-1.3.41-0vl1.i386) scriptlet failed, exit status 1
完了
W: トランザクション処理中にエラーが発生しました
「以下のパッケージが削除されます: apache console-tools jed-common portmap」と表示されているのに,削除に失敗している。まずは,メッセージ通りに --fix-broken オプションを試す。
# apt-get --fix-broken install
パッケージリストを読みこんでいます... 完了
依存情報ツリーを作成しています... 完了
依存関係を解決しています... 完了
以下のパッケージが削除されます:
apache console-tools jed-common portmap
アップグレード: 0 個, 新規インストール: 0 個, 削除: 4 個, 保留: 0 個
0B のアーカイブを取得する必要があります。
展開後に 6251kB が解放されます。
続行しますか? [Y/n]y
変更を適用しています...
準備中 ############################## [100%]
サービス portmap に関する情報の読み込み中にエラーが発生しました: そのようなファイルやディ レクトリはありません
エラー: %preun(portmap-4.0-63vl2.i386) scriptlet failed, exit status 1
install-info: そのようなファイルやディレクトリはありません /usr/share/info/jed.info.gz
エラー: %preun(jed-common-0.99.14-0vl6.i386) scriptlet failed, exit status 1
サービス keytable に関する情報の読み込み中にエラーが発生しました: そのようなファイルやディレクトリはありません
エラー: %preun(console-tools-19990829-29vl4.i386) scriptlet failed, exit status 1
サービス httpd に関する情報の読み込み中にエラーが発生しました: そのようなファイルやディレ クトリはありません
エラー: %preun(apache-1.3.41-0vl1.i386) scriptlet failed, exit status 1
完了
W: トランザクション処理中にエラーが発生しました
結果は同じで,削除に失敗している。ここは多少汚くてもいったん強制的に削除してしまった方がよさそうだ。
# rpm -e portmap
サービス portmap に関する情報の読み込み中にエラーが発生しました: そのようなファイルやディ レクトリはありません
エラー: %preun(portmap-4.0-63vl2.i386) scriptlet failed, exit status 1
# rpm -e --notriggerpostun --nopreun portmap
# rpm -e --notriggerpostun --nopreun jed-common
# rpm -e --notriggerpostun --nopreun console-tools
# rpm -e --notriggerpostun --nopreun apache
RPM を普通に削除しようとしても失敗するので,強制削除した。
# apt-get install php5
これで完了。
動作モードの変更
次のエラーは…
# /etc/init.d/apache2 start
Apache2 HTTP Serverを起動中: [Fri Jan 10 21:45:13 2014] [crit] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP.
Pre-configuration failed
[ 失敗 ]
PHP を再コンパイルせよだと? そんな馬鹿な。以前,PHP4 のときに作りなおしたことがあったが,それは依存パッケージに手を加えていたからである (nlog(n): PHP4 がインストールできない),今回は新規インストールなのでそれはない。MPM とは Multi-Processing Module のことである (マルチプロセッシングモジュール (MPM) - Apache HTTP サーバ バージョン 2.2)。調べてみると,この問題とその対処法が議論されていた (0001191: php5-apahe2を組み込むとapache2が機能できない - Vine Linux バグトラッキングシステム)。デフォルトの worker から prefork に MPM を変更すればよいとのこと。php-apache2(php5-apache2)パッケージを組み込ませて起動させる方法にもまとまっている。
# /sbin/update-alternatives --config apache2
2 プログラムがあり 'apache2' を提供します。
選択 コマンド
-----------------------------------------------
+ 1 /usr/sbin/apache2.worker
* 2 /usr/sbin/apache2.prefork
Enter を押して現在の選択 [+] を保持するか、選択番号を入力します:2
「2」を選択すればよい。
SSL
お次は SSL。
# /etc/init.d/apache2 start
Apache2 HTTP Serverを起動中: Syntax error on line 242 of /etc/apache2/conf.d/ssl.conf:
SSLCertificateFile: file '/usr/local/ssl/cert.pem' does not exist or is empty
[ 失敗 ]
これは単に SSL の証明書を作っていなかっただけである。しかし,なおも失敗してしまう。
# /etc/init.d/apache2 start
Apache2 HTTP Serverを起動中: [ 失敗 ]
エラーメッセージが表示されないので,ログを参照する。
# tail /var/log/apache2/default/error_log
[notice] suEXEC mechanism enabled (wrapper: /usr/lib/apache2/suexec)
[error] Server should be SSL-aware but has no certificate configured [Hint: SSLCertificateFile] ((null):0)
これは Apache の SSL に関するコンフィグレーションがまずいとのこと (apache で server should be ssl-aware but has no certificate configured hint sslcertificatefile null 0 となった。 - ドクペ・インジェクション)。Apache のバージョンが上がったことで,書式がより厳密になったようだ。
残課題
さて,SSL に関しては,証明書を作ることで通信ができるようになったが,GET や POST をすると応答がなくなってしまうという問題が残っている。これについては現在のところ未解決となっている。
Posted by n at 2014-11-04 02:22 | Edit | Comments (0) | Trackback(0)