サーバー設定 · 2 min read · Dec 03, 2025
完璧なセットアップ - Mandriva 2007 無料版 - ページ 5
11 MySQL (5.0)
MySQL 5.0をインストールするには、次のコマンドを実行します:
urpmi MySQL MySQL-client libmysql15-develデフォルトでは、Mandriva 2007のMySQLパッケージではネットワーキングが有効になっていませんが、ISPConfigにはネットワーキングが必要です。この設定は、/etc/my.cnfのskip-networking行をコメントアウトすることで変更できます:
vi /etc/my.cnf| [...] # TCP/IPポートで全くリッスンしない。これはセキュリティの向上になる可能性があります。 # mysqldに接続する必要があるすべてのプロセスが同じホストで実行される場合。 # mysqldとのすべてのやり取りはUnixソケットまたは名前付きパイプを介して行う必要があります。 # このオプションを使用しても、Windowsで名前付きパイプを有効にしないと # ("enable-named-pipe"オプションを介して) mysqldは無用になります! # #skip-networking [...] |
その後、MySQLを起動します:
/etc/init.d/mysqld startネットワーキングが有効になっているか確認します。次のコマンドを実行します:
netstat -tap次のような行が表示されるはずです:
| [...] tcp 0 0 *:mysql *:* LISTEN 4609/mysqld [...] |
次に、次のコマンドを実行します:
mysqladmin -u root password yourrootsqlpassword
mysqladmin -h server1.example.com -u root password yourrootsqlpasswordこれにより、rootユーザーのパスワードが設定されます(そうしないと、誰でもあなたのMySQLデータベースにアクセスできてしまいます!)。
12 Postfix With SMTP-AUTH And TLS
必要なパッケージ(Postfix、cyrus-sasl、imapなど)を次のようにインストールします:
urpmi cyrus-sasl libsasl2 libsasl2-devel libsasl2-plug-plain libsasl2-plug-anonymous libsasl2-plug-crammd5 libsasl2-plug-digestmd5 libsasl2-plug-gssapi libsasl2-plug-login postfix imap次に、次のコマンドを実行します:
postconf -e 'smtpd_sasl_local_domain ='
postconf -e 'smtpd_sasl_auth_enable = yes'
postconf -e 'smtpd_sasl_security_options = noanonymous'
postconf -e 'broken_sasl_auth_clients = yes'
postconf -e 'smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination'
postconf -e 'inet_interfaces = all'
postconf -e 'mydomain = example.com'
postconf -e 'myhostname = server1.$mydomain'
postconf -e 'mydestination = /etc/postfix/local-host-names, localhost.example.com'
touch /etc/postfix/local-host-names/etc/sasl2/smtpd.confを編集します。次のようになります:
vi /etc/sasl2/smtpd.conf| # postfix用のSASLライブラリ設定ファイル # すべてのパラメータは次の場所に文書化されています: # /usr/share/doc/cyrus-sasl-2.*/options.html # mech_listパラメータは使用するsaslメカニズムをリストします。 # デフォルトは見つかったすべてのメカニズムです。 mech_list: plain login # 別のsaslauthdデーモンを使用して認証するために、 # (例: システムまたはldapユーザー)。/etc/sysconfig/saslauthdも参照してください。 pwcheck_method: saslauthd saslauthd_path: /var/lib/sasl2/mux # sasldbに保存されたユーザーに対して認証します。 #pwcheck_method: auxprop #auxprop_plugin: sasldb #sasldb_path: /var/lib/sasl2/sasl.db |
TLSに必要なSSL証明書を作成します:
mkdir /etc/postfix/ssl
cd /etc/postfix/ssl/
openssl genrsa -des3 -rand /etc/hosts -out smtpd.key 1024
chmod 600 smtpd.key
openssl req -new -key smtpd.key -out smtpd.csr
openssl x509 -req -days 3650 -in smtpd.csr -signkey smtpd.key -out smtpd.crt
openssl rsa -in smtpd.key -out smtpd.key.unencrypted
mv -f smtpd.key.unencrypted smtpd.key
openssl req -new -x509 -extensions v3_ca -keyout cakey.pem -out cacert.pem -days 3650そして、PostfixをTLS用に設定します:
postconf -e 'smtpd_tls_auth_only = no'
postconf -e 'smtp_use_tls = yes'
postconf -e 'smtpd_use_tls = yes'
postconf -e 'smtp_tls_note_starttls_offer = yes'
postconf -e 'smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key'
postconf -e 'smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt'
postconf -e 'smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem'
postconf -e 'smtpd_tls_loglevel = 1'
postconf -e 'smtpd_tls_received_header = yes'
postconf -e 'smtpd_tls_session_cache_timeout = 3600s'
postconf -e 'tls_random_source = dev:/dev/urandom'次に、Postfix、saslauthd、imap、pop3を起動します:
chkconfig imap on
chkconfig imaps on
chkconfig ipop3 on
chkconfig pop3s on
/etc/init.d/postfix restart
/etc/init.d/saslauthd restart
/etc/init.d/xinetd restartSMTP-AUTHとTLSが正しく機能しているか確認するには、次のコマンドを実行します:
telnet localhost 25Postfixメールサーバーへの接続が確立されたら、次のように入力します:
ehlo localhost次の行が表示される場合:
250-STARTTLSおよび
250-AUTHすべてが正常です。

