当前位置:   article > 正文

Openwrt 安装AdGuard Home及MosDNS v5.3.1最新方法

mosdns

  AdGuard Home安装方法

第一种:docker安装adguardhome

https://hub.docker.com/r/adguard/adguardhome

SSH连接路由器

拉取 Docker 镜像

此命令将拉取最新的稳定版

docker pull adguard/adguardhome

在手动安装容器

mosdns安装方法:

打开网止:https://github.com/IrineSistiana/mosdns

https://irine-sistiana.gitbook.io/mosdns-wiki/mosdns-v4

安装预构建包

  • 登录 OpenWrt 终端(SSH)

  • 安装curl

    1. opkg update
    2. opkg install curl
  • 执行安装脚本(多架构支持)

    sh -c "$(curl -ksS https://raw.githubusercontent.com/sbwml/luci-app-mosdns/v5/install.sh)"
    即可
    第二种方式:可以通过openwrt的TTYD登录
    使用 vi  install.sh
    输入i
    复制如下代码
    1. #!/bin/sh
    2. RED_COLOR='\e[1;31m'
    3. GREEN_COLOR='\e[1;32m'
    4. RES='\e[0m'
    5. # OpenWrt Info
    6. if [ -f /etc/openwrt_release ]; then
    7. . /etc/openwrt_release
    8. version=$(echo ${DISTRIB_RELEASE%%.*})
    9. platform=$(echo $DISTRIB_ARCH)
    10. else
    11. echo -e "${RED_COLOR}Unknown OpenWRT Version${RES}"
    12. exit 1
    13. fi
    14. # TMP
    15. TMPDIR=$(mktemp -d) || exit 1
    16. # GitHub mirror
    17. ip_info=$(curl -sk https://ip.cooluc.com)
    18. country_code=$(echo $ip_info | sed -r 's/.*country_code":"([^"]*).*/\1/')
    19. if [ $country_code = "CN" ]; then
    20. google_status=$(curl -I -4 -m 3 -o /dev/null -s -w %{http_code} http://www.google.com/generate_204)
    21. if [ ! $google_status = "204" ];then
    22. mirror="https://github.cooluc.com/"
    23. fi
    24. fi
    25. # Check
    26. CHECK() (
    27. echo -e "\r\n${GREEN_COLOR}Checking available space ...${RES}"
    28. ROOT_SPACE=$(df -m /usr | awk 'END{print $4}')
    29. if [ $ROOT_SPACE -lt 40 ]; then
    30. echo -e "\r\n${RED_COLOR}Error, The system storage space is less than 40MB.${RES}"
    31. exit 1;
    32. fi
    33. echo -e "\r\n${GREEN_COLOR}Checking platform ...${RES}\r\n"
    34. prebuilt="aarch64_cortex-a53 aarch64_cortex-a72 aarch64_generic arm_arm1176jzf-s_vfp arm_arm926ej-s arm_cortex-a15_neon-vfpv4 arm_cortex-a5_vfpv4 arm_cortex-a7 arm_cortex-a7_neon-vfpv4 arm_cortex-a8_vfpv3 arm_cortex-a9 arm_cortex-a9_neon arm_cortex-a9_vfpv3-d16 arm_fa526 arm_mpcore arm_xscale i386_pentium-mmx i386_pentium4 mips64_octeonplus mips_24kc mips_4kec mips_mips32 mipsel_24kc mipsel_24kc_24kf mipsel_74kc mipsel_mips32 x86_64"
    35. verif=$(expr match "$prebuilt" ".*\($platform\)")
    36. if [[ ! $verif ]]; then
    37. echo -e "${RED_COLOR}Error! The current \"$platform\" platform is not currently supported.${RES}"
    38. exit 1;
    39. else
    40. echo -e "${GREEN_COLOR}Update opkg sources ...${RES}"
    41. opkg update
    42. opkg install luci-compat
    43. fi
    44. )
    45. DOWNLOAD() (
    46. echo -e "\r\n${GREEN_COLOR}Download Packages ...${RES}\r\n"
    47. # get repos info
    48. mosdns_version=`curl -sk https://api.github.com/repos/sbwml/luci-app-mosdns/releases | grep "tag_name" | grep v5 | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//;s/ //'`
    49. curl -sk --connect-timeout 10 "https://api.github.com/repos/sbwml/luci-app-mosdns/releases" | grep "browser_download_url" | grep "$mosdns_version" > $TMPDIR/releases.txt
    50. if [ $? -ne 0 ]; then
    51. echo -e "${RED_COLOR}Failed to get version information, Please check the network status.${RES}"
    52. rm -rf $TMPDIR
    53. exit 1
    54. fi
    55. mosdns=$(cat $TMPDIR/releases.txt | grep "browser_download_url" | grep mosdns_5 | grep $platform.ipk | head -1 | awk '{print $2}' | sed 's/\"//g')
    56. v2dat=$(cat $TMPDIR/releases.txt | grep "browser_download_url" | grep v2dat_ | grep $platform.ipk | head -1 | awk '{print $2}' | sed 's/\"//g')
    57. luci_app=$(cat $TMPDIR/releases.txt | grep "browser_download_url" | grep luci-app-mosdns_ | head -1 | awk '{print $2}' | sed 's/\"//g')
    58. luci_i18n=$(cat $TMPDIR/releases.txt | grep "browser_download_url" | grep luci-i18n-mosdns-zh-cn | head -1 | awk '{print $2}' | sed 's/\"//g')
    59. geoip=$(cat $TMPDIR/releases.txt | grep "browser_download_url" | grep v2ray-geoip | head -1 | awk '{print $2}' | sed 's/\"//g')
    60. geosite=$(cat $TMPDIR/releases.txt | grep "browser_download_url" | grep v2ray-geosite | head -1 | awk '{print $2}' | sed 's/\"//g')
    61. # download
    62. echo -e "${GREEN_COLOR}Download $mosdns ...${RES}"
    63. curl --connect-timeout 30 -m 600 -kLo "$TMPDIR/mosdns_$platform.ipk" $mirror$mosdns
    64. if [ $? -ne 0 ]; then
    65. echo -e "${RED_COLOR}Error! download $mosdns failed.${RES}"
    66. rm -rf $TMPDIR
    67. exit 1
    68. fi
    69. echo -e "${GREEN_COLOR}Download $v2dat ...${RES}"
    70. curl --connect-timeout 30 -m 600 -kLo "$TMPDIR/v2dat_$platform.ipk" $mirror$v2dat
    71. if [ $? -ne 0 ]; then
    72. echo -e "${RED_COLOR}Error! download $v2dat failed.${RES}"
    73. rm -rf $TMPDIR
    74. exit 1
    75. fi
    76. echo -e "${GREEN_COLOR}Download $luci_app ...${RES}"
    77. curl --connect-timeout 30 -m 600 -kLo "$TMPDIR/luci-app-mosdns.ipk" $mirror$luci_app
    78. if [ $? -ne 0 ]; then
    79. echo -e "${RED_COLOR}Error! download $luci_app failed.${RES}"
    80. rm -rf $TMPDIR
    81. exit 1
    82. fi
    83. echo -e "${GREEN_COLOR}Download $luci_i18n ...${RES}"
    84. curl --connect-timeout 30 -m 600 -kLo "$TMPDIR/luci-i18n-mosdns-zh-cn.ipk" $mirror$luci_i18n
    85. if [ $? -ne 0 ]; then
    86. echo -e "${RED_COLOR}Error! download $luci_i18n failed.${RES}"
    87. rm -rf $TMPDIR
    88. exit 1
    89. fi
    90. echo -e "${GREEN_COLOR}Download $geoip ...${RES}"
    91. curl --connect-timeout 30 -m 600 -kLo "$TMPDIR/geoip.ipk" $mirror$geoip
    92. if [ $? -ne 0 ]; then
    93. echo -e "${RED_COLOR}Error! download $geoip failed.${RES}"
    94. rm -rf $TMPDIR
    95. exit 1
    96. fi
    97. echo -e "${GREEN_COLOR}Download $geosite ...${RES}"
    98. curl --connect-timeout 30 -m 600 -kLo "$TMPDIR/geosite.ipk" $mirror$geosite
    99. if [ $? -ne 0 ]; then
    100. echo -e "${RED_COLOR}Error! download $geosite failed.${RES}"
    101. rm -rf $TMPDIR
    102. exit 1
    103. fi
    104. )
    105. INSTALL() (
    106. # Install
    107. echo -e "\r\n${GREEN_COLOR}Install Packages ...${RES}\r\n"
    108. opkg install --force-overwrite $TMPDIR/geoip.ipk
    109. opkg install --force-overwrite $TMPDIR/geosite.ipk
    110. opkg install $TMPDIR/v2dat_$platform.ipk
    111. opkg install $TMPDIR/mosdns_$platform.ipk
    112. opkg install $TMPDIR/luci-app-mosdns.ipk
    113. opkg install $TMPDIR/luci-i18n-mosdns-zh-cn.ipk
    114. rm -rf $TMPDIR /tmp/luci-*
    115. echo -e "${GREEN_COLOR}Done!${RES}"
    116. )
    117. CHECK && DOWNLOAD && INSTALL

    保存

    :wq

    sh ./install.sh

    运行即可。

    也可手动下载



    Download https://github.com/sbwml/luci-app-mosdns/releases/download/v5.3.1/mosdns_5.3.1-1_aarch64_generic.ipk 

    Download https://github.com/sbwml/luci-app-mosdns/releases/download/v5.3.1/v2dat_2022-12-15-47b8ee51-1_aarch64_generic.ipk

    Download https://github.com/sbwml/luci-app-mosdns/releases/download/v5.3.1/luci-app-mosdns_1.5.16_all.ipk 

    Download https://github.com/sbwml/luci-app-mosdns/releases/download/v5.3.1/luci-i18n-mosdns-zh-cn_git-23.309.43711-74d15c2_all.ipk 

    Download https://github.com/sbwml/luci-app-mosdns/releases/download/v5.3.1/v2ray-geoip_2023-11-06_all.ipk 
     
    Download https://github.com/sbwml/luci-app-mosdns/releases/download/v5.3.1/v2ray-geosite_2023-11-06_all.ipk 
      

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/AllinToyou/article/detail/497139
推荐阅读
相关标签
  

闽ICP备14008679号