数码之家

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 739|回复: 3

金亚致家2号 RK3188 安卓4.2安装 Dropbear entware 等

[复制链接]
发表于 2026-9-16 13:16:27 | 显示全部楼层 |阅读模式
本帖最后由 wilywx 于 2026-9-16 13:22 编辑

找出来个老盒子,金亚致家2号3188的,遥控不见了。
以前刷过ubuntu,bug一堆,也刷了安卓4.4的,无线不能用。
内存这么大,可惜了,就想着有没有啥能玩玩的。
记录和分享一下。



  1. ######################################################################
  2. ## 1. 安装 ssh 服务端 (ssh文件夹里的一键包)
  3. ## 2. 安装 entware (entware文件夹里的一键包)
  4. ## 3. 安装 aria2 (可选)
  5. ######################################################################

  6. # 挂载可写的命令,备用
  7. mount -o remount,rw /system;mount -o remount,rw /data;mount -o remount,rw /
  8. # 改回只读
  9. mount -o ro,remount /
  10. # 查看大小
  11. du -sk * | sort -n
复制代码
  1. ######################################################################
  2. ## 4. 安装配置 samba (盒子连接ssh 后执行)
  3. ######################################################################

  4. # A. 安装 samba4-server
  5. /opt/bin/opkg install samba4-server

  6. # B. 创建必要目录
  7. mkdir -p /opt/var/log/samba
  8. mkdir -p /opt/var/lib/samba/private
  9. mkdir -p /opt/var/cache/samba
  10. mkdir -p /opt/var/run/samba/ncalrpc

  11. # C. 修复启动脚本 shebang + PATH
  12. #    安卓没有 /bin/sh,必须改 /system/bin/sh
  13. #    开机自启时 PATH 里没有 /opt/sbin,S91smb 里的 smbd/nmbd 会 not found
  14. sed -i '1s|^#!/bin/sh|#!/system/bin/sh|' /opt/etc/init.d/S91smb
  15. sed -i '/^#!\/system\/bin\/sh/a export PATH=/opt/bin:/opt/sbin:$PATH' /opt/etc/init.d/S91smb
  16. sed -n '1,3p' /opt/etc/init.d/S91smb

  17. # D. 修复安卓 NSS 缺陷(Samba 靠 NSS 解析用户,安卓 libc 没标准 NSS,guest 报 NT_STATUS_NO_SUCH_USER)
  18. #    注意:这三个文件每次开机都会被清空,所以必须写进开机自启脚本里重建
  19. mkdir -p /sqlite_stmt_journals

  20. echo "root:x:0:0:root:/root:/opt/bin/sh" > /opt/etc/passwd
  21. echo "nobody:x:99:99:nobody:/:/opt/bin/sh" >> /opt/etc/passwd

  22. echo "root:x:0:" > /opt/etc/group
  23. echo "nobody:x:99:" >> /opt/etc/group

  24. echo "passwd:     files" > /opt/etc/nsswitch.conf
  25. echo "shadow:     files" >> /opt/etc/nsswitch.conf
  26. echo "group:      files" >> /opt/etc/nsswitch.conf
  27. echo "hosts:      files dns" >> /opt/etc/nsswitch.conf

  28. # E. 修复 /tmp 不存在(Samba 建 IPC$ 共享要访问 /tmp,安卓没有,报 canonicalize_connect_path failed)
  29. #    注意:busybox 的 ln 对 -f 有 bug,会报 link failed,所以不要加 -f
  30. mount -o remount,rw / 2>/dev/null
  31. ln -s /opt/tmp /tmp

  32. # F. 写 smb.conf(匿名可读写 /data)
  33. mkdir -p /opt/etc/samba
  34. echo '[global]' > /opt/etc/samba/smb.conf
  35. echo '   workgroup = WORKGROUP' >> /opt/etc/samba/smb.conf
  36. echo '   netbios name = AndroidBox' >> /opt/etc/samba/smb.conf
  37. echo '   server string = Entware Samba' >> /opt/etc/samba/smb.conf
  38. echo '   security = user' >> /opt/etc/samba/smb.conf
  39. echo '   map to guest = Bad User' >> /opt/etc/samba/smb.conf
  40. echo '   guest account = nobody' >> /opt/etc/samba/smb.conf
  41. echo '   tmpdir = /opt/tmp' >> /opt/etc/samba/smb.conf
  42. echo '   log file = /opt/var/log/samba/log.%m' >> /opt/etc/samba/smb.conf
  43. echo '   log level = 1' >> /opt/etc/samba/smb.conf
  44. echo '   max log size = 50' >> /opt/etc/samba/smb.conf
  45. echo '   load printers = no' >> /opt/etc/samba/smb.conf
  46. echo '   printcap name = /dev/null' >> /opt/etc/samba/smb.conf
  47. echo '   disable spoolss = yes' >> /opt/etc/samba/smb.conf
  48. echo '   socket options = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE' >> /opt/etc/samba/smb.conf
  49. echo '   smb encrypt = disabled' >> /opt/etc/samba/smb.conf
  50. echo '   min protocol = SMB2' >> /opt/etc/samba/smb.conf
  51. echo '   max protocol = SMB3' >> /opt/etc/samba/smb.conf
  52. echo '' >> /opt/etc/samba/smb.conf
  53. echo '[data]' >> /opt/etc/samba/smb.conf
  54. echo '   comment = Data Share' >> /opt/etc/samba/smb.conf
  55. echo '   path = /data' >> /opt/etc/samba/smb.conf
  56. echo '   browseable = yes' >> /opt/etc/samba/smb.conf
  57. echo '   writable = yes' >> /opt/etc/samba/smb.conf
  58. echo '   guest ok = yes' >> /opt/etc/samba/smb.conf
  59. echo '   guest only = yes' >> /opt/etc/samba/smb.conf
  60. echo '   force user = root' >> /opt/etc/samba/smb.conf
  61. echo '   create mask = 0777' >> /opt/etc/samba/smb.conf
  62. echo '   directory mask = 0777' >> /opt/etc/samba/smb.conf

  63. # G. 启动
  64. /opt/etc/init.d/S91smb start
  65. sleep 2
  66. ps | grep smbd

  67. # H. 验证端口(应看到 139 和 445 都在 LISTEN)
  68. netstat -tlnp | grep -E "445|139"

  69. # I. 备份一份干净的 smb.conf,供开机自启时恢复
  70. cp /opt/etc/samba/smb.conf /data/dropbear/smb.conf.bak

  71. # J. 创建开机自动启动脚本(含 NSS 重建 + /tmp 软链 + smb.conf 恢复)
  72. rm -rf /data/dropbear/samba_start.sh
  73. echo '#!/system/bin/sh' > /data/dropbear/samba_start.sh
  74. echo 'while [ ! -x /opt/sbin/smbd ]; do sleep 1; done' >> /data/dropbear/samba_start.sh
  75. echo 'sleep 3' >> /data/dropbear/samba_start.sh
  76. echo 'mkdir -p /sqlite_stmt_journals' >> /data/dropbear/samba_start.sh
  77. echo 'echo "root:x:0:0:root:/root:/opt/bin/sh" > /opt/etc/passwd' >> /data/dropbear/samba_start.sh
  78. echo 'echo "nobody:x:99:99:nobody:/:/opt/bin/sh" >> /opt/etc/passwd' >> /data/dropbear/samba_start.sh
  79. echo 'echo "root:x:0:" > /opt/etc/group' >> /data/dropbear/samba_start.sh
  80. echo 'echo "nobody:x:99:" >> /opt/etc/group' >> /data/dropbear/samba_start.sh
  81. echo 'echo "passwd:     files" > /opt/etc/nsswitch.conf' >> /data/dropbear/samba_start.sh
  82. echo 'echo "shadow:     files" >> /opt/etc/nsswitch.conf' >> /data/dropbear/samba_start.sh
  83. echo 'echo "group:      files" >> /opt/etc/nsswitch.conf' >> /data/dropbear/samba_start.sh
  84. echo 'echo "hosts:      files dns" >> /opt/etc/nsswitch.conf' >> /data/dropbear/samba_start.sh
  85. echo 'mount -o remount,rw / 2>/dev/null' >> /data/dropbear/samba_start.sh
  86. echo 'ln -s /opt/tmp /tmp' >> /data/dropbear/samba_start.sh
  87. echo 'mkdir -p /opt/var/log/samba /opt/var/lib/samba/private /opt/var/cache/samba /opt/var/run/samba/ncalrpc' >> /data/dropbear/samba_start.sh
  88. echo 'mkdir -p /opt/etc/samba' >> /data/dropbear/samba_start.sh
  89. echo 'cp /data/dropbear/smb.conf.bak /opt/etc/samba/smb.conf' >> /data/dropbear/samba_start.sh
  90. echo 'killall smbd nmbd 2>/dev/null' >> /data/dropbear/samba_start.sh
  91. echo 'sleep 1' >> /data/dropbear/samba_start.sh
  92. echo '/opt/etc/init.d/S91smb start' >> /data/dropbear/samba_start.sh
  93. chmod 755 /data/dropbear/samba_start.sh
  94. cat /data/dropbear/samba_start.sh

  95. # K. 添加到开机启动
  96. mount -o remount,rw /system
  97. sed -i '/samba/d' /system/bin/chrome.sh
  98. echo '( /data/dropbear/samba_start.sh >>/opt/var/log/samba/boot.log 2>&1 ) &' >> /system/bin/chrome.sh
  99. mount -o remount,ro /system
  100. cat /system/bin/chrome.sh

  101. ######################################################################
  102. ## 5. 安装 qbittorrent 并开机自动启动
  103. ######################################################################

  104. # A. 提前创建临时目录,以免部署出错,以后加到开机自启动里
  105. mkdir -p /sqlite_stmt_journals

  106. # B. 安装
  107. /opt/bin/opkg install qbittorrent

  108. # C. 启动后访问 http://192.168.0.5:8080/ 即可
  109. /opt/bin/qbittorrent-nox -d --profile=/data/qb_config

  110. # D. 创建自动启动脚本

  111. rm -rf /data/dropbear/qbittorrent_start.sh;echo '#!/system/bin/sh' > /data/dropbear/qbittorrent_start.sh;echo 'while [ ! -x /opt/bin/qbittorrent-nox ]; do sleep 1; done' >> /data/dropbear/qbittorrent_start.sh;echo 'sleep 2' >> /data/dropbear/qbittorrent_start.sh;echo 'pkill qbittorrent >/dev/null 2>&1' >> /data/dropbear/qbittorrent_start.sh;echo '/opt/bin/qbittorrent-nox -d --profile=/data/qb_config' >> /data/dropbear/qbittorrent_start.sh;chmod 755 /data/dropbear/qbittorrent_start.sh;cat /data/dropbear/qbittorrent_start.sh

  112. # E. 添加到开机启动

  113. echo 'su -c /data/dropbear/qbittorrent_start.sh' >> /system/bin/chrome.sh;cat /system/bin/chrome.sh

  114. ######################################################################
  115. ## 6. PHP环境
  116. ######################################################################

  117. # 建空的必要目录

  118. mount -o remount,rw /system;mount -o remount,rw /data;mount -o remount,rw /
  119. mkdir -p /sqlite_stmt_journals/
  120. mkdir -p /opt/www /opt/tmp

  121. # 先下载

  122. BASE=http://bin.entware.net/armv7sf-k2.6/archive && for p in php7_7.4.26-1_armv7-2.6.ipk php7-cgi_7.4.26-1_armv7-2.6.ipk php7-cli_7.4.26-1_armv7-2.6.ipk php7-fastcgi_7.4.26-1_armv7-2.6.ipk php7-mod-{mysqli,pdo,pdo-mysql,mysqlnd,session,mbstring,curl,gd,iconv,zip,sockets,sqlite3,pdo-sqlite,xml,xmlreader,xmlwriter,dom,simplexml,fileinfo,ctype,tokenizer,phar}_7.4.26-1_armv7-2.6.ipk; do axel -n 4 "$BASE/$p"; done

  123. ## 安装

  124. echo "==== [1] lighttpd ===="
  125. opkg install lighttpd lighttpd-mod-fastcgi

  126. echo "==== [2] PHP7 核心 ===="
  127. opkg install php7_7.4.26-1_armv7-2.6.ipk
  128. opkg install php7-cli_7.4.26-1_armv7-2.6.ipk
  129. opkg install php7-cgi_7.4.26-1_armv7-2.6.ipk
  130. opkg install php7-fastcgi_7.4.26-1_armv7-2.6.ipk

  131. echo "==== [3] 依赖:openssl / pdo / mysqlnd ===="
  132. # opkg install php7-mod-openssl_7.4.26-1_armv7-2.6.ipk
  133. opkg install php7-mod-pdo_7.4.26-1_armv7-2.6.ipk
  134. opkg install php7-mod-mysqlnd_7.4.26-1_armv7-2.6.ipk

  135. echo "==== [4] 数据库 ===="
  136. opkg install php7-mod-mysqli_7.4.26-1_armv7-2.6.ipk
  137. opkg install php7-mod-pdo-mysql_7.4.26-1_armv7-2.6.ipk
  138. opkg install php7-mod-sqlite3_7.4.26-1_armv7-2.6.ipk
  139. opkg install php7-mod-pdo-sqlite_7.4.26-1_armv7-2.6.ipk

  140. echo "==== [5] 常用扩展 ===="
  141. opkg install php7-mod-session_7.4.26-1_armv7-2.6.ipk
  142. opkg install php7-mod-mbstring_7.4.26-1_armv7-2.6.ipk
  143. opkg install php7-mod-iconv_7.4.26-1_armv7-2.6.ipk
  144. opkg install php7-mod-curl_7.4.26-1_armv7-2.6.ipk
  145. opkg install php7-mod-gd_7.4.26-1_armv7-2.6.ipk
  146. opkg install php7-mod-zip_7.4.26-1_armv7-2.6.ipk
  147. opkg install php7-mod-sockets_7.4.26-1_armv7-2.6.ipk
  148. opkg install php7-mod-xml_7.4.26-1_armv7-2.6.ipk
  149. opkg install php7-mod-xmlreader_7.4.26-1_armv7-2.6.ipk
  150. opkg install php7-mod-xmlwriter_7.4.26-1_armv7-2.6.ipk
  151. opkg install php7-mod-dom_7.4.26-1_armv7-2.6.ipk
  152. opkg install php7-mod-simplexml_7.4.26-1_armv7-2.6.ipk
  153. opkg install php7-mod-fileinfo_7.4.26-1_armv7-2.6.ipk
  154. opkg install php7-mod-ctype_7.4.26-1_armv7-2.6.ipk
  155. opkg install php7-mod-tokenizer_7.4.26-1_armv7-2.6.ipk
  156. opkg install php7-mod-phar_7.4.26-1_armv7-2.6.ipk

  157. echo "==== [6] 修 php.ini ===="
  158. sed -i 's|^doc_root =|;doc_root =|' /opt/etc/php.ini

  159. echo "==== [7] .so 列表(核对 extension 名) ===="
  160. ls -1 /opt/lib/php/*.so

  161. echo "==== [8] 写 lighttpd 配置 ===="
  162. mkdir -p /opt/etc/lighttpd
  163. cat > /opt/etc/lighttpd/lighttpd.conf << 'EOF'
  164. server.modules = (
  165.         "mod_access",
  166.         "mod_fastcgi"
  167. )
  168. server.network-backend = "write"
  169. server.document-root = "/opt/www"
  170. index-file.names = ( "index.html", "index.htm", "index.php" )
  171. static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
  172. server.port = 80
  173. server.pid-file = "/opt/var/run/lighttpd.pid"
  174. server.upload-dirs = ( "/opt/tmp" )
  175. fastcgi.server = ( ".php" =>
  176.   ((
  177.     "bin-path" => "/opt/bin/php-cgi",
  178.     "socket" => "/opt/tmp/php-fastcgi.socket",
  179.     "max-procs" => 1,
  180.     "bin-environment" => (
  181.       "PHP_FCGI_CHILDREN" => "1",
  182.       "PHP_FCGI_MAX_REQUESTS" => "500"
  183.     ),
  184.     "broken-scriptfilename" => "enable"
  185.   ))
  186. )
  187. EOF

  188. echo "==== [9] 建目录、测试文件、启动 ===="
  189. mkdir -p /opt/www /opt/tmp /opt/var/run /opt/var/log/lighttpd
  190. chmod 755 /opt/www
  191. echo "<?php phpinfo(); ?>" > /opt/www/info.php
  192. chmod 644 /opt/www/info.php

  193. killall lighttpd php-cgi 2>/dev/null
  194. sleep 1
  195. /opt/sbin/lighttpd -f /opt/etc/lighttpd/lighttpd.conf
  196. sleep 2
  197. wget -q -O - http://127.0.0.1/info.php | grep -i "php version" && echo "OK" || echo "FAIL"


  198. # E. 添加到开机启动

  199. mount -o remount,rw /system;mount -o remount,rw /data;mount -o remount,rw /
  200. echo '( while [ ! -x /opt/bin/php-cgi ]; do sleep 1; done; /opt/sbin/lighttpd -f /opt/etc/lighttpd/lighttpd.conf >>/opt/var/log/lighttpd/boot.log 2>&1 ) &' >> /system/bin/chrome.sh;cat /system/bin/chrome.sh

  201. # 如果需要超时记录改为 ( i=0; while [ ! -x /opt/bin/php-cgi ] && [ $i -lt 60 ]; do sleep 1; i=$((i+1)); done; [ -x /opt/bin/php-cgi ] && { mkdir -p /opt/var/log/lighttpd; /opt/sbin/lighttpd -f /opt/etc/lighttpd/lighttpd.conf >>/opt/var/log/lighttpd/boot.log 2>&1; } ) &
复制代码



本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
 楼主| 发表于 2026-9-16 13:19:44 | 显示全部楼层
游客请登录后查看回复内容
回复 支持 反对

使用道具 举报

发表于 2026-9-17 17:40:26 | 显示全部楼层
游客请登录后查看回复内容
回复 支持 反对

使用道具 举报

发表于 2026-9-19 16:48:22 来自手机浏览器 | 显示全部楼层
游客请登录后查看回复内容
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

APP|手机版|小黑屋|关于我们|联系我们|法律条款|数码之家-技术知识分享平台

闽公网安备35020502000485号

闽ICP备2021002735号-2

GMT+8, 2026-10-5 12:04 , Processed in 0.187200 second(s), 7 queries , Gzip On, Redis On.

Powered by Discuz!

© MyDigit.Net Since 2006

快速回复 返回顶部 返回列表