Unraid是挺好用的,但是因为家里用的移动,所以托管在github上的代码下载速度极慢,有时候遇到dns污染还会出现网络错误。由于还没有折腾好移动的光猫,索性就琢磨手动安装Unraid插件。

商店Feed加速

Apps选项卡经常会出现刷新失败,即使更换DNS也无济于事,通过查看/usr/local/emhttp/plugins/community.applications/include目录下的paths.php文件可以确定更新Feed需要的路径

<?PHP
###############################################################
#                                                             #
# Community Applications copyright 2015-2020, Andrew Zawadzki #
#                    All Rights Reserved                      #
#                                                             #
###############################################################

$CA = "community.applications";

$caPaths['tempFiles']                           = "/tmp/$CA/tempFiles";                            /* path to temporary files */
$caPaths['flashDrive']                          = "/boot/config/plugins/$CA";
$caPaths['templates-community']                 = $caPaths['tempFiles']."/templates-community-apps";           /* templates and temporary files stored here.  Deleted every update of applications */
$caPaths['community-templates-url']             = "https://raw.githubusercontent.com/Squidly271/Community-Applications-Moderators/master/Repositories.json";
$caPaths['PublicServiceAnnouncement']           = "https://raw.githubusercontent.com/Squidly271/Community-Applications-Moderators/master/PublicServiceAnnouncement.txt";
$caPaths['Repositories']                        = $caPaths['tempFiles']."/Repositories.json";
$caPaths['community-templates-info']            = $caPaths['tempFiles']."/templates.json";                     /* json file containing all of the templates */
$caPaths['community-templates-displayed']       = $caPaths['tempFiles']."/displayed.json";                     /* json file containing all of the templates currently displayed */
$caPaths['application-feed']                    = "https://raw.githubusercontent.com/Squidly271/AppFeed/master/applicationFeed.json";
$caPaths['application-feed-last-updated']       = "https://raw.githubusercontent.com/Squidly271/AppFeed/master/applicationFeed-lastUpdated.json";
$caPaths['application-feedBackup']              = "https://s3.amazonaws.com/dnld.lime-technology.com/appfeed/master/applicationFeed.json";
$caPaths['application-feed-last-updatedBackup'] = "https://s3.amazonaws.com/dnld.lime-technology.com/appfeed/master/applicationFeed-lastUpdated.json";
$caPaths['appFeedDownloadError']                = $caPaths['tempFiles']."/downloaderror.txt";
$caPaths['categoryList']                        = $caPaths['tempFiles']."/categoryList.json";
$caPaths['currentServer']                       = $caPaths['tempFiles']."/currentServer.txt";
$caPaths['lastUpdated']                         = $caPaths['tempFiles']."/lastUpdated.json";
$caPaths['lastUpdated-old']                     = $caPaths['tempFiles']."/lastUpdated-old.json";
$caPaths['addConverted']                        = $caPaths['tempFiles']."/TrippingTheRift";                    /* flag to indicate a rescan needed since a dockerHub container was added */
$caPaths['convertedTemplates']                  = "{$caPaths['flashDrive']}/private/";                        /* path to private repositories on flash drive */
$caPaths['dockerSearchResults']                 = $caPaths['tempFiles']."/docker_search.json";                 /* The displayed docker search results */
$caPaths['dockerfilePage']                      = $caPaths['tempFiles']."/dockerfilePage";                     /* the downloaded webpage to scrape the dockerfile from */
$caPaths['Dockerfile']                          = $caPaths['tempFiles']."/Dockerfile";
$caPaths['moderationURL']                       = "https://raw.githubusercontent.com/Squidly271/Community-Applications-Moderators/master/Moderation.json";
$caPaths['moderation']                          = $caPaths['tempFiles']."/moderation.json";                    /* json file that has all of the moderation */
$caPaths['unRaidVersion']                       = "/etc/unraid-version";
$caPaths['logos']                               = $caPaths['tempFiles']."/logos.json";
$caPaths['unRaidVars']                          = "/var/local/emhttp/var.ini";
$caPaths['docker_cfg']                          = "/boot/config/docker.cfg";
$caPaths['dockerUpdateStatus']                  = "/var/lib/docker/unraid-update-status.json";
$caPaths['pinned']                              = "{$caPaths['flashDrive']}/pinned_apps.json"; # stored on flash instead of docker.img so it will work without docker running
$caPaths['pinnedV2']                            = "{$caPaths['flashDrive']}/pinned_appsV2.json";
$caPaths['appOfTheDay']                         = $caPaths['tempFiles']."/appOfTheDay.json";
$caPaths['statistics']                          = $caPaths['tempFiles']."/statistics.json";
$caPaths['statisticsURL']                       = "https://raw.githubusercontent.com/Squidly271/AppFeed/master/statistics.json";
$caPaths['pluginSettings']                      = "{$caPaths['flashDrive']}/community.applications.cfg";
$caPaths['fixedTemplates_txt']                  = $caPaths['tempFiles']."/caFixed.txt";
$caPaths['invalidXML_txt']                      = $caPaths['tempFiles']."/invalidxml.txt";
$caPaths['warningAccepted']                     = "{$caPaths['flashDrive']}/accepted";
$caPaths['pluginWarning']                       = "{$caPaths['flashDrive']}/plugins_accepted";
$caPaths['pluginDupes']                         = $caPaths['tempFiles']."/pluginDupes.json";
$caPaths['pluginTempDownload']                  = $caPaths['tempFiles']."/pluginTempFile.plg";
$caPaths['dockerManTemplates']                  = $dockerManPaths['templates-user'];
$caPaths['iconHTTPSbase']                       = "https://raw.githubusercontent.com/Squidly271/AppFeed/master/https-images/";
?>

