找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 18412|回复: 15

在LEDE上安装使用Entware,使用onmp一键脚本搭网站

  [复制链接]
发表于 2017-11-13 12:19 | 显示全部楼层 |阅读模式
本帖最后由 triton 于 2017-11-13 12:37 编辑

在LEDE上使用Entware

之前给老毛子padavan固件写了onmp一键包,有不少使用LEDE软路由的小伙伴回帖说不能安装,
所以我决定修改脚本进行适配,LEDE的opkg源内似乎没有我需要的包,所以转投使用Entware

Entware-ng是一个适用于嵌入式系统的软件包库,使用opkg包管理系统进行管理,现在在官方的源上已经有超过2000个软件包了,可以说是非常的丰富
Entware官方地址:http://entware.net/about

ONMP的github地址:https://github.com/xzhih/ONMP
ONMP使用方法地址:https://www.right.com.cn/forum/thread-244810-1-1.html

U盘格式化(可选)

我们的设备本身的储存较少,而且如果哪天崩了,数据还有找不回的风险,所以我们一般把软件包和程序安装到U盘之类的外置设备上,所以需要对它进行格式化,NTFS格式我个人不推荐使用,以下具体方法都基于ext4,NTFS相关错误不做回答

使用ssh连接路由器shell,把U盘插到路由器上

我们需要在命令行进行以下4步操作:

1. 安装fdisk
  1. root@LEDE:~ opkg update
  2. root@LEDE:~ opkg install
  3. # 输出Configuring fdisk. 并且没有错误
  4. # fdisk就安装好了
复制代码

2. 查看你的设备
  1. root@LEDE:~ fdisk -l
  2. # 这里先输出系统分区之类的不用管,外置设备一般在最后
  3. Disk /dev/sdb: 1008.3 MiB, 1057292288 bytes, 2065024 sectors
  4. Units: sectors of 1 * 512 = 512 bytes
  5. Sector size (logical/physical): 512 bytes / 512 bytes
  6. I/O size (minimum/optimal): 512 bytes / 512 bytes
  7. Disklabel type: dos
  8. Disk identifier: 0x7a0d6aa3
  9. Device     Boot Start     End Sectors    Size Id Type
  10. /dev/sdb1        2048 2065023 2062976 1007.3M  7 HPFS/NTFS/exFAT
复制代码

上面的信息注意看到和你的存储大小一样的设备,我的是`/dev/sdb`,在它里面有个`/dev/sdb1`的分区

3. 删除分区、新建分区
  1. root@LEDE:~ fdisk /dev/sdb # 这是你的设备別打成分区

  2. Welcome to fdisk (util-linux 2.29.2).
  3. Changes will remain in memory only, until you decide to write them.
  4. Be careful before using the write command.

  5. Command (m for help): d # 输入d回车,我只有一个分区,它自动选择了,如果你有多个分区,可以多次使用d
  6. Selected partition 1
  7. Partition 1 has been deleted.

  8. Command (m for help): n # 输入n会车,创建分区
  9. Partition type
  10.    p   primary (0 primary, 0 extended, 4 free)
  11.    e   extended (container for logical partitions)

  12. Select (default p): p # 选择p
  13. Partition number (1-4, default 1): # 回车
  14. First sector (2048-2065023, default 2048): #回车
  15. Last sector, +sectors or +size{K,M,G,T,P} (2048-2065023, default 2065023): # 回车
  16. Created a new partition 1 of type 'Linux' and of size 1007.3 MiB.

  17. Command (m for help): w # 输入w回车,保存并退出
  18. The partition table has been altered.
  19. Calling ioctl() to re-read partition table.
  20. Syncing disks.
  21. root@LEDE:~
复制代码

经过以上的操作,你可以用`fdisk -l`命令查看U盘上是否只有一个Linux分区
  1. root@LEDE:~ fdisk -l

  2. # 找到你的设备 可以看到ID为83就对了
  3. Disk /dev/sdb: 1008.3 MiB, 1057292288 bytes, 2065024 sectors
  4. Units: sectors of 1 * 512 = 512 bytes
  5. Sector size (logical/physical): 512 bytes / 512 bytes
  6. I/O size (minimum/optimal): 512 bytes / 512 bytes
  7. Disklabel type: dos
  8. Disk identifier: 0x7a0d6aa3
  9. Device     Boot Start     End Sectors    Size Id Type
  10. /dev/sdb1        2048 2065023 2062976 1007.3M 83 Linux
