さくらインターネット VPS Ubuntu化と、機能インストールのメモ (2)

サーバプログラム各種のインストール

パッケージをゴリゴリ入れていきます。

apache2

root@www0000ua:~# aptitude install apache2 libapache2-mod-apparmor libapache2-mod-perl2 libapache2-mod-php5
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
The following NEW packages will be installed:
  apache2 apache2-mpm-prefork{a} apache2-utils{a} apache2.2-bin{a}
  apache2.2-common{a} libapache2-mod-apparmor libapache2-mod-perl2
  libapache2-mod-php5 libapache2-reload-perl{a} libapr1{a} libaprutil1{a}
  libaprutil1-dbd-sqlite3{a} libaprutil1-ldap{a} libbsd-resource-perl{a}
  libdevel-symdump-perl{a} libperl5.10{a} php5-common{a} ssl-cert{a}
0 packages upgraded, 18 newly installed, 0 to remove and 0 not upgraded.
Need to get 8,225kB of archives. After unpacking 25.5MB will be used.
Do you want to continue? [Y/n/?] y
(中略)
root@www0000ua:~# 

php5

root@www0000ua:~# aptitude install php5 php5-cgi php5-curl php5-gd php5-imagick  php5-mysql php5-pgsql php5-sasl  php5-sqlite php5-tidy php5-xsl
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
The following NEW packages will be installed:
  defoma{a} fontconfig-config{a} ghostscript{a} gsfonts{a}
  libavahi-client3{a} libavahi-common-data{a} libavahi-common3{a}
  libcups2{a} libcupsimage2{a} libcurl3{a} libfontconfig1{a} libgd2-xpm{a}
  libgomp1{a} libgs8{a} libice6{a} libjasper1{a} libjpeg62{a} liblcms1{a}
  libltdl7{a} libmagickcore2{a} libmagickwand2{a} libmysqlclient16{a}
  libpaper-utils{a} libpaper1{a} libpq5{a} libsm6{a} libsqlite0{a}
  libt1-5{a} libtidy-0.99-0{a} libtiff4{a} libxpm4{a} libxslt1.1{a}
  libxt6{a} mysql-common{a} php5 php5-cgi php5-curl php5-gd php5-imagick
  php5-mysql php5-pgsql php5-sasl php5-sqlite php5-tidy php5-xsl
  psfontmgr{a} ttf-dejavu-core{a} x11-common{a}
0 packages upgraded, 48 newly installed, 0 to remove and 0 not upgraded.
Need to get 22.3MB of archives. After unpacking 61.0MB will be used.
Do you want to continue? [Y/n/?]
(中略)
root@www0000ua:~# 

perl5

root@www0000ua:~# aptitude install perl perltidy perlmagick libclass-dbi-mysql-perl libdbd-mysql-perl libdbd-pg-perl libdbd-sqlite3-perl
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
The following NEW packages will be installed:
  libanydata-perl{a} libclass-data-inheritable-perl{a}
  libclass-dbi-abstractsearch-perl{a} libclass-dbi-mysql-perl
  libclass-dbi-perl{a} libclass-trigger-perl{a} libclone-perl{a}
  libdbd-anydata-perl{a} libdbd-csv-perl{a} libdbd-mysql-perl
  libdbd-pg-perl libdbd-sqlite3-perl libdbi-perl{a}
  libdbix-contextualfetch-perl{a} libima-dbi-perl{a} libio-stringy-perl{a}
  liblingua-en-inflect-perl{a} libnet-daemon-perl{a} libparams-util-perl{a}
  libplrpc-perl{a} libsql-abstract-limit-perl{a} libsql-abstract-perl{a}
  libsql-statement-perl{a} libsub-uplevel-perl{a} libtest-exception-perl{a}
  libtext-csv-xs-perl{a} libtie-ixhash-perl{a} libtime-piece-mysql-perl{a}
  libtime-piece-perl{a} libuniversal-moniker-perl{a} libxml-twig-perl{a}
  libxml-xpath-perl{a}
0 packages upgraded, 32 newly installed, 0 to remove and 0 not upgraded.
Need to get 2,522kB of archives. After unpacking 8,409kB will be used.
Do you want to continue? [Y/n/?]
(中略)
root@www0000ua:~# 

MySQL, PostgreSQL, sqlite3

