自宅サーバー Fedora (Home) »  システム設定

システム設定

Fedora のシステム設定について解説しています。
OS をセキュアにするためのファイアーウォールの設定方法やシステムのバックアップ方法などを紹介します。

  • iptables でファイアーウォール構築
    Linux は Netfilter と呼ばれる強力なパケットフィルタリング機能を持っています。2.4.x 以降のカーネルで実装された Netfilter コンポーネントは iptables コマンドを操作することができます。ここではこの iptables を使ってファイアーウォールを構築する方法を紹介します。
  • rsync でシステムのバックアップ
    rsync はリモートホストにファイルを転送するためのプログラムです。rsync は高速かつ効率的にファイルを転送することができ、Web サーバーや FTP サーバーのコンテンツをコピーしてミラーサーバーを構築するために利用されることもあります。以下ではメインのサーバーがダウンした場合に代わりに運用できるようにバックアップマシンを 1 台用意して、メインサーバーとのシステム同期を行います。また rsync の通信を暗号化し、同期処理を完全自動化(パスワードの応答を省略)するために SSH の RSA 認証を使用します。
  • CUPS でプリンターの共有
    CUPS とは Common Unix Printing System の略で UNIX 系 OS で動作する印刷システムです。CUPS は印刷プロトコルとして IPP(Internet Printing Protocol)をサポートし、PPD(PostScript Printer Description)ファイルのサポートなどの機能を実装した強力な印刷システムです。ここでは Linux サーバーに Canon の複合機 PIXUS MP500 を接続してプリントサーバーを構築します。また CUPS の raw 印刷機能を有効してクライアントから直接 IPP ポートを使用して印刷を行うように設定を行います。こうすることによって Linux 用のプリンタードライバは不要になります。(Windows クライアントのドライバは必要)
  • キックスタートインストール
    キックスタートインストールを使うことで Fedora Core のインストール作業を自動化することができます。キックスタートインストールの実行には、キックスタートファイルである anaconda-ks.cfg が必要です。
  • Munin でリソース監視
    Munin は RRD Tool と連携してサーバー状態やトラフィックなどのあらゆる情報を表示するツールです。Perl で書かれており、HTML を作成しグラフに表示することができます。有名なトラフィック監視ツールの MRTG よりもインストールや設定が圧倒的に容易です。グラフ化したい監視対象のサービスなどは、インストール後でもプラグインを使って簡単に拡張可能です。 Munin 実行ユーザーの作成 以下のように Munin を実行するユーザーを作成します。 # groupadd -g 4949 munin# useradd -u 4949 -g munin -s /sbin/nologin munin RRD Tool、Perl ライブラリのインストール Munin の動作に必要な RRD Tool や Perl ライブラリを yum を使ってインストールします。 # yum -y install perl-rrdtool perl-HTML-Template perl-Net-Server perl-libwww-perl Munin のインストール Munin のソースファイルを Munin 公式サイト からダウンロードします。 # wget -P /usr/local/src http://internap.dl.sourceforge.net/sourceforge/munin/munin_1.2.6.tar.gz インストール先となるディレクトリを作成し、ソースファイルを保存したディレクトリに移動します。 # mkdir /usr/local/munin-1.2.6# cd /usr/local/src 続いてダウンロードしたソースファイルを展開してコンパイルとインストールを行います。 # tar xzf munin_1.2.6.tar.gz# cd munin-1.2.6 ここで Makefile.config を編集してインストール先を変更します。 # vi Makefile.config /usr/local/src/munin-1.2.6/Makefile.config # This file specifies where Munin will look for things after you've# run 'make' in the source directory.  Modify it to suit your needs.# DESTDIR is empty during building, and optionally set to point to# a shadow tree during make install.## the base of the Munin installation.#PREFIX     = $(DESTDIR)/usr/local/munin_1.2.6# Where Munin keeps its configurations (server.conf, client.conf, ++)CONFDIR    = $(PREFIX)/etc Munin の監視クライアントとノードをインストールします。 # make install-main# make install-node install-node-plugins Munin のディレクトリを /usr/local/munin としてアクセスできるようにシンボリックリンクを作成します。 # ln -sfn /usr/local/munin-1.2.6 /usr/local/munin Munin の設定 以下のようにスクリプトを実行してプラグインの設定を行います。 # /usr/local/munin/sbin/munin-node-configure --shell | sh Munin の自動起動スクリプト Munin の自動起動スクリプトは Munin のソースファイル(dists/redhat)に含まれています。これを /etc/rc.d/init.d/munin-node ファイルとしてコピーします。 # cp /usr/local/src/munin-1.2.6/dists/redhat/munin-node.rc /etc/rc.d/init.d/munin-node インストールディレクトリを変更したので、以下のように起動スクリプトを修正します。 # vi Makefile.config /usr/local/src/munin-1.2.6/Makefile.config #! /bin/sh## munin-node    Control the Munin Node Server (formerly Linpro RRD client)## chkconfig: 2345 90 10# description: munin node agents# processname: munin-node# config: /usr/local/munin/etc/munin-node.conf# pidfile: /var/run/munin/munin-node.pid# Source function library.. /etc/rc.d/init.d/functionsRETVAL=0PROCNAME=munin-nodemkdir -p /var/run/munin 2>/dev/nullchown munin /var/run/munin# See how we were called.case "$1" in  start)        echo -n "Starting Munin Node: "        /usr/local/munin/sbin/munin-node &... 作成した自動起動スクリプトに実行権限を与えてサービスの登録を行います。 # chmod 755 /etc/rc.d/init.d/munin-node# chkconfig --add munin-node 自動起動スクリプトを使って Munin を起動する場合は以下のように実行します。 # /etc/rc.d/init.d/munin-node start cron の登録 crontab に 5 分おきに実行するように登録します。 # echo '*/5 * * * * munin /usr/local/munin/bin/munin-cron 2>&1' >> /etc/crontab