复制代码

4. 格式化分区

分区已经有了,现在开始格式化,其实现在的分区已经是ext4格式的了,不过我们还是对它进行一下格式化,算是熟悉一下命令,以后直接这样格式化吧

  1. root@LEDE:~ mkfs.ext4 /dev/sdb1
  2. # 如果你的硬盘比较大,256G以上的话,是这个命令:mkfs.ext4 -T largefile /dev/sdb1
  3. mke2fs 1.43.3 (04-Sep-2016)
  4. /dev/sdb1 contains a ext4 file system labelled 'ONMP'
  5.         last mounted on Sun Nov 12 09:21:22 2017
  6. Proceed anyway? (y,n) y # 输入y回车

  7. root@LEDE:~ umount /dev/sdb1 # 如果已经被挂载了,先执行这个卸载
复制代码

这样,U盘就被格式化完了

U盘挂载

分区、格式都没问题之后,开始挂载
  1. root@LEDE:~ mkdir /mnt/onmp
  2. # 挂载方法1
  3. root@LEDE:~ mount -t ext4 /dev/sdb1 /mnt/onmp/
  4. # 这样就挂载上了
  5. root@LEDE:~ df -h
  6. Filesystem                Size      Used Available Use% Mounted on
  7. /dev/sdb1               975.5M      2.5M    906.6M   0% /mnt/onmp
  8. # 可以看到已经挂载

  9. # 挂载方法2(推荐)
  10. root@LEDE:~ vi /etc/fstab # 按一下i编辑文件
  11. # <file system> <mount point> <type> <options> <dump> <pass>
  12. /dev/sdb1 /mnt/onmp ext4 defaults 0 1 # 添加这一行
  13. # 按一下Esc再输入冒号`:`,输入wq回车保存
  14. root@LEDE:~ mount -a # 以后每次要挂载就直接输入这个命令
复制代码

开机自动挂载
  1. root@LEDE:~ vi /etc/rc.local # 编辑,vim基本用法和上面一样
  2. mount -a # 在exit 0之前添加命令,开机后自动执行挂载
  3. exit 0
复制代码

安装和使用 Entware-ng

1. 挂载opt

在U盘上创建一个空的opt文件夹
  1. root@LEDE:~ mkdir /mnt/onmp/opt
复制代码

在系统根目录创建opt文件夹,并绑定U盘的opt文件夹
  1. root@LEDE:~ mkdir /opt
  2. root@LEDE:~ mount -o bind /mnt/onmp/opt /opt
  3. # 可以用 mount 或 df -h 命令查看是否挂载成功
复制代码

2. 运行 Entware-ng 安装命令

不同的CPU平台有不同的命令

armv5
  1. wget -O - http://pkg.entware.net/binaries/armv5/installer/entware_install.sh | /bin/sh
复制代码

armv7
  1. wget -O - http://pkg.entware.net/binaries/armv7/installer/entware_install.sh | /bin/sh
复制代码

x86-32
  1. wget -O - http://pkg.entware.net/binaries/x86-32/installer/entware_install.sh | /bin/sh
复制代码

x86-64
  1. wget -O - http://pkg.entware.net/binaries/x86-64/installer/entware_install.sh | /bin/sh
复制代码

MIPS
  1. wget -O - http://pkg.entware.net/binaries/mipsel/installer/installer.sh | /bin/sh
复制代码

在输入命令之后之后会自己跑起来,出现以下结果就代表成功,没成功的记得把U盘上的opt文件夹清空再来
  1. Info: Congratulations!
  2. Info: If there are no errors above then Entware-ng was successfully initialized.
复制代码

3. 开机启动

编辑 `/etc/rc.local` 将以下代码加在 `exit 0` 之前,`mount -a` 之后
  1. mkdir -p /opt
  2. mount -o bind /mnt/onmp/opt /opt
  3. /opt/etc/init.d/rc.unslung start
复制代码

4. 环境变量

编辑 `/etc/profile` 在他的最后加入以下代码
  1. . /opt/etc/profile
复制代码

这样开机之后将会添加 `/opt/bin` 和 `/opt/sbin` 到环境变量PATH里

5. 重启