途中で、MySQLのrootパスワードを聞かれるので、準備して控えること。

root@www0000ua:~# aptitude install  postgresql mysql-server mysql-client sqlite3
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
The following NEW packages will be installed:
  libhtml-template-perl{a} mysql-client mysql-client-5.1{a} mysql-client-core-5.1{a}
  mysql-server mysql-server-5.1{a} mysql-server-core-5.1{a} postgresql postgresql-8.4{a}
  postgresql-client-8.4{a} postgresql-client-common{a} postgresql-common{a} sqlite3
0 packages upgraded, 13 newly installed, 0 to remove and 0 not upgraded.
Need to get 26.4MB of archives. After unpacking 74.5MB will be used.
Do you want to continue? [Y/n/?]
(中略)
root@www0000ua:~# 

bind

root@www0000ua:~# aptitude install bind9
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
The following NEW packages will be installed:
  bind9 bind9utils{a}
0 packages upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 461kB of archives. After unpacking 1,421kB will be used.
Do you want to continue? [Y/n/?]
(中略)
root@www0000ua:~# 

proftpd

後程、ディレクティブを編集して、ftp接続のreject設定をする。
インストール中の設定では

  • サービスの実行元 -> standalone を選択。
root@www0000ua:~# aptitude install proftpd
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Note: selecting "proftpd-basic" instead of the
      virtual package "proftpd"
The following NEW packages will be installed:
  libfile-copy-recursive-perl{a} openbsd-inetd{a} proftpd-basic tcpd{a} update-inetd{a}
0 packages upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,080kB of archives. After unpacking 2,867kB will be used.
Do you want to continue? [Y/n/?]
(中略)
root@www0000ua:~# 

postfix, dovecot

Virtualドメイン対応のため、MySQLをバックエンドに使うので、そのつもりで入れる。
途中の確認内容

  • postfix
    • General type of mail configuration: Internet Site
    • System mail name: www0000ua.sakura.ne.jp

別のサーバではまり気味なので、これは中略しないでLogを載せる

root@www0000ua:~# aptitude install postfix postfix-mysql dovecot-postfix dovecot-imapd dovecot-pop3d
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
The following NEW packages will be installed:
  dovecot-common{a} dovecot-imapd dovecot-pop3d dovecot-postfix postfix postfix-mysql
0 packages upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 9,771kB of archives. After unpacking 20.0MB will be used.
Do you want to continue? [Y/n/?]
Writing extended state information... Done
Get:1 http://jp.archive.ubuntu.com/ubuntu/ lucid-updates/main dovecot-common 1:1.2.9-1ubuntu6.5 [5,510kB]
Get:2 http://jp.archive.ubuntu.com/ubuntu/ lucid-updates/main dovecot-imapd 1:1.2.9-1ubuntu6.5 [1,202kB]
Get:3 http://jp.archive.ubuntu.com/ubuntu/ lucid-updates/main dovecot-pop3d 1:1.2.9-1ubuntu6.5 [1,093kB]
Get:4 http://jp.archive.ubuntu.com/ubuntu/ lucid-updates/main postfix 2.7.0-1ubuntu0.2 [1,404kB]
Get:5 http://jp.archive.ubuntu.com/ubuntu/ lucid-updates/main dovecot-postfix 1:1.2.9-1ubuntu6.5 [518kB]
Get:6 http://jp.archive.ubuntu.com/ubuntu/ lucid-updates/main postfix-mysql 2.7.0-1ubuntu0.2 [44.5kB]
Fetched 9,771kB in 5s (1,636kB/s)
Preconfiguring packages ...
Selecting previously deselected package dovecot-common.
(Reading database ... 48141 files and directories currently installed.)
Unpacking dovecot-common (from .../dovecot-common_1%3a1.2.9-1ubuntu6.5_amd64.deb) ...
Selecting previously deselected package dovecot-imapd.
Unpacking dovecot-imapd (from .../dovecot-imapd_1%3a1.2.9-1ubuntu6.5_amd64.deb) ...
Selecting previously deselected package dovecot-pop3d.
Unpacking dovecot-pop3d (from .../dovecot-pop3d_1%3a1.2.9-1ubuntu6.5_amd64.deb) ...
Selecting previously deselected package postfix.
Unpacking postfix (from .../postfix_2.7.0-1ubuntu0.2_amd64.deb) ...
Selecting previously deselected package dovecot-postfix.
Unpacking dovecot-postfix (from .../dovecot-postfix_1%3a1.2.9-1ubuntu6.5_all.deb) ...
Selecting previously deselected package postfix-mysql.
Unpacking postfix-mysql (from .../postfix-mysql_2.7.0-1ubuntu0.2_amd64.deb) ...
Processing triggers for ufw ...
Processing triggers for ureadahead ...
Processing triggers for man-db ...
Setting up dovecot-common (1:1.2.9-1ubuntu6.5) ...

