LoginSignup
1
5

More than 5 years have passed since last update.

[メモ] OpenMediaVault3サーバで、pi-hole(ドメインベースの広告除去)もやらせる

Last updated at Posted at 2016-11-30

概要

環境

  • Raspberry Pi 2
    • Raspbian: 2016-09-23-raspbian-jessie-lite.imgから、update
    • OMV(3.0.54)
    • USB接続メディア HDD/フラッシュ
  • Banana Pro
    • armbian: Armbian_5.20_Bananapipro_Debian_jessie_4.7.3.img から、update
    • OMV(3.0.54)
    • SATA HDD
    • USB接続メディア HDD/フラッシュ

# Intel版でもOK

手順

  1. OMV環境を準備
  2. コマンドラインで..

    # 1. pi-holeをインストール
    curl -L https://install.pi-hole.net | bash
    #
    # 2. rootになって
    sudo bash
    #
    # 3. lighttpdを削除.
    systemctl status lighttpd
    systemctl stop lighttpd
    systemctl disable lighttpd
    apt-get remove lighttpd --purge
    #
    # 4. 設定を。ポートはぶつからないように81番.
    cat <<EOF >  /etc/nginx/sites-available/pihole
    server {
            listen 81 default_server;
            listen [::]:81 default_server;
            root /var/www/html;
            index index.html index.htm index.php;
            server_name _;
            autoindex off;
            location / {
              expires max;
              return 204 'pixel';
            }
            location /admin {
              root   /var/www/html;
              index index.php;
              auth_basic "Restricted"; #For Basic Auth
              auth_basic_user_file /etc/nginx/.htpasswd;  #For Basic Auth
            }
            location ~ \.php$ {
              include snippets/fastcgi-php.conf;
              fastcgi_pass unix:/var/run/php5-fpm.sock;
            }
    }
    EOF
    #
    # 5. Symlinkをはる
    cd  /etc/nginx/sites-enabled/
    ln -sf ../sites-available/pihole .
    #
    # 6. nginx再起動
    systemctl restart nginx
    #
    # 7. htpasswdをインストール
    apt-get install apache2-utils -y
    #
    # 8. ベーシック認証のユーザとパスワード設定 user_nameは、うまいやつを。
    htpasswd -c /etc/nginx/.htpasswd user_name
    
  3. ブラウザから、http://IPアドレス:81/admin を開いて、ユーザとパスワード入力すると、pi-hole管理画面がでてくる

  4. クライアントのDNSを、こいつのIPアドレスに設定する。(DHCPサバでうまく配布できるなら、そっちのがラク)

その他

  • だれか、もっとうまい設定とか、OMVのプラグインをつくってくれなだろうか。
1
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
5