声明照猫画虎搬过来的,技术不懂,问题也不少,请大神帮忙处理。请加群讨论QQ:641057163 讨论。 教程相关文件进群下载 entware-ngu-setup.sh debian_jessie8.9-arm_clean.gz PlexMediaServer-0.9.16.6.1993-5089475.tar.bz2 使用路由器斐讯K3 一、安装梅林固件,我安装的是混血版(感谢作者) 安装好梅林固件后(1)开软件中心,非必需 (2)开启 SSH开启 必需 请把需要在路由器安装的插件先装上,尤其涉及网络服务的¥¥等。(本教程不影响最终 软件中心 的使用,以防万一,还是先装好) 格式化外接硬盘位ext4格式,必需(路由器/opt挂载点)。接路由器确保正常,建议容量大一些。 注意:PLEX比较吃性能,路由器建议不要弄主路由,防止上网不开心。 二、安装entware-NG(安装至硬盘),swap file 选择2GB putty 链接路由 Winscp 链接路由 密码就是路由器管理密码,地址 路由器管理地址 安装过程中权限不够的,请在Winscp查看添加 将entware-ngu-setup.sh拷贝至路由器根目录 tmp文件夹下 (1) 输入命令,安装脚本并执行 cd /tmp chmod +x ./entware-ngu-setup.sh ./entware-ngu-setup.sh 效果如下 admin@RT-AC66U:/tmp# ./entware-ngu-setup.sh Info: This script was created by ryzhov_al and modified by TeHashX. Info: Thanks @zyxmon & @ryzhov_al for New Generation Entware Info: and @Rmerlin for his awesome firmwares Info: This script will guide you through the Entware-NG installation. Info: Script modifies only "entware-ng" folder on the chosen drive, Info: no other data will be touched. Existing installation will be Info: replaced with this one. Also some start scripts will be installed, Info: the old ones will be saved on partition where Entware-NG is installed Info: like /tmp/mnt/sda1/jffs_scripts_backup.tgz Info: Looking for available partitions... [1] --> /tmp/mnt/sda1 => Please enter partition number or 0 to exit [0-1]:
( 2 )选择1 安装至外置硬盘 1 Press ENTER
Info: /tmp/mnt/sda1 selected.
* Warning: Found chrooted-debian installation, stopping... * Warning: stopping running services... * Warning: Found Entware installation, saving... * Warning: Found Old Optware installation, saving... * Warning: Found Old Optware-NG installation, saving... * Warning: Found previous installation, saving... Info: Creating /tmp/mnt/sda1/entware-ng folder... * Warning: Deleting old /tmp/opt symlink... Info: Creating /tmp/opt symlink... Info: Creating /jffs scripts backup... tar: removing leading '/' from member names Info: Modifying start scripts... Info: Starting Entware-NG deployment....
Info: Creating folders... Info: Deploying opkg package manager... Info: Basic packages installation... Updated list of available packages in /opt/var/opkg-lists/entware-ng. Installing ldconfig (1.0.8-1) to root... Installing findutils (4.5.14-1) to root... Installing libc (1.0.8-1) to root... Installing libgcc (4.8.5-1) to root... Installing libssp (4.8.5-1) to root... Configuring ldconfig. Configuring libgcc. Configuring libc. Configuring libssp. Configuring findutils.
Router model RT-AC66U --------- SWAP FILE --------- Choose swap file size (Highly Recommended) 1. 512MB 2. 1024MB (recommended) 3. 2048MB 4. Skip this step, I already have a swap file / partition or I don't want to create one right now Enter your choice [ 1 - 4 ] ( 3 ) 选择swap空间大小,推荐2G 3 Press ENTER 效果省略,一路回车 ( 4 ) 安装软件测试是否成功 cd /opt /tmp/mnt/sda1/entware-ng# 安装软件 nano 编辑软件 opkg install nano opkg install nano findutils 效果省略Downloading 其他帮助命令 软件 启动 关闭 重启 命令 /opt/etc/init.d/SXX-package-name start /opt/etc/init.d/SXX-package-name stop /opt/etc/init.d/SXX-package-name restart
entware 服务的 启动 关闭 重启 命令 services start services stop services restart 三、安装Debian Jessie 将 debian_jessie8.9-arm_clean.gz 拷贝至路由器外接硬盘 \sda1\entware-ng.arm 文件夹下 ( 1 )输入命令 安装 debian 包 cd /opt tar -xvzf ./debian_jessie8.9-arm_clean.gz ( 2 ) 创建启动脚本并加载服务 编辑设置 nano /opt/etc/init.d/S99debian 将下列标记颜色的拷贝至S99debian中,红色部分可以# EXT_DIR=/tmp/mnt/sda1/Media/语句中#的去掉,也可以修改成自己的地址 Dibian 相当是自己的服务器,有自己的环境。路由器有自己的环境, Entware有自己的环境,还有一个koolshare的软件中心 不要弄晕了 #!/bin/sh PATH=/opt/bin:/opt/sbin:/sbin:/bin:/usr/sbin:/usr/bin # Folder with Debian Jessie CHROOT_DIR=/tmp/mnt/sda1/entware-ng.arm/debian # Some folder outside of sandbox, # will be mounted to /mnt folder in Debian # Uncommented next line if you need to mount a folder inside debian (remove #) # EXT_DIR=/tmp/mnt/sda1/Media/ CHROOT_SERVICES_LIST=/opt/etc/chroot-services.list if [ ! -e "$CHROOT_SERVICES_LIST" ]; then echo "Please, define Debian services to start in $CHROOT_SERVICES_LIST first!" echo "One service per line. Hint: this is a script names from Debian's /etc/init.d/" exit 1 fi MountedDirCount="$(mount | grep $CHROOT_DIR | wc -l)" start() { if [ $MountedDirCount -gt 0 ]; then echo "Chroot'ed services seems to be already started, exiting..." exit 1 fi echo "Starting chroot'ed Debian services..." for dir in dev proc sys; do mount -o bind /$dir $CHROOT_DIR/$dir done [ -z "$EXT_DIR" ] || mount -o bind $EXT_DIR $CHROOT_DIR/mnt for item in $(cat $CHROOT_SERVICES_LIST); do chroot $CHROOT_DIR /etc/init.d/$item start done } stop() { if [ $MountedDirCount -eq 0 ]; then echo "Chroot'ed services seems to be already stopped, exiting..." exit 1 fi echo "Stopping chroot'ed Debian services..." for item in $(cat $CHROOT_SERVICES_LIST); do chroot $CHROOT_DIR /etc/init.d/$item stop sleep 2 done mount | grep $CHROOT_DIR | awk '{print $3}' | xargs umount -l } restart() { if [ $MountedDirCount -eq 0 ]; then echo "Chroot'ed services seems to be already stopped" start else echo "Stopping chroot'ed Debian services..." for item in $(cat $CHROOT_SERVICES_LIST); do chroot $CHROOT_DIR /etc/init.d/$item stop sleep 2 done mount | grep $CHROOT_DIR | awk '{print $3}' | xargs umount -l echo "Restarting chroot'ed Debian services..." for dir in dev proc sys; do mount -o bind /$dir $CHROOT_DIR/$dir done [ -z "$EXT_DIR" ] || mount -o bind $EXT_DIR $CHROOT_DIR/mnt for item in $(cat $CHROOT_SERVICES_LIST); do chroot $CHROOT_DIR /etc/init.d/$item start done fi } enter() { [ -z "$EXT_DIR" ] || mount -o bind $EXT_DIR $CHROOT_DIR/mnt mount -o bind /dev/ /opt/debian/dev/ mount -o bind /dev/pts /opt/debian/dev/pts mount -o bind /proc/ /opt/debian/proc/ mount -o bind /sys/ /opt/debian/sys/ chroot /opt/debian /bin/bash } status() { if [ $MountedDirCount -gt 0 ]; then echo "Chroot'ed services running..." else echo "Chroot'ed services not running!" fi } case "$1" in start) start ;; stop) stop ;; restart) restart ;; enter) enter ;; status) status ;; *) echo "Usage: (start|stop|restart|enter|status)" exit 1 ;; esac echo Done. exit 0 保存 CTRL-O, and 回车 ENTER and 退出 CTRL-X 推出nano编辑器 ( 3 ) 赋予S99debian执行权限 chmod 755 /opt/etc/init.d/S99debian ( 4 ) 建立启动链接 touch /opt/etc/chroot-services.list ln -s /opt/etc/init.d/S99debian /opt/bin/debian 如果执行失败的话,将S99debian的语句直接复制到putty 单独执行 (5)debian 服务启动 关闭 重启 进入 状态 debian start debian stop debian restart debian enter debian status But don't forget to add services name from /opt/debian/etc/init.d/ to /opt/etc/chroot-services.list 我没弄明白这句话什么意思,应该是把服务名称 全部添加至chroot-services.list文件中,我是单独执行S99debian脚本语句启动debian服务,反正后期plex脚本是吧服务添加至这个文件中了,大家试一下吧 ( 6 ) 复制路由器hosts文件到硬盘debian下,可手工复制 cp /etc/hosts /opt/debian/etc/ (7)进入debian debian enter ( 8 )安装软件服务可用 apt update && apt upgrade -y ( 9 )设置时区 dpkg-reconfigure tzdata ( 10)安装获取软件包 apt install wget 成功 辅助命令 1 -debian stop 2 - rm -r /opt/debian 3 - rm /opt/etc/init.d/S99debian rm /opt/bin/debian 4 - reboot 四、安装Plex Media Server ( 1 )进入debian环境 debian enter ( 2 )安装解压包软件 apt install wget zip bzip2 libexpat1 -y ( 3 )建立应用文件夹/apps 将文件考入PlexMediaServer-0.9.16.6.1993-5089475.tar.bz2 mkdir -p /apps && cd /apps bzip2 -cd PlexMediaServer-0.9.16.6.1993-5089475.tar.bz2 | tar -xv mv ./PlexMediaServer-0.9.16.6.1993-5089475 ./plex && rm ./PlexMediaServer-0.9.16.6.1993-5089475.tar.bz2 (4)添加依赖库启动脚本 sed -i 's|ulimit.*|export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="/var/lib/plexmediaserver"\n&|g' /apps/plex/start.sh sed -i 's|.\/Plex\\ Media\\ Server|\/apps\/plex\/Plex\\ Media\\ Server|g' "/apps/plex/start.sh" ( 5 ) 修复准库执行权限 cd /apps/plex find . -iname "*.so" -exec chmod 644 {} \; find . -iname "*.so.*" -exec chmod 644 {} \; ( 6 ) 创建启动脚本,复制粘贴,执行 cat >> /etc/init.d/plexmediaserver << 'EOF' #!/bin/sh ### BEGIN INIT INFO # Provides: plexmediaserver # Required-Start: $remote_fs $syslog $networking # Required-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Plex Media Server # Description: Plex Media Server for Linux, # Many thanks to the great PlexApp team for their wonderfull job ! # Version: 1.3 ### END INIT INFO test -f "/apps/plex/start.sh" || exit 0 plex_running=`ps ax | grep "Plex Media Server" | awk '{ print $1 }' | wc -l` case "$1" in start) if [ "$plex_running" -gt 1 ]; then echo "Plex already running..." exit 0 fi echo -n "Starting Plex Media Server: " /apps/plex/start.sh & >/dev/null 2>&1 sleep 1 echo "done" ;; stop) if [ "$plex_running" -eq 1 ]; then echo "Plex Media Server is not running (no process found)..." exit 0 fi echo -n "Killing Plex Media Server: " # Trying to kill the Plex Media Server itself but also the Plug-ins ps ax | grep "Plex Media Server" | awk '{ print $1 }' | xargs kill >/dev/null 2>&1 ps ax | grep "Plex*" | awk '{ print $1 }' | xargs kill >/dev/null 2>&1 sleep 1 echo "done" ;; restart) sh $0 stop sh $0 start ;; status) if [ "$plex_running" -gt 1 ]; then echo "Plex Media Server process running." else echo "It seems that Plex Media Server isn't running (no process found)." fi ;; *) echo "Usage: $0 {start|stop|restart|status}" exit 1 ;; esac exit 0 EOF 按回车 ENTER ( 7 ) 赋予可执行权限 chmod +x /etc/init.d/plexmediaserver ( 8 ) 把启动服务添加至chroot-services.list文件,并赋予权限 echo "" >>/opt/etc/chroot-services.list echo "plexmediaserver" >>/opt/etc/chroot-services.list chmod 755 /opt/etc/chroot-services.list ( 9)重启debian,同时plexmediaserver自动同步启动 debian restart 五、自己调试吧 软件中心 安装 卸载正常 尽量装和硬盘无关的软件 效能高 entware下安装卸载正常 随便吧 usb中心 下载大师正常 随便吧 debian 软件安装卸载正常 不建议装常用软件 效果k3 效果plex
|