Creating config file /etc/dovecot/dovecot.conf with new version

Creating config file /etc/dovecot/dovecot-ldap.conf with new version

Creating config file /etc/dovecot/dovecot-sql.conf with new version
adduser: Warning: The home directory `/usr/lib/dovecot' does not belong to the user you are currently creating.
Creating generic self-signed certificate:  /etc/ssl/certs/dovecot.pem
(replace with hand-crafted or authorized one if needed).
update-rc.d: warning: dovecot stop runlevel arguments (1) do not match LSB Default-Stop values (0 1 6)
 * Starting IMAP/POP3 mail server dovecot                                                 [ OK ]

Setting up dovecot-imapd (1:1.2.9-1ubuntu6.5) ...
 * Restarting IMAP/POP3 mail server dovecot                                                      If you have trouble with authentication failures,
enable auth_debug setting. See http://wiki.dovecot.org/WhyDoesItNotWork
This message goes away after the first successful login.
                                                                                          [ OK ]

Setting up dovecot-pop3d (1:1.2.9-1ubuntu6.5) ...
 * Restarting IMAP/POP3 mail server dovecot                                                      If you have trouble with authentication failures,
enable auth_debug setting. See http://wiki.dovecot.org/WhyDoesItNotWork
This message goes away after the first successful login.
                                                                                          [ OK ]

Setting up postfix (2.7.0-1ubuntu0.2) ...                    # <<--- ここで、設定についての質問有り
Adding group `postfix' (GID 115) ...
Done.
Adding system user `postfix' (UID 109) ...
Adding new user `postfix' (UID 109) with group `postfix' ...
Not creating home directory `/var/spool/postfix'.
Creating /etc/postfix/dynamicmaps.cf
Adding tcp map entry to /etc/postfix/dynamicmaps.cf
Adding group `postdrop' (GID 116) ...
Done.
setting myhostname: www0000ua.sakura.ne.jp
setting alias maps
setting alias database
changing /etc/mailname to www0000ua.sakura.ne.jp
setting myorigin
setting destinations: www0000ua.sakura.ne.jp, localhost.sakura.ne.jp, , localhost
setting relayhost:
setting mynetworks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
setting mailbox_size_limit: 0
setting recipient_delimiter: +
setting inet_interfaces: all
/etc/aliases does not exist, creating it.
WARNING: /etc/aliases exists, but does not have a root alias.

Postfix is now set up with a default configuration.  If you need to make
changes, edit
/etc/postfix/main.cf (and others) as needed.  To view Postfix configuration
values, see postconf(1).

After modifying main.cf, be sure to run '/etc/init.d/postfix reload'.

Running newaliases
 * Stopping Postfix Mail Transport Agent postfix                                          [ OK ]
 * Starting Postfix Mail Transport Agent postfix                                          [ OK ]

Setting up dovecot-postfix (1:1.2.9-1ubuntu6.5) ...
dovecot-postfix delivery changes some postfix settings.
Old values are sored in /var/backups/dovecot-postfix/main.cf-backup.
Feel free to revert any of them when the process is done.
Configuring postfix for dovecot-postfix integration: .................... done.
 * Restarting IMAP/POP3 mail server dovecot                                                      If you have trouble with authentication failures,
enable auth_debug setting. See http://wiki.dovecot.org/WhyDoesItNotWork
This message goes away after the first successful login.
                                                                                          [ OK ]
 * Stopping Postfix Mail Transport Agent postfix                                          [ OK ]
 * Starting Postfix Mail Transport Agent postfix                                          [ OK ]

Setting up postfix-mysql (2.7.0-1ubuntu0.2) ...
Adding mysql map entry to /etc/postfix/dynamicmaps.cf

Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Writing extended state information... Done

