前言
最近已经折腾istores和openwrt无数次了,感觉人都要憔悴了!因为经验不足,总有些奇奇怪怪的问题出现,网络上又很难精准找到解决的办法,特此记录!
Openwrt怎么安装到硬盘上
首先需要有一个带有PE的启动U盘,然后将以下文件放入U盘中:
- physdiskwrite
- openwrt-x86-64-generic-squashfs-combined.img
physdiskwrite如果找不到官网,可以从这里下载 (https://wwnj.lanzout.com/iFUSz27m46ah)
使用PE启动U盘进入PE系统,然后用管理员全新运行CMD:
进入你U盘的目录下,假设为C盘:
c:
输入以下命令进入写盘工具:(这里替换成你自己的IMG文件名)
physdiskwrite.exe -u openwrt-x86-64-generic-squashfs-combined.img
接下来选择你要写入的硬盘序号,你要看好自己要写入的硬盘需要再填写
最后确认填写的信息正确,然后输入y
等待写入结束,关机拔掉U盘重启即可。
——2024.08.16更新。
opkg无法使用,提示网络错误!
可以通过修改软件源的方法去改善。
首先查询 OpenWrt 的版本信息
cat /etc/openwrt_release
编辑 /etc/opkg/distfeeds.conf 文件,将其内容更新为其他可用的源。例如,使用 OpenWrt 官方源或其他镜像源:
vi /etc/opkg/distfeeds.conf
将文件内容修改为以下示例(注意其中类似23.05的数字修改为op版本号),修改后打开网站要能看到列表才正确:
src/gz aliyun_core https://mirrors.aliyun.com/openwrt/releases/23.05.4/packages/x86_64/packages
src/gz tuna_core https://mirror.tuna.tsinghua.edu.cn/lede/releases/23.05.4/packages/x86_64/packages
src/gz tencent_core http://mirrors.cloud.tencent.com/openwrt/snapshots/packages/x86_64/packages
src/gz ustc_core http://mirrors.ustc.edu.cn/openwrt/releases/23.05.4/packages/x86_64/packages
清除 opkg 缓存,并尝试。
rm -rf /var/opkg-lists/*
opkg update
——2024.08.16更新。
web界面挂载磁盘后,重启失效,需要重新挂载。
通过命令设置启动就挂载假设我需要配置 /dev/sda3
在重启后自动挂载到 /op
目录:
安装必要的软件
opkg update
opkg install block-mount kmod-usb-storage
编辑 /etc/config/fstab
文件,添加如下内容:
vim /etc/config/fstab
config mount
option target '/op' # 挂载的名字,这里我希望设置为/op
option device '/dev/sda3' # 需要挂载的物理盘
option fstype 'auto' # 根据你的分区类型调整,不知道就auto就好
option options 'rw,sync' # 设置读写等权限
option enabled '1'
重启挂载服务以应用更改:
/etc/init.d/fstab restart
确保开机时自动挂载:
/etc/init.d/fstab enable
——2024.08.17更新。
openwrt安装docker和docker compose
登录控制台输入以下命令
opkg update
安装依赖包:安装必要的依赖包,如luci-app-docker(Web管理界面)。
opkg install luci-app-docker
安装Docker-compose
opkg install docker-compose
启动Docker服务:
/etc/init.d/dockerd start
配置开机启动:
/etc/init.d/dockerd enable
验证安装:检查Docker是否运行正常。
docker --version
——2024.08.18更新。
openwrt的docker容器总是失效
获取容器名
docker ps
设置定时重启
crontab -e
0 6 * * * /usr/bin/docker restart npc
重启 cron 服务
/etc/init.d/cron restart
验证配置
crontab -l
修改openwrt登录账户名
注意!此方法有风险建议备份再操作!实测版本24.08可以修改!ssh还是只能root使用。
更新包
opkg update
安装luci-app-acl
opkg install luci-app-acl
进入套件找到ACL setting修改
重启
——2024.08.19更新。
评论区