Debian GNU/LinuxでWebサーバ
目的
- Debian GNU/LinuxでWebサーバを構築する
- 基本的にリモートログインのみ
- リモートログインはSSHのみ
- Apache, MySQLを動かす
- メールも送れる
構築手順
Debianのインストール
- インストールしたのは Sarge
- CD-ROMを使ってインストールすると便利
- 基本システムをインストールした後は、taskselでプログラミング環境のみを選んでインストールする(X Window環境はいれない)
インストール後の設定
- 日本語入力環境の用意
- emacs21, freewnn-jserver, egg
- language-env
- 不要なサービスの停止(inetd)
/etc/inetd.confを編集する。
# diff inetd.conf.org inetd.conf 21,23c21,23 < discard stream tcp nowait root internal < discard dgram udp wait root internal < daytime stream tcp nowait root internal --- > #discard stream tcp nowait root internal > #discard dgram udp wait root internal > #daytime stream tcp nowait root internal 25c25 < time stream tcp nowait root internal --- > #time stream tcp nowait root internal 36c36 < ident stream tcp wait identd /usr/sbin/identd identd --- > #ident stream tcp wait identd /usr/sbin/identd identd
- tcpwrappersでサービスへのアクセス禁止
- hosts.denyに以下を追加
ALL: ALL }}} * hosts.allowに以下を追加 {{{ ALL: LOCAL sshd: ***任意の範囲***
- hosts.denyに以下を追加
- 不要なサービス(inetd起動でない)を起動させないようにします
/etc/rc2.d/以下のファイルのファイル名を変更する(S**をs**にする)。
torus:/etc/rc2.d# mv S14ppp s14ppp torus:/etc/rc2.d# mv S18portmap s18portmap torus:/etc/rc2.d# mv S21nfs-common s21nfs-common
MySQLをいれる
mysql-adminとmysql-clientをいれる
# apt-get install mysql-admin mysql-client
文字化け問題を本気で直すにしたがい、全部UTF8で管理するようにする/etc/mysql/my.cnfのmysqldの項目に
[mysqld] default-character-set=utf8 skip-character-set-client-handshake
とする。
apache2のインストール
apache2-mpm-preforkをインストール
そのあとは参考リンクを参照のこと
postfixのインストール
postfixをインストール
そのあとは参考リンクを参照のこと
参考リンク
- Debianスレッドテンプレ
- Debian 初級からの脱出
- ORCAプロジェクト:セキュリティ
http://www.orca.med.or.jp/orca/tec/network_security/security.rhtml
- 玄箱 Debianサーバ構築メモ
- KLOG: Debian の Apache2 で SSL セットアップ
- PostfixによるSMTPサーバ構築メモ