次のように入力します:
quitシステムのシェルに戻ります。
13 Apache2 With PHP5
Apache2とPHP5をインストールするには、次のコマンドを実行します(1行で):
urpmi apache2-mod_php libphp5_common5 php-bz2 php-calendar php-ctype php-curl php-devel php-dio php-dom php-eaccelerator php-enchant php-esmtp php-event php-exif php-fam php-ffmpeg php-fileinfo php-filepro php-ftp php-gd php-gettext php-gmp php-iconv php-id3 php-idn php-imap php-imlib2 php-mailparse php-mbstring php-mcache php-mcrypt php-mhash php-ming php-mysql php-mysqli php-ncurses php-newt php-odbc php-oggvorbis php-pam_auth php-pcntl php-pcre php-pear-Net_IDNA php-posix php-pspell php-readline php-recode php-session php-shmop php-simplexml php-snmp php-soap php-sockets php-sqlite php-ssh2 php-sysvmsg php-sysvsem php-sysvshm php-tclink php-tcpwrap php-tidy php-xml php-xmlrpc php-zip php5-ini curl libcurl3-devel perl-libwww-perl ImageMagickApacheを起動します:
/etc/init.d/httpd restart13.1 PHPをグローバルに無効にする
(このサーバーにISPConfigをインストールする予定がない場合は、このセクションをスキップしてください!)
ISPConfigでは、ウェブサイトごとにPHPを設定します。つまり、どのウェブサイトがPHPスクリプトを実行できるか、どのウェブサイトが実行できないかを指定できます。これは、PHPがグローバルに無効になっている場合にのみ機能します。そうでないと、すべてのウェブサイトがPHPスクリプトを実行できてしまいます。
/etc/httpd/modules.d/70_mod_php.confを編集し、AddType行をコメントアウトします:
vi /etc/httpd/modules.d/70_mod_php.conf| |
/etc/httpd/conf/mime.typesを編集し、次の行をコメントアウトします:
vi /etc/httpd/conf/mime.types| [...] #application/x-perl perl pl #application/x-php php php3 php4 [...] |
/etc/httpd/conf/httpd.confを編集し、LoadModuleセクションに次の行を追加します:
vi /etc/httpd/conf/httpd.conf| [...] LoadModule php5_module extramodules/mod_php5.so [...] |
(この行はすでに/etc/httpd/modules.d/70_mod_php.confにありますが、これは非常に重要です。そうでないと、次のコマンドが
httpd -tエラーを報告し、ISPConfigによって作成された仮想ホストにphp_admin_flag safe_mode Onのような行が含まれている場合、Syntax OKではなくなります!)
Apacheを再起動します:
/etc/init.d/httpd restart新しい投稿を受信箱で受け取る
スパムはありません。いつでも購読を解除できます。