这里可以通过反代方式切换到不容易被干扰的域名,也可以使用jsdelivr的CDN反代Github静态资源
我也在本站的/unraid/路径下放置了对应的文件,两小时更新一次,修改后的paths.php如下

<?PHP
###############################################################
#                                                             #
# Community Applications copyright 2015-2020, Andrew Zawadzki #
#                    All Rights Reserved                      #
#                                                             #
###############################################################

$CA = "community.applications";

$caPaths['tempFiles']                           = "/tmp/$CA/tempFiles";                            /* path to temporary files */
$caPaths['flashDrive']                          = "/boot/config/plugins/$CA";
$caPaths['templates-community']                 = $caPaths['tempFiles']."/templates-community-apps";           /* templates and temporary files stored here.  Deleted every update of applications */
$caPaths['community-templates-url']             = "https://www.issacc.top/unraid/Repositories.json";
$caPaths['PublicServiceAnnouncement']           = "https://www.issacc.top/unraid/PublicServiceAnnouncement.txt";
$caPaths['Repositories']                        = $caPaths['tempFiles']."/Repositories.json";
$caPaths['community-templates-info']            = $caPaths['tempFiles']."/templates.json";                     /* json file containing all of the templates */
$caPaths['community-templates-displayed']       = $caPaths['tempFiles']."/displayed.json";                     /* json file containing all of the templates currently displayed */
$caPaths['application-feed']                    = "https://www.issacc.top/unraid/applicationFeed.json";
$caPaths['application-feed-last-updated']       = "https://www.issacc.top/unraid/applicationFeed-lastUpdated.json";
$caPaths['application-feedBackup']              = "https://s3.amazonaws.com/dnld.lime-technology.com/appfeed/master/applicationFeed.json";
$caPaths['application-feed-last-updatedBackup'] = "https://s3.amazonaws.com/dnld.lime-technology.com/appfeed/master/applicationFeed-lastUpdated.json";
$caPaths['appFeedDownloadError']                = $caPaths['tempFiles']."/downloaderror.txt";
$caPaths['categoryList']                        = $caPaths['tempFiles']."/categoryList.json";
$caPaths['currentServer']                       = $caPaths['tempFiles']."/currentServer.txt";
$caPaths['lastUpdated']                         = $caPaths['tempFiles']."/lastUpdated.json";
$caPaths['lastUpdated-old']                     = $caPaths['tempFiles']."/lastUpdated-old.json";
$caPaths['addConverted']                        = $caPaths['tempFiles']."/TrippingTheRift";                    /* flag to indicate a rescan needed since a dockerHub container was added */
$caPaths['convertedTemplates']                  = "{$caPaths['flashDrive']}/private/";                        /* path to private repositories on flash drive */
$caPaths['dockerSearchResults']                 = $caPaths['tempFiles']."/docker_search.json";                 /* The displayed docker search results */
$caPaths['dockerfilePage']                      = $caPaths['tempFiles']."/dockerfilePage";                     /* the downloaded webpage to scrape the dockerfile from */
$caPaths['Dockerfile']                          = $caPaths['tempFiles']."/Dockerfile";
$caPaths['moderationURL']                       = "https://www.issacc.top/unraid/Moderation.json";
$caPaths['moderation']                          = $caPaths['tempFiles']."/moderation.json";                    /* json file that has all of the moderation */
$caPaths['unRaidVersion']                       = "/etc/unraid-version";
$caPaths['logos']                               = $caPaths['tempFiles']."/logos.json";
$caPaths['unRaidVars']                          = "/var/local/emhttp/var.ini";
$caPaths['docker_cfg']                          = "/boot/config/docker.cfg";
$caPaths['dockerUpdateStatus']                  = "/var/lib/docker/unraid-update-status.json";
$caPaths['pinned']                              = "{$caPaths['flashDrive']}/pinned_apps.json"; # stored on flash instead of docker.img so it will work without docker running
$caPaths['pinnedV2']                            = "{$caPaths['flashDrive']}/pinned_appsV2.json";
$caPaths['appOfTheDay']                         = $caPaths['tempFiles']."/appOfTheDay.json";
$caPaths['statistics']                          = $caPaths['tempFiles']."/statistics.json";
$caPaths['statisticsURL']                       = "https://www.issacc.top/unraid/statistics.json";
$caPaths['pluginSettings']                      = "{$caPaths['flashDrive']}/community.applications.cfg";
$caPaths['fixedTemplates_txt']                  = $caPaths['tempFiles']."/caFixed.txt";
$caPaths['invalidXML_txt']                      = $caPaths['tempFiles']."/invalidxml.txt";
$caPaths['warningAccepted']                     = "{$caPaths['flashDrive']}/accepted";
$caPaths['pluginWarning']                       = "{$caPaths['flashDrive']}/plugins_accepted";
$caPaths['pluginDupes']                         = $caPaths['tempFiles']."/pluginDupes.json";
$caPaths['pluginTempDownload']                  = $caPaths['tempFiles']."/pluginTempFile.plg";
$caPaths['dockerManTemplates']                  = $dockerManPaths['templates-user'];
$caPaths['iconHTTPSbase']                       = "https://raw.githubusercontent.com/Squidly271/AppFeed/master/https-images/";
?>