root@www0000ua:~#

spamassassin, clamav

root@www0000ua:~# aptitude install spamassassin spamassassin-rules-ja clamav
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
The following NEW packages will be installed:
  binutils{a} clamav clamav-base{a} clamav-freshclam{a} gcc{a} gcc-4.4{a} libc-dev-bin{a}
  libc6-dev{a} libclamav6{a} libdigest-hmac-perl{a} libdigest-sha1-perl{a} liberror-perl{a}
  libio-socket-inet6-perl{a} libmail-spf-perl{a} libnet-dns-perl{a} libnet-ip-perl{a}
  libnetaddr-ip-perl{a} libsocket6-perl{a} libsys-hostname-long-perl{a} libtommath0{a}
  linux-libc-dev{a} manpages-dev{a} re2c{a} spamassassin spamassassin-rules-ja spamc{a}
0 packages upgraded, 26 newly installed, 0 to remove and 0 not upgraded.
Need to get 17.2MB of archives. After unpacking 54.8MB will be used.
Do you want to continue? [Y/n/?]
(中略)
root@www0000ua:~# 

webminのインストール

webminはパッケージを個別に持ってこないと入らない

root@www0000ua:~# wget http://downloads.sourceforge.net/project/webadmin/webmin/1.570/webmin_1....
[1] 14164
bash: ./webmin_1.570_all.deb: No such file or directory
[1]+  Done                    ts=1321848356
root@www0000ua:~# --2011-11-21 13:06:36--  http://downloads.sourceforge.net/project/webadmin/webmin/1.570/webmin_1....
Resolving downloads.sourceforge.net... 216.34.181.59
Connecting to downloads.sourceforge.net|216.34.181.59|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://jaist.dl.sourceforge.net/project/webadmin/webmin/1.570/webmin_1.5... [following]
--2011-11-21 13:06:37--  http://jaist.dl.sourceforge.net/project/webadmin/webmin/1.570/webmin_1.5...
Resolving jaist.dl.sourceforge.net... 150.65.7.130, 2001:200:141:feed::feed
Connecting to jaist.dl.sourceforge.net|150.65.7.130|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14884300 (14M) [application/x-debian-package]
Saving to: `webmin_1.570_all.deb?r=http:%2F%2Fwww.webmin.com%2Fdownload.html'

100%[=======================================================>] 14,884,300  13.1M/s   in 1.1s

2011-11-21 13:06:38 (13.1 MB/s) - `webmin_1.570_all.deb?r=http:%2F%2Fwww.webmin.com%2Fdownload.html' saved [14884300/14884300]


[1]+  Done                    wget http://downloads.sourceforge.net/project/webadmin/webmin/1.570/webmin_1....
root@www0000ua:~# ls
webmin_1.570_all.deb?r=http:%2F%2Fwww.webmin.com%2Fdownload.html
root@www0000ua:~# mv webmin_1.570_all.deb\?r\=http\:%2F%2Fwww.webmin.com%2Fdownload.html webmin_1.570_all.deb
root@www0000ua:~# dpkg -i webmin_1.570_all.deb
Selecting previously deselected package webmin.
(Reading database ... 52576 files and directories currently installed.)
Unpacking webmin (from webmin_1.570_all.deb) ...
dpkg: dependency problems prevent configuration of webmin:
 webmin depends on libnet-ssleay-perl; however:
  Package libnet-ssleay-perl is not installed.
 webmin depends on libauthen-pam-perl; however:
  Package libauthen-pam-perl is not installed.
 webmin depends on libio-pty-perl; however:
  Package libio-pty-perl is not installed.
 webmin depends on apt-show-versions; however:
  Package apt-show-versions is not installed.
dpkg: error processing webmin (--install):
 dependency problems - leaving unconfigured
Processing triggers for ureadahead ...
Errors were encountered while processing:
 webmin
root@www0000ua:~#

足りないパッケージがあるようなので、追加インストール

root@www0000ua:~# aptitude install libnet-ssleay-perl libauthen-pam-perl libio-pty-perl apt-show-versions
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
The following NEW packages will be installed:
  apt-show-versions libapt-pkg-perl{a} libauthen-pam-perl libio-pty-perl libnet-ssleay-perl
The following partially installed packages will be configured:
  webmin