重启之后,可以使用一下命令检查是否成功
  1. # 检查环境变量
  2. root@LEDE:~ echo $PATH
  3. /opt/bin:/opt/sbin:/usr/sbin:/usr/bin:/sbin:/bin # 可以看到已经有/opt的路径了

  4. # 检查 `/opt` 挂载情况
  5. root@LEDE:~# df -h
  6. /dev/sdb1               975.5M     13.9M    895.2M   2% /mnt/onmp # U盘挂载成功
  7. /dev/sdb1               975.5M     13.9M    895.2M   2% /opt # opt挂载成功

  8. # opkg 更新数据
  9. root@LEDE:~# opkg update
  10. Downloading http://pkg.entware.net/binaries/x86-64/Packages.gz # 默认从entware下载
  11. Updated list of available packages in /opt/var/opkg-lists/packages # 成功
复制代码

经过以上步骤,已经可以从 `Entware-ng` 上进行下载安装包并安装到U盘上

这下可以享受丰富的软件包,还不占用内部储存空间,非常适合LEDE软路由
我的onmp一键包也可以在LEDE上使用了


Tips

每次升级固件后如果失效了,重新设置开机启动和环境变量即可


参考

Install on Synology NAS:https://github.com/Entware-ng/Entware-ng/wiki/Install-on-Synology-NAS
How To Configure Routers Asus RT-N56U/RT-N65U For Entware Usage:https://bitbucket.org/padavan/rt-n56u/wiki/EN/HowToConfigureEntware

评分

参与人数 1恩山币 +1 收起 理由
andylk + 1 我来恩山就是为了撩你!

查看全部评分

我的恩山、我的无线 The best wifi forum is right here.
发表于 2017-12-5 18:12 | 显示全部楼层
Configuring librt.
Configuring terminfo.
Configuring ldconfig.
Configuring locales.
Entware uses separate locale-archive file independent from main system
Creating locale archive - /opt/usr/lib/locale/locale-archive
Adding en_EN.UTF-8
Adding ru_RU.UTF-8
You can download locale sources from http://pkg.entware.net/sources/i18n_glib223.tar.gz
You can add new locales to Entware using /opt/bin/localedef.new
Configuring opkg.
Configuring libstdcpp.
Configuring findutils.
Configuring entware-opt.
Updating /opt/etc/ld.so.cache... done.
Info: Congratulations!
Info: If there are no errors above then Entware-ng was successfully initialized.
Info: Add /opt/bin & /opt/sbin to your PATH variable
Info: Add '/opt/etc/init.d/rc.unslung start' to startup script for Entware-ng services to start
Info: Found a Bug? Please report at https://github.com/Entware-ng/Entware-ng/issues
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2017-12-5 18:13 | 显示全部楼层
这是什么意思

点评

这是成功了啊  详情 回复 发表于 2017-12-5 19:49
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2017-12-5 19:49 | 显示全部楼层

这是成功了啊

点评

现在因为一个数据库的问题导致一键包全部失效,请大神更新  详情 回复 发表于 2018-10-21 08:46
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2017-12-7 15:41 | 显示全部楼层
本帖最后由 picc745514 于 2017-12-7 16:21 编辑

搞定了,就是不知道怎么换回LEDE软件源

我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2017-12-10 00:55 | 显示全部楼层
大致看懂了,谢谢楼主。放在软路由上试试。另外,还有ram 64MB的路由,不知能不能跑起来。

点评

64m跑起来也没用  详情 回复 发表于 2017-12-10 12:07
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2017-12-10 12:07 | 显示全部楼层
yanweidong 发表于 2017-12-10 00:55
大致看懂了,谢谢楼主。放在软路由上试试。另外,还有ram 64MB的路由,不知能不能跑起来。

64m跑起来也没用
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2017-12-12 04:00 | 显示全部楼层
在K3上测试通过,实在是大神 之前owncloud用mysql一直提示数据库语法错误,后来看了大神的源码成md数据库成功了 索性就全部换成大神的了,
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2017-12-30 13:39 | 显示全部楼层
nextcloud提示内部服务器错误,如何设置?
Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2018-10-21 08:46 | 显示全部楼层

现在因为一个数据库的问题导致一键包全部失效,请大神更新
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2018-12-14 12:49 | 显示全部楼层
回复支持,感谢分享
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2018-12-19 22:07 | 显示全部楼层
da niu niu B
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2020-4-30 11:47 | 显示全部楼层
大致看懂了,谢谢楼主。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2021-6-12 10:38 | 显示全部楼层
openwrt上安装使用Entware,使用onmp一键脚本搭网站
感谢!
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2021-7-8 11:20 | 显示全部楼层

感谢分享,
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

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

本版积分规则

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-4-23 23:07

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

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