在vbox安装openwrt-lede

在vbox上体验eSir lean-lede openwrt版本

1.download

2.format img->vdi

2.1 .img.gz -> .img

gunzip openwrt-spp-v3-x86-64-generic-squashfs-legacy.img.gz

2.2扩容img大小 +10G

dd if=/dev/zero bs=1M count=10240 >> openwrt-spp-v3-x86-64-generic-squashfs-legacy.img

2.3调整分区表信息

fdisk openwrt-21.02.0-x86-64-generic-squashfs-combined.img

需要在linux平台上执行

执行过程命令

fdisk openwrt-spp-v3-x86-64-generic-squashfs-legacy.img

p //注意:要记录2号分区扇区起始编号: 33792

d //删除2分区

n //新建分区,起始扇区: 33792

w //保存分区信息

详细过程

[root@c7-102 tmp.JnKhEPRE6H]# ll
total 10809856
-rw-r--r-- 1 root root 11069292544 Dec 17 10:11 openwrt-spp-v3-x86-64-generic-squashfs-legacy.img


[root@c7-102 tmp.JnKhEPRE6H]# fdisk openwrt-spp-v3-x86-64-generic-squashfs-legacy.img
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p

Disk openwrt-spp-v3-x86-64-generic-squashfs-legacy.img: 11.1 GB, 11069292544 bytes, 21619712 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x60be2810

                                            Device Boot      Start         End      Blocks   Id  System
openwrt-spp-v3-x86-64-generic-squashfs-legacy.img1   *         512       33279       16384   83  Linux
openwrt-spp-v3-x86-64-generic-squashfs-legacy.img2           33792      648191      307200   83  Linux

注意:要记录2号分区扇区起始编号: 33792

Command (m for help): d
Partition number (1,2, default 2): 
Partition 2 is deleted

Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): 
Using default response p
Partition number (2-4, default 2): 
First sector (33280-21619711, default 34816): 33792
Last sector, +sectors or +size{K,M,G} (33792-21619711, default 21619711): 
Using default value 21619711
Partition 2 of type Linux and of size 10.3 GiB is set

Command (m for help): p

Disk openwrt-spp-v3-x86-64-generic-squashfs-legacy.img: 11.1 GB, 11069292544 bytes, 21619712 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x60be2810

                                            Device Boot      Start         End      Blocks   Id  System
openwrt-spp-v3-x86-64-generic-squashfs-legacy.img1   *         512       33279       16384   83  Linux
openwrt-spp-v3-x86-64-generic-squashfs-legacy.img2           33792    21619711    10792960   83  Linux

Command (m for help): w
The partition table has been altered!

Syncing disks.


[root@c7-102 tmp.JnKhEPRE6H]# 
[root@c7-102 tmp.JnKhEPRE6H]# ll
total 10809856
-rw-r--r-- 1 root root 11069292544 Dec 17 10:36 openwrt-spp-v3-x86-64-generic-squashfs-legacy.img
[root@c7-102 tmp.JnKhEPRE6H]# tar zcf openwrt-spp-v3-x86-64-generic-squashfs-legacy.img.tar.gz openwrt-spp-v3-x86-64-generic-squashfs-legacy.img 

2.4 format-vdi

tar zxf openwrt-spp-v3-x86-64-generic-squashfs-legacy.img.tar.gz

da797738b558bccd4f9a5ee365dc369b.png

执行命令

VBoxManage convertfromraw openwrt-spp-v3-x86-64-generic-squashfs-legacy.img openwrt-spp-v3-x86-64-generic-squashfs-legacy.vdi –format=vdi

or

VBoxManage convertfromraw –format=vdi inputfile outputfile

mvpbang@mvpbang Documents % VBoxManage convertfromraw  --format=vdi openwrt-spp-v3-x86-64-generic-squashfs-legacy.img openwrt-spp-v3-x86-64-generic-squashfs-legacy.vdi
Converting from raw image file="openwrt-spp-v3-x86-64-generic-squashfs-legacy.img" to file="openwrt-spp-v3-x86-64-generic-squashfs-legacy.vdi"...
Creating dynamic image with size 11069292544 bytes (10557MB)...

3.创建openwrt虚拟机

3.1注册虚拟硬盘

工具 -> 介质 -> 虚拟硬盘 -> 注册 -> 选择文件 x.vdi****

933d62726e506f158b4ac3f5b2522ae0.png

3.2新建虚拟电脑

工具 -> 欢迎 -> 新建

设置虚机基本信息(注意:型号、版本)

139d78d4a894a8183e4a3a8f66ce2691.png

使用已有虚拟硬盘文件

051d9a090ae0a0b34cba8eb82fc28868.png

4.启动openwrt验证

df -hT (观察overlay 挂载点空间是否变大)

b55b49f86384a450a79ba8157534d377.png

5.体验openwrt

5.1login (root/)

默认root密码为空

8f8cbf3c91558ecc5f76f3b2c4ddfef1.png

5.2更换源

downloads.openwrt.org -> mirrors.tuna.tsinghua.edu.cn/openwrt

/etc/opkg/
src/gz openwrt_core http://mirrors.tuna.tsinghua.edu.cn/openwrt/snapshots/targets/x86/64/packages
src/gz openwrt_base http://mirrors.tuna.tsinghua.edu.cn/openwrt/snapshots/packages/x86_64/base
src/gz openwrt_luci http://mirrors.tuna.tsinghua.edu.cn/openwrt/releases/18.06.8/packages/x86_64/luci
src/gz openwrt_packages http://mirrors.tuna.tsinghua.edu.cn/openwrt/snapshots/packages/x86_64/packages
src/gz openwrt_routing http://mirrors.tuna.tsinghua.edu.cn/openwrt/snapshots/packages/x86_64/routing