Pi-hole 是一款开源且免费的 DNS 沉洞服务器(DNS sinkhole),能够在不安装任何客户端侧软件的前提下为设备提供网络内容屏蔽服务,非常轻量易用。搭配上家中吃灰已久的树莓派,我们就能够轻松打造属于自己的广告屏蔽助手。1
但我们该如何真正的配置它呢?在实操中会出现很多的问题,下面将为大家带来自己的一点操作流程以及体会。
本文主要参考教程为此网站,并在此网站的基础上为大家排个雷。大家可以边看它边操作,出现的问题可以来对照解决。
首先我们需要将树莓派接入路由器,有线或无线均可,然后远程登录到树莓派上:
(现在默认大家已经来到了ssh或者远程连接的位置。 如果在这方面有所疑惑可以查询树莓派的SSH连接和 Windows远程桌面连接树莓派。
Pi-hole 提供了一键安装脚本:
curl -sSL | bash
当然我们也可以试试,因为这网络啊实在是太太太难成功了……
sudo apt install build-essential libgmp-dev m4 cmake libidn11-dev libreadline-dev
wget .
tar -xzf nettle-3.
cd nettle-3.6
./configure --libdir=/usr/local/lib
make -j $(nproc)
sudo make install
git clone .git && cd FTL
./build.sh
注意:这里可能会等很长一段时间,不要担心,你的树莓派没有坏掉,只是……慢……
你可以选择:砸掉买台新的 、泡杯茶 、打几把游戏 ,然后等待他慢慢的成功
./build.sh install
sudo service pihole-FTL restart
注:如果一切顺利,此时你应该已经成功下载好了FTL了
wget -O basic-install.sh
FTLinstall()
basic-install.sh
中,按下ctrl+F
,输入FTLinstall()
,搜索到该函数,在函数的第一行添加return 0
FTLinstall() {return 0 # 这里是我添加的return代码# Local, named variableslocal latesttaglocal str="Downloading and Installing FTL"printf " %b %s..." "${INFO}" "${str}"# Move into the temp ftl directorypushd "$(mktemp -d)" > /dev/null || { printf "Unable to make temporary directory for FTL binary download\n"; return 1; }# Always replace pihole-FTL.serviceinstall -T -m 0755 "${PI_HOLE_LOCAL_REPO}/advanced/Templates/pihole-FTL.service" "/etc/init.d/pihole-FTL"local ftlBranchlocal urlif [[ -f "/etc/pihole/ftlbranch" ]];thenftlBranch=$(</etc/pihole/ftlbranch)elseftlBranch="master"filocal binarybinary="${1}"# Determine which version of FTL to downloadif [[ "${ftlBranch}" == "master" ]];thenurl=""elseurl="/${ftlBranch}"fi# If the download worked,if curl -sSL --fail "${url}/${binary}" -o "${binary}"; then# get sha1 of the binary we just downloaded for verification.curl -sSL --fail "${url}/${binary}.sha1" -o "${binary}.sha1"# If we downloaded binary file (as opposed to text),if sha1sum --status --quiet -c "${binary}".sha1; thenprintf "# Before stopping FTL, we download the macvendor databasecurl -sSL ".db" -o "${PI_HOLE_CONFIG_DIR}/macvendor.db" || truechmod 644 "${PI_HOLE_CONFIG_DIR}/macvendor.db"chown pihole:pihole "${PI_HOLE_CONFIG_DIR}/macvendor.db"# Stop pihole-FTL service if availablestop_service pihole-FTL &> /dev/null# Install the new version with the correct permissionsinstall -T -m 0755 "${binary}" /usr/bin/pihole-FTL# Move back into the original directory the user was inpopd > /dev/null || { printf "Unable to return to original directory after FTL binary download.\n"; return 1; }# Installed the FTL serviceprintf "%b %b %s\n" "${OVER}" "${TICK}" "${str}"return 0# Otherwise,else# the download failed, so just go back to the original directorypopd > /dev/null || { printf "Unable to return to original directory after FTL binary download.\n"; return 1; }printf "%b %b %s\n" "${OVER}" "${CROSS}" "${str}"printf " %bError: Download of %s/%s failed (checksum error)%b\n" "${COL_LIGHT_RED}" "${url}" "${binary}" "${COL_NC}"return 1fi# Otherwise,elsepopd > /dev/null || { printf "Unable to return to original directory after FTL binary download.\n"; return 1; }printf "%b %b %s\n" "${OVER}" "${CROSS}" "${str}"# The URL could not be foundprintf " %bError: URL %s/%s not found%b\n" "${COL_LIGHT_RED}" "${url}" "${binary}" "${COL_NC}"return 1fi
}
sudo bash basic-install.sh
我们输入树莓派ip
/admin,可以看到界面就展现在我们眼前了:
基于树莓派的全能广告屏蔽助手 —— Pi-hole ↩︎
本文发布于:2024-02-04 05:14:34,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170699896752393.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |