OpenWRT如何使用国内镜像

OpenWRT的安装命令opkg,使用opkg install来安装还是非常方便的。

opkg查询组件的2个常用命令

opkg list | grep -i samba

opkg list-installed | grep usb

OpenWRT使用list可以查询源里可选的组件有哪些?

OpenWRT使用list-installed可以查询已安装的组件有哪些?

by itgeeker.net

解决OpenWRT下载太慢的问题

OpenWRT官方网站推荐的其他镜像:https://openwrt.org/downloads#mirrors

其实里面没有中国境内的,但国内清华大学和中科院的镜像用起来都是没有问题的:

  1. https://mirrors.ustc.edu.cn/lede/ 
  2. https://mirrors.tuna.tsinghua.edu.cn/openwrt/ 

清华的还有一个是:https://mirrors.tuna.tsinghua.edu.cn/lede 其实和openwrt结尾一样的,因为之前openwrt就叫openwrt,后来改了叫lede,现在又改回去叫lede了。

修改文件 /etc/opkg/distfeeds.conf   

主要替换掉官方下载域名downloads.openwrt.org

#先备份原始的
cp /etc/opkg/distfeeds.conf /etc/opkg/distfeeds.conf.bk
#然后直接用sed替换
sed -i 's_downloads\.openwrt\.org_mirrors.tuna.tsinghua.edu.cn/openwrt_' /etc/opkg/distfeeds.conf
cat /etc/opkg/distfeeds.conf
#然后更新
opkg update

OpenWRT升级所有组件命令

opkg list-upgradable | cut -f 1 -d ' ' | xargs opkg upgrade

如果OpenWRT没有发现可升级的组件,这条命令会抛出一段错误信息,不用管它,说明都已经是最新版本了。

by itgeeker.net

OpenWRT恢复原始源

sed -i 's_mirrors\.tuna\.edu\.cn_downloads.openwrt.org_' /etc/opkg/distfeeds.conf

或者也可以直接把刚才的备份文件覆盖回来更方便

cp -f /etc/opkg/distfeeds.conf.bk /etc/opkg/distfeeds.conf

评论

《“OpenWRT如何使用国内镜像”》 有 4 条评论

  1. 谢谢

  2. 你那个代码写的有毛病,
    sed -i ‘s_downloads\.openwrt\.org_mirrors.tuna.tsinghua.edu.cn/openwrt_’ /etc/opkg/distfeeds.confcat /etc/opkg/distfeeds.conf
    执行出错、检查错误浪费了我几分钟时间
    confcat ???
    闹了半天,是:cat /etc/opkg/distfeeds.conf

    1. itgeeker 的头像
      itgeeker

      多谢提醒👍cat命令行应该要换行,已经更新了

回复 树莓派3B/3B+刷OpenWRT原生img 作为旁路由让全屋免配置上机场(二) – ITGeeker技术奇客 取消回复

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据

奇客罗方公众号 奇客罗方小程序 奇客罗方客服 ITGeeker Telegram

网站由ITGeeker技术奇客开发并管理;隶属于GeekerCloud奇客罗方智能科技
Site designed and developed by ITGeekerwhich is a sub-website of GeekerCloud
网站地图 | 沪ICP备2021031434号-4