下面是jsdelivr的反代版本

<?PHP
###############################################################
#                                                             #
# Community Applications copyright 2015-2020, Andrew Zawadzki #
#                    All Rights Reserved                      #
#                                                             #
###############################################################

$CA = "community.applications";

$caPaths['tempFiles']                           = "/tmp/$CA/tempFiles";                            /* path to temporary files */
$caPaths['flashDrive']                          = "/boot/config/plugins/$CA";
$caPaths['templates-community']                 = $caPaths['tempFiles']."/templates-community-apps";           /* templates and temporary files stored here.  Deleted every update of applications */
$caPaths['community-templates-url']             = "https://cdn.jsdelivr.net/gh/Squidly271/Community-Applications-Moderators@master/Repositories.json";
$caPaths['PublicServiceAnnouncement']           = "https://cdn.jsdelivr.net/gh/Squidly271/Community-Applications-Moderators@master/PublicServiceAnnouncement.txt";
$caPaths['Repositories']                        = $caPaths['tempFiles']."/Repositories.json";
$caPaths['community-templates-info']            = $caPaths['tempFiles']."/templates.json";                     /* json file containing all of the templates */
$caPaths['community-templates-displayed']       = $caPaths['tempFiles']."/displayed.json";                     /* json file containing all of the templates currently displayed */
$caPaths['application-feed']                    = "https://cdn.jsdelivr.net/gh/Squidly271/AppFeed@master/applicationFeed.json";
$caPaths['application-feed-last-updated']       = "https://cdn.jsdelivr.net/gh/Squidly271/AppFeed@master/applicationFeed-lastUpdated.json";
$caPaths['application-feedBackup']              = "https://s3.amazonaws.com/dnld.lime-technology.com/appfeed@master/applicationFeed.json";
$caPaths['application-feed-last-updatedBackup'] = "https://s3.amazonaws.com/dnld.lime-technology.com/appfeed@master/applicationFeed-lastUpdated.json";
$caPaths['appFeedDownloadError']                = $caPaths['tempFiles']."/downloaderror.txt";
$caPaths['categoryList']                        = $caPaths['tempFiles']."/categoryList.json";
$caPaths['currentServer']                       = $caPaths['tempFiles']."/currentServer.txt";
$caPaths['lastUpdated']                         = $caPaths['tempFiles']."/lastUpdated.json";
$caPaths['lastUpdated-old']                     = $caPaths['tempFiles']."/lastUpdated-old.json";
$caPaths['addConverted']                        = $caPaths['tempFiles']."/TrippingTheRift";                    /* flag to indicate a rescan needed since a dockerHub container was added */
$caPaths['convertedTemplates']                  = "{$caPaths['flashDrive']}/private/";                        /* path to private repositories on flash drive */
$caPaths['dockerSearchResults']                 = $caPaths['tempFiles']."/docker_search.json";                 /* The displayed docker search results */
$caPaths['dockerfilePage']                      = $caPaths['tempFiles']."/dockerfilePage";                     /* the downloaded webpage to scrape the dockerfile from */
$caPaths['Dockerfile']                          = $caPaths['tempFiles']."/Dockerfile";
$caPaths['moderationURL']                       = "https://cdn.jsdelivr.net/gh/Squidly271/Community-Applications-Moderators@master/Moderation.json";
$caPaths['moderation']                          = $caPaths['tempFiles']."/moderation.json";                    /* json file that has all of the moderation */
$caPaths['unRaidVersion']                       = "/etc/unraid-version";
$caPaths['logos']                               = $caPaths['tempFiles']."/logos.json";
$caPaths['unRaidVars']                          = "/var/local/emhttp/var.ini";
$caPaths['docker_cfg']                          = "/boot/config/docker.cfg";
$caPaths['dockerUpdateStatus']                  = "/var/lib/docker/unraid-update-status.json";
$caPaths['pinned']                              = "{$caPaths['flashDrive']}/pinned_apps.json"; # stored on flash instead of docker.img so it will work without docker running
$caPaths['pinnedV2']                            = "{$caPaths['flashDrive']}/pinned_appsV2.json";
$caPaths['appOfTheDay']                         = $caPaths['tempFiles']."/appOfTheDay.json";
$caPaths['statistics']                          = $caPaths['tempFiles']."/statistics.json";
$caPaths['statisticsURL']                       = "https://cdn.jsdelivr.net/gh/Squidly271/AppFeed@master/statistics.json";
$caPaths['pluginSettings']                      = "{$caPaths['flashDrive']}/community.applications.cfg";
$caPaths['fixedTemplates_txt']                  = $caPaths['tempFiles']."/caFixed.txt";
$caPaths['invalidXML_txt']                      = $caPaths['tempFiles']."/invalidxml.txt";
$caPaths['warningAccepted']                     = "{$caPaths['flashDrive']}/accepted";
$caPaths['pluginWarning']                       = "{$caPaths['flashDrive']}/plugins_accepted";
$caPaths['pluginDupes']                         = $caPaths['tempFiles']."/pluginDupes.json";
$caPaths['pluginTempDownload']                  = $caPaths['tempFiles']."/pluginTempFile.plg";
$caPaths['dockerManTemplates']                  = $dockerManPaths['templates-user'];
$caPaths['iconHTTPSbase']                       = "https://cdn.jsdelivr.net/gh/Squidly271/AppFeed@master/https-images/";
?>

