カテゴリ
リンク

当サイトは、玄箱PRO (KURO-BOX/Pro)を中心とした組み込み、Linuxと電子工作を扱っています。
会社案内

情報セキュリティおよび個人情報の取り扱いについて


コメントとトラックバックは、spamを予防するために、編集担当が公開の作業をするまで非公開になっています。コメントはそれぞれ投稿した人のものです。

 この「コーヒーの有無をオンラインでチェックしたい」最終回では、環境やプログラムについて補足をしておきたいと思います。

 玄箱(pro)の環境

 現時点での Linux のバージョンです。
kurobox:~# uname -a
Linux kurobox 2.6.12.6-oabi #3 Fri Jun 8 13:47:34 JST 2007 armv5tejl GNU/Linux
 cc は gcc が指定されます。

kurobox:~# ls -l /usr/bin/cc
lrwxrwxrwx 1 root root 20 2007-10-13 13:30 /usr/bin/cc -> /etc/alternatives/cc
kurobox:~# ls -l /etc/alternatives/cc
lrwxrwxrwx 1 root root 12 2007-10-13 13:30 /etc/alternatives/cc -> /usr/bin/gcc
 gcc のバージョンを下に表示しました。
kurobox:~# which gcc
/usr/bin/gcc
kurobox:~#  /usr/bin/gcc --version
gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

●wwwcount のインストール方法

 wwwcount2.5 として検索エンジンで探します。


  そうしたところから、wwwcount2.5.tar.gz を持ってきます。実際のインストール方法は、
    http://www.rouge.gr.jp/~fuku/tips/wwwcount/
などを参照してみてください。ここでもインストールを簡単に紹介しましょう。
 適当な場所に wwwcount2.5.tar.gz が用意できたら、tar xvfz wwwcount2.5.tar.gz を実行して解凍をします。その後、
    cd wwwcount2.5
 して、make と入力します。するとヘルプが表示されますから、下に示す順番で make を行います。

       Kurobox:/home/k-wada/kurobox/wwwcount2.5# make
            ==========================================================
            Please type the approptiate tag with make
             all       - compile all with default settings in src/config.h

             makefiles - generate Makefiles
             all_libs  - make the libraries
             Count.cgi - compile the Count.cgi program
             mkstrip   - compile the mkstrip utility
             extdgts   - compile the extdgts utility
             config.h  - generate the config.h header (interactive)
             cfg       - generate count.cfg file
             install   - install everything (interactive)
             clean     - remove object all object files etc
             pristine  - clean real good
            ==========================================================

            (環境設定をする)
            ./configure 

            (ライブラリの生成)
            make all_libs

            (ヘッダ・ファイル生成)
            make config.h
            -----
            Your configuration:
            ----------------------------------------------------------------
            CgiBinDir=/var/www/apache2-default/cgi-bin
            BaseDir= /var/www/Counter
            DigitDir=/var/www/Counter/digits
            ConfDir= /var/www/Counter/conf
            ConfFile=count.cfg
            DataDir=/var/www/Counter/data
            LogDir=/var/www/Counter/logs
            LogFile=Count2_5.log
            ----------------------------------------------------------------
            Everything looks OK [y|n]?

            (wwwcount の設定ファイル生成)
            make cfg

            (例としての設定値を表示しておいた)
            cat count.cfg
            [options]
              auto_file_creation=Yes
              strict_mode=Yes
              allow_rgb_database=Yes
              count_reload=Yes
              log_error_messages=Yes
              show_error_messages_to_browsers=Yes


            ; You can specify IP address of the hosts you want to ignore from counting.
            ; netmasks can be used to ignore a entire network or a specificrange of
            ; hosts in the network. Read the counter documentation to know about
            ; netmasks. Wild card can be used as well. one item per line.
            ;
            [ignore IPs]
              192.168.1.8

            ;
            ; All possible names and IP addresses by which your host can be referred.
            ; These hosts can access the counter remotely or locally. Host running
            ; the http server must exist here. Wild card can be used. one item per line.
            ;
            [authorized]
              kurobox.azland.ne.jp
              kurobox
              192.168.1.8
              test.counter.com

            (実行ファイルを生成)
            make Count.cgi

            (インストールの実行)
            make install
            -------------------------------------------------------------------------
            Your configuration is shown below. You are only allowed to change the
            cgi-bin directory. If you want to change it, edit the file Config.tmpl
            and change the variable CGIBIN_DIR to the appropriate directory. Do not change
            anything else.

            cgi-bin directory   = /var/www/apache2-default/cgi-bin
            conf directory      = /var/www/Counter/conf
            conf file to install= count.cfg
            digit directory     = /var/www/Counter/digits
            data directory      = /var/www/Counter/data
            log directory       = /var/www/Counter/logs
            log file            = Count2_5.log
            RGB file to install = ./data/rgb.txt
            -------------------------------------------------------------------------
            Press Control-C to abort
            Continue [y|n]?
            proceeding...

                Now if you know what user and group id child processes of http
                server use, I can change the ownership and access permission
                accordigly. If you do not know, they are usually defined in the
                file httpd.conf with User and Group. I suggest create a unique
                user and group say httpd and set the User and Group to httpd.

            *Do you know the user and group id of httpd' child process [y|n]:? y
            *Enter user id of httpd's child process [no default]:? www-data
            *Enter group id of httpd's child process [no default]:? www-data
            installing Count.cgi->/var/www/apache2-default/cgi-bin
            installing count.cfg->/var/www/Counter/conf

            (パーミッションを設定しておく)
            kurobox:/home/k-wada/kurobox/wwwcount2.5# ls -l /var/www/apache2-default/cgi-bin/Count.cgi
            -rwx------ 1 www-data www-data 167830 2007-12-16 17:29 /var/www/apache2-default/cgi-bin/Count.cgi
            kurobox:/home/k-wada/kurobox/wwwcount2.5#
            kurobox:/var/www/Counter# chown www-data:www-data data/
 最後は、カウンタの画像が表示されるかを確認します。
 例えば、こんなソースを書きます。

            <img src="/apache2-default/cgi-bin/Count.cgi?df=sample.dat&dd=A"><br>
            <img src="/apache2-default/cgi-bin/Count.cgi?df=coffee.dat&dd=B">

 これにWebブラウザでアクセスすると、カウンタが見えるはずです。

62wwwcount.JPG  ここで、sample.dat はあらかじめ用意されたカウント用のデータ・ファイルです。一方、coffee.dat はこのソースで新たに指定し、Count.cgi で自動生成されるカウンタ・ファイルとなっています。また、dd でカウント用の画像を指定しますから、気に入ったものを検索エンジンで見つけてインストールしてください。
   インストールする場所はここになります。

            kurobox:/var/www/apache2-default/tmp# ls /var/www/Counter/digits/
            A  B  C  D  E  bang  cd  cdd  cdr

 これらのディレクトリに中には、数字画像データが集約された strip.gif が入っています。このファイルの作り方と活用方法は別記事でも紹介することにしましょう。
 カウンタ表示がうまく行かない場合、ディレクトリ指定間違いや所定のパーミッションになっていないことが多いので再確認をしてください。

<和田 好司>

 カテゴリ 

 

トラックバック(0)

このブログ記事を参照しているブログ一覧: コーヒーの有無をオンラインでチェックしたい(その6)

このブログ記事に対するトラックバックURL: http://www.eleki-jack.com/mt/mt-tb.cgi/1192

コメントする

おすすめ書籍
Powered by
Movable Type 4.1