0 packages upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 409kB of archives. After unpacking 1,810kB will be used.
Do you want to continue? [Y/n/?]
(中略)
Current status: 0 broken [-1].
root@www0000ua:~# 

good!

phpmyadmin, phppgadminのインストール

途中の設定確認での選択/入力

  • phpmyadmin
    • Web server to reconfigure automatically: apache2
    • Configure database for phpmyadmin with dbconfig-common? : Yes
    • Password of the database's administrative user: [MySQL rootのパスワード]
    • MySQL application password for phpmyadmin: [空欄で自動生成]
root@www0000ua:~# aptitude install phpmyadmin phppgadmin
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
The following NEW packages will be installed:
  dbconfig-common{a} javascript-common{a} libjs-mootools{a} libmcrypt4{a} php5-mcrypt{a}
  phpmyadmin phppgadmin postgresql-doc{a} postgresql-doc-8.4{a} wwwconfig-common{a}
0 packages upgraded, 10 newly installed, 0 to remove and 0 not upgraded.
Need to get 7,972kB of archives. After unpacking 38.8MB will be used.
Do you want to continue? [Y/n/?]

(中略)

dbconfig-common: flushing administrative password
apache2: Syntax error on line 233 of /etc/apache2/apache2.conf: Could not open configuration file /etc/apache2/conf.d/phppgadmin: No such file or directory
   ...fail!
invoke-rc.d: initscript apache2, action "reload" failed.

Setting up phppgadmin (4.2.2-1ubuntu1) ...
 * Reloading web server config apache2
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Writing extended state information... Done

root@www0000ua:~#

phppgadminの設定が失敗している?
apacheの設定変更とリロードに失敗している。
ややこしいので、一度purgeしてから入れなおす。

root@www0000ua:~# aptitude purge phppgadmin
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
The following packages will be REMOVED:
  phppgadmin{p} postgresql-doc{u} postgresql-doc-8.4{u}
0 packages upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
Need to get 0B of archives. After unpacking 17.8MB will be freed.
Do you want to continue? [Y/n/?]
Writing extended state information... Done
(Reading database ... 71817 files and directories currently installed.)
Removing phppgadmin ...
Purging configuration files for phppgadmin ...
(Reading database ... 71464 files and directories currently installed.)
Removing postgresql-doc ...
Removing postgresql-doc-8.4 ...
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Writing extended state information... Done

root@www0000ua:~# aptitude install phppgadmin
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
The following NEW packages will be installed:
  phppgadmin postgresql-doc{a} postgresql-doc-8.4{a}
0 packages upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B/2,834kB of archives. After unpacking 17.8MB will be used.
Do you want to continue? [Y/n/?]
Writing extended state information... Done
Selecting previously deselected package postgresql-doc-8.4.
(Reading database ... 70435 files and directories currently installed.)
Unpacking postgresql-doc-8.4 (from .../postgresql-doc-8.4_8.4.9-0ubuntu0.10.04_all.deb) ...
Selecting previously deselected package postgresql-doc.
Unpacking postgresql-doc (from .../postgresql-doc_8.4.9-0ubuntu0.10.04_all.deb) ...
Selecting previously deselected package phppgadmin.
Unpacking phppgadmin (from .../phppgadmin_4.2.2-1ubuntu1_all.deb) ...
Setting up postgresql-doc-8.4 (8.4.9-0ubuntu0.10.04) ...
Setting up postgresql-doc (8.4.9-0ubuntu0.10.04) ...
Setting up phppgadmin (4.2.2-1ubuntu1) ...
 * Reloading web server config apache2                                                    [ OK ]

Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Writing extended state information... Done

正常終了したように見えるが、アクセスできない。。。
一度、再起動。でもだめ。
設定を確認する。

root@www0000ua:~# lv /etc/apache2/conf.d/phppgadmin

/etc/apache2/conf.d/phppgadmin

Alias /phppgadmin /usr/share/phppgadmin/

<Directory /usr/share/phppgadmin/>

DirectoryIndex index.php

Options +FollowSymLinks
AllowOverride None

order deny,allow
deny from all
allow from 127.0.0.0/255.0.0.0 ::1/128
# allow from all

<IfModule mod_php5.c>
  php_flag magic_quotes_gpc Off
  php_flag track_vars On
  php_value include_path .