插件的安装

插件商店的连接是托管在github上的,安装插件只需在插件选项卡下粘贴好如下链接并点击安装

https://raw.githubusercontent.com/Squidly271/community.applications/master/plugins/community.applications.plg

我们直接访问这个网址,发现这是一段类似shell脚本的东西,里面指定了安装动作和卸载动作,以及运行前的环境。我忽然意识到Unraid是基于Slackware发行版的,这个发行版非常小众,没有常见的包管理器帮你把依赖装好,甚至就连启动服务也不是通过systemd而是类似BSD的方式。

但是仔细观察发现脚本中

<FILE Name="/boot/config/plugins/&name;/&name;-&version;-x86_64-1.txz" Run="upgradepkg --install-new">

这一行命令是将在指定路径下的文件安装到系统中。故可通过手动下载好插件,放入对应的文件夹中,运行指令安装。

首先我们要先找到插件安装的脚本,只需要找到对应插件,点击安装,你可以在弹出的提示框中找到项目的地址,直接把这个文件上传到/boot/config/plugins/下,并创建一个同名的文件夹
举个例子
按照上图的例子,这个文件夹应该命名为dynamix.system.info
同时下载对应的txz文件放入该文件夹,最后在面板的Plugins页面手动选择安装plg文件即可。

Docker加速

Unraid自带的商店里大部分的应用是基于Docker的,只不过官方写好了一个模板,由于移动家宽连接Dockerhub的认证服务器总是超时,而通过传统方式添加国内源的办法又总是失效,这里可以使用修改启动脚本实现自启动生效。修改/boot/config/go文件,添加如下代码:

tee -a /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://*.mirror.aliyuncs.com"]
}
EOF

也可以指定docker镜像的方式,在pull镜像的时候就指定

docker pull dockerhub.azk8s.cn/linuxserver/qbittorrent

即可避免因为网络问题导致部署失败。

注意,这一步需要替换模板中的Repository为你的镜像地址,例如本例中的dockerhub.azk8s.cn/linuxserver/qbittorrent而不是默认的linuxserver/qbittorrent

Last modification:March 28th, 2020 at 05:48 pm