</IfModule>

</Directory>

アクセス制限が原因の模様。
basic認証で隠す予定なので、制限を一旦外して、apache再起動。

root@www0000ua:~# diff /etc/phppgadmin/apache.conf.org /etc/phppgadmin/apache.conf
10,12c10,12
< order deny,allow
< deny from all
< allow from 127.0.0.0/255.0.0.0 ::1/128
---
> #order deny,allow
> #deny from all
> #allow from 127.0.0.0/255.0.0.0 ::1/128
14c14,15
< #allow from all
---
> order allow,deny
> allow from all
root@www0000ua:~# /etc/init.d/apache2 restart
 * Restarting web server apache2                                                                 [Mon Nov 21 14:08:58 2011] [warn] The Alias directive in /etc/apache2/conf.d/phppgadmin.org at line 1 will probably never match because it overlaps an earlier Alias.
 ... waiting [Mon Nov 21 14:08:59 2011] [warn] The Alias directive in /etc/apache2/conf.d/phppgadmin.org at line 1 will probably never match because it overlaps an earlier Alias.
                                                                                          [ OK ]
root@www0000ua:~#

固定IPがあるなら、それで制限したほうが良いのだけど。。。
丸裸なので、さっさとbasic認証をかけてしまいたい。

postfixadminのインストール

postfixadminも、別個にパッケージを取得してインストールする必要がある。
パッケージが足りないので、併せて入れる。
作業途中での確認内容は以下の通り。MySQLをバックエンドに使う。

  • postfixadmin
    • Web server to reconfigure automatically: apache2
    • Configure database for postfixadmin with dbconfig-common? : Yes
    • Database type to be used by postfixadmin: mysql
    • Password of the database's administrative user: [MySQL rootのパスワード]
    • MySQL application password for postfixadmin: [空欄にして自動生成]
    • What do you want to do about modified configuration file config.inc.php? : install the package maintainer's version
root@www0000ua:~# wget http://downloads.sourceforge.net/project/postfixadmin/postfixadmin/postf...

(中略)

Saving to: `postfixadmin_2.3.4_all.deb?r=http:%2F%2Fsourceforge.net%2Fprojects%2Fpostfixadmin%2Ffiles%2Fpostfixadmin%2Fpostfixadmin-2.3.4%2F'

100%[==================================================================================================================>] 1,001,470   3.25M/s   in 0.3s

(中略)

[3]-  Done                    ts=1321853243
root@www0000ua:~# ls
postfixadmin_2.3.4_all.deb?r=http:%2F%2Fsourceforge.net%2Fprojects%2Fpostfixadmin%2Ffiles%2Fpostfixadmin%2Fpostfixadmin-2.3.4%2F  webmin_1.570_all.deb
root@www0000ua:~# mv postfixadmin_2.3.4_all.deb\?r\=http\:%2F%2Fsourceforge.net%2Fprojects%2Fpostfixadmin%2Ffiles%2Fpostfixadmin%2Fpostfixadmin-2.3.4%2F  postfixadmin_2.3.4_all.deb
root@www0000ua:~# dpkg -i postfixadmin_2.3.4_all.deb
Replacing config file /etc/postfixadmin/config.inc.php with new version
granting access to database postfixadmin for postfixadmin@localhost: success.
verifying access for postfixadmin@localhost: success.
creating database postfixadmin: success.
verifying database postfixadmin exists: success.
dbconfig-common: flushing administrative password

root@www3373ua:~#

webminのポート変更

iptablesで塞いであるので、このままだとwebminにアクセスできない。
portを変更して再起動する。

root@www0000ua:~# diff /etc/webmin/miniserv.conf.org /etc/webmin/miniserv.conf
1c1,2
< port=10000
---
> #port=10000
> port=8443
root@www0000ua:~# /etc/init.d/webmin restart
Stopping Webmin server in /usr/share/webmin
Starting Webmin server in /usr/share/webmin
Pre-loaded WebminCore
root@www0000ua:~#

apach2 モジュール使用設定

webminにログインし、「サーバ」-> 「Apache Webサーバ」-> 「グローバル設定」-> 「Configure Apache Modules」から、以下のモジュールを有効にする。(有効なままacceptした項目も含みます。)

  • alias
  • apparmor
  • auth_basic
  • authn_alias
  • authn_file
  • authz_groupfile
  • authz_host
  • authz_user
  • autoindex
  • cgi
  • deflate
  • dir
  • env
  • include
  • mime
  • mime_magic
  • negotiation
  • perl
  • php5
  • reqtimeout
  • rewrite
  • setenvif
  • ssl
  • status

postfixadmin, phpmyadmin, phppgadmin にbasic認証をかける

同じ.htpasswdを参照するように、それぞれで作業を行う。

設定のベース

共通参照するファイルを作成し、リンクを貼る

/etc/webconf_auth.htaccess

AuthUserFile /etc/webconf_auth.htpasswd
AuthGroupFile /dev/null
AuthName "Please enter your ID and password"
AuthType Basic
require valid-user

/etc/webconf_auth.htpasswd

ユーザ : adminでhtpasswdを作成

root@www0000ua:/etc# htpasswd -c ./webconf_auth.htpasswd admin
New password: 
Re-type new password: 
Adding password for user admin
root@www0000ua:/etc# 

デフォルトでは.htaccessの参照が有効になっていないが、apacheの設定ではなく、個別の設定を変更して有効にする。

postfixadmin

デフォルトのhtaccessは存在しないので、単純にリンク

root@www0000ua:/usr/share/postfixadmin# ls -a .htaccess
ls: cannot access .htaccess: No such file or directory
root@www0000ua:/usr/share/postfixadmin# ln -s /etc/webconf_auth.htaccess ./.htaccess
root@www0000ua:/usr/share/postfixadmin# 

apache.confを編集

root@www0000ua:~# diff /etc/postfixadmin/apache.conf.org /etc/postfixadmin/apache.conf
4a5,13
> 
>   Options +FollowSymLinks
>   AllowOverride All
>
>   order allow,deny
>   allow from all
>
> 
>
root@www0000ua:~#

phpmyadmin

デフォルトのhtaccessは存在しないので、単純にリンク

root@www0000ua:/usr/share/phpmyadmin# ls -a .htaccess
ls: cannot access .htaccess: No such file or directory
root@www0000ua:/usr/share/phpmyadmin# ln -s /etc/webconf_auth.htaccess ./.htaccess
root@www0000ua:/usr/share/phpmyadmin#

apache.confを編集

root@www0000ua:~# diff /etc/phpmyadmin/apache.conf.org /etc/phpmyadmin/apache.conf
7a8
>         AllowOverride All
root@www0000ua:~#

phppgadmin

root@www0000ua:/usr/share/phppgadmin# ls -a .htaccess
ls: cannot access .htaccess: No such file or directory
root@www0000ua:/usr/share/phppgadmin# ln -s /etc/webconf_auth.htaccess ./.htaccess
root@www0000ua:/usr/share/phppgadmin#

apache.confを編集

root@www0000ua:~# diff /etc/phppgadmin/apache.conf.no_auth /etc/phppgadmin/apache.conf
8c8,9
< AllowOverride None
---
> #AllowOverride None
> AllowOverride All
root@www0000ua:~#

一通り作業したら、apacheを再起動して、それぞれ確認する。

proftpdの設定

webminにログインし、「サーバ」-> 「ProFTPD サーバ」から設定を行う。
ubuntuの場合、デフォルトでrootのFTPは禁止であり、anonymous接続も無効になっている。

「ファイルとディレクトリ」を開く。
「初期ログインディレクトリ」に"~"(チルダ)を指定しておく。(= ユーザのhomeがデフォルト)

「拒否されたFTPユーザ」を開く。
ftpを許可しないユーザの一覧が表示されるので、管理ユーザを加えておく。

設定後は、サービスの再起動をしておく。

~12/03追記~
この後、firewallが塞がったままなので、当然、パッシブモードで繋ぐとエラーに。
下記の定義を追加

/etc/network/if-pre-up.d/iptables-up

#######################################
# Server->WANのポリシー

# FTP PassivePorts
$IPTABLES -A wan_out -p tcp -m state --state NEW --sport 6100:6300 -j ACCEPT

#######################################
# WAN->Serverのポリシー

# FTP PassivePorts
$IPTABLES -A wan_inp -p tcp -m state --state NEW --dport 6100:6300 -j ACCEPT



次の作業は長くなるので、一旦エントリを切ります。