初探鸿蒙电脑官方Linux虚拟机
- 内容介绍
- 文章标签
- 相关推荐
这几天鸿蒙电脑的应用市场上架了一款融合开发引擎应用,根据应用描述,它可以运行一个虚拟化的Linux环境,满足开发和调试的需求。
image1787×953 104 KB
接下来我就使用MateBook Pro简单体验一下这款应用。
首次启动应用,会有一个配置环境的过程,很快。
配置完成后,就可以看到有一个OpenEuler的环境已经准备就绪了。
image1280×846 89.5 KB
在这里可以配置磁盘容量、内存大小、CPU核心数量和网络模式,其中内存大小最大是16G,CPU核心数最大是7核(嗯?好像不太对),网络模式有NAT和host-only两种模式。
关于左侧的附加功能:快照备份就不用多说了,用过虚拟机的应该都明白。文件共享可以选择一个鸿蒙电脑本机的目录映射到Linux环境中,实现文件的双向互传。
image1253×839 68 KB
配置好之后,原神林神,启动!
点击启动之后会弹出一个终端窗口,如果不小心关掉了这个窗口,可以回到融合开发引擎界面里点击打开终端按钮重新打开终端。
因为这只是一个轻量级的虚拟环境,它是不带图形界面的,终端就是我们与它交互的唯一方式。
image1389×734 41 KB
首先看一下uname -a,可以看到内核版本是6.6.0,这与openEuler 24.03 LTS SP2的内核版本是一致的。
[user@localhost ~]$ uname -a
Linux localhost 6.6.0 #1 SMP Wed Mar 4 04:04:43 UTC 2026 aarch64 aarch64 aarch64 GNU/Linux
既然是欧拉系统,那么欧拉能用的yum和dnf,它自然也可以用:
[user@localhost ~]$ sudo yum makecache
OS 12 kB/s | 1.9 kB 00:00
everything 22 kB/s | 2.0 kB 00:00
EPOL 25 kB/s | 2.0 kB 00:00
debuginfo 19 kB/s | 2.0 kB 00:00
source 19 kB/s | 1.9 kB 00:00
update 22 kB/s | 1.8 kB 00:00
update-source 17 kB/s | 1.8 kB 00:00
Metadata cache created.
我先安装上code-server和node.js,这样我就可以使用codex执行后续的任务了。
image2613×1259 290 KB
首先让codex配置一下开发环境,没有问题,而且sudo默认是没有密码的,它可以直接执行。
image1770×876 74.2 KB
对于运维人员来说,docker这类容器引擎是很常用的,但是我遗憾地发现,它是不能安装容器引擎的,因为这个虚拟环境里没有systemd,而是用hsl_init来完成环境初始化的(类似wsl 1?)。
[user@localhost ~]$ ps -aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
user 1 0.0 0.0 2040 860 ? Ss 22:03 0:00 /usr/bin/hsl_init
user 2 0.0 0.2 9776 8824 pts/0 Ss 22:03 0:00 /bin/bash
这样的话,即使在上面部署了一些服务,也没法做到开机自启,需要每次手动启动,有些麻烦。
接下来我试着安装了qemu,并在上面跑一台Alpine Linux虚拟机,引导成功了:
image1623×959 102 KB
先写这么多,后续我再跑一下性能测试啥的。有什么想法也可以说出来,我试一试。
网友解答:--【壹】--:
目前只有欧拉
CPU:
[user@localhost ~]$ sysbench cpu --threads=4 --time=60 run
sysbench 1.0.20 (using system LuaJIT 2.1.ROLLING)
Running the test with following options:
Number of threads: 4
Initializing random number generator from current time
Prime numbers limit: 10000
Initializing worker threads...
Threads started!
CPU speed:
events per second: 20609.47
General statistics:
total time: 60.0002s
total number of events: 1236604
Latency (ms):
min: 0.19
avg: 0.19
max: 8.50
95th percentile: 0.20
sum: 239617.12
Threads fairness:
events (avg/stddev): 309151.0000/60.75
execution time (avg/stddev): 59.9043/0.00
RAM:
[user@localhost ~]$ sysbench memory --threads=4 --time=60 --memory-block-size=1M --memory-total-size=4G run
sysbench 1.0.20 (using system LuaJIT 2.1.ROLLING)
Running the test with following options:
Number of threads: 4
Initializing random number generator from current time
Running memory speed test with the following options:
block size: 1024KiB
total size: 4096MiB
operation: write
scope: global
Initializing worker threads...
Threads started!
Total operations: 4096 (55380.94 per second)
4096.00 MiB transferred (55380.94 MiB/sec)
General statistics:
total time: 0.0723s
total number of events: 4096
Latency (ms):
min: 0.04
avg: 0.06
max: 3.89
95th percentile: 0.12
sum: 240.75
Threads fairness:
events (avg/stddev): 1024.0000/0.00
execution time (avg/stddev): 0.0602/0.01
磁盘随机读写:
[user@localhost ~]$ sysbench fileio --threads=4 --file-total-size=12G --file-test-mode=rndrw run
sysbench 1.0.20 (using system LuaJIT 2.1.ROLLING)
Running the test with following options:
Number of threads: 4
Initializing random number generator from current time
Extra file open flags: (none)
128 files, 96MiB each
12GiB total file size
Block size 16KiB
Number of IO requests: 0
Read/Write ratio for combined random IO test: 1.50
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing random r/w test
Initializing worker threads...
Threads started!
File operations:
reads/s: 1273.44
writes/s: 848.96
fsyncs/s: 2762.58
Throughput:
read, MiB/s: 19.90
written, MiB/s: 13.27
General statistics:
total time: 10.1260s
total number of events: 48973
Latency (ms):
min: 0.01
avg: 0.81
max: 10.22
95th percentile: 1.70
sum: 39853.98
Threads fairness:
events (avg/stddev): 12243.2500/89.45
execution time (avg/stddev): 9.9635/0.00
磁盘顺序读:
[user@localhost ~]$ sysbench fileio --threads=4 --file-total-size=12G --file-test-mode=seqrd run
sysbench 1.0.20 (using system LuaJIT 2.1.ROLLING)
Running the test with following options:
Number of threads: 4
Initializing random number generator from current time
Extra file open flags: (none)
128 files, 96MiB each
12GiB total file size
Block size 16KiB
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing sequential read test
Initializing worker threads...
Threads started!
File operations:
reads/s: 41370.07
writes/s: 0.00
fsyncs/s: 0.00
Throughput:
read, MiB/s: 646.41
written, MiB/s: 0.00
General statistics:
total time: 10.0040s
total number of events: 414049
Latency (ms):
min: 0.00
avg: 0.10
max: 23.61
95th percentile: 0.03
sum: 39518.95
Threads fairness:
events (avg/stddev): 103512.2500/322.55
execution time (avg/stddev): 9.8797/0.00
磁盘顺序写:
[user@localhost ~]$ sysbench fileio --threads=4 --file-total-size=12G --file-test-mode=seqwr run
sysbench 1.0.20 (using system LuaJIT 2.1.ROLLING)
Running the test with following options:
Number of threads: 4
Initializing random number generator from current time
Extra file open flags: (none)
128 files, 96MiB each
12GiB total file size
Block size 16KiB
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing sequential write (creation) test
Initializing worker threads...
Threads started!
File operations:
reads/s: 0.00
writes/s: 2628.98
fsyncs/s: 3411.13
Throughput:
read, MiB/s: 0.00
written, MiB/s: 41.08
General statistics:
total time: 10.0778s
total number of events: 60372
Latency (ms):
min: 0.01
avg: 0.66
max: 60.50
95th percentile: 1.23
sum: 39867.75
Threads fairness:
events (avg/stddev): 15093.0000/158.27
execution time (avg/stddev): 9.9669/0.00
--【贰】--:
这个是真没有,啥都能玩一玩,就homo没玩过
--【叁】--:
有没有别的系统了? 跑个sysbench看看
这几天鸿蒙电脑的应用市场上架了一款融合开发引擎应用,根据应用描述,它可以运行一个虚拟化的Linux环境,满足开发和调试的需求。
image1787×953 104 KB
接下来我就使用MateBook Pro简单体验一下这款应用。
首次启动应用,会有一个配置环境的过程,很快。
配置完成后,就可以看到有一个OpenEuler的环境已经准备就绪了。
image1280×846 89.5 KB
在这里可以配置磁盘容量、内存大小、CPU核心数量和网络模式,其中内存大小最大是16G,CPU核心数最大是7核(嗯?好像不太对),网络模式有NAT和host-only两种模式。
关于左侧的附加功能:快照备份就不用多说了,用过虚拟机的应该都明白。文件共享可以选择一个鸿蒙电脑本机的目录映射到Linux环境中,实现文件的双向互传。
image1253×839 68 KB
配置好之后,原神林神,启动!
点击启动之后会弹出一个终端窗口,如果不小心关掉了这个窗口,可以回到融合开发引擎界面里点击打开终端按钮重新打开终端。
因为这只是一个轻量级的虚拟环境,它是不带图形界面的,终端就是我们与它交互的唯一方式。
image1389×734 41 KB
首先看一下uname -a,可以看到内核版本是6.6.0,这与openEuler 24.03 LTS SP2的内核版本是一致的。
[user@localhost ~]$ uname -a
Linux localhost 6.6.0 #1 SMP Wed Mar 4 04:04:43 UTC 2026 aarch64 aarch64 aarch64 GNU/Linux
既然是欧拉系统,那么欧拉能用的yum和dnf,它自然也可以用:
[user@localhost ~]$ sudo yum makecache
OS 12 kB/s | 1.9 kB 00:00
everything 22 kB/s | 2.0 kB 00:00
EPOL 25 kB/s | 2.0 kB 00:00
debuginfo 19 kB/s | 2.0 kB 00:00
source 19 kB/s | 1.9 kB 00:00
update 22 kB/s | 1.8 kB 00:00
update-source 17 kB/s | 1.8 kB 00:00
Metadata cache created.
我先安装上code-server和node.js,这样我就可以使用codex执行后续的任务了。
image2613×1259 290 KB
首先让codex配置一下开发环境,没有问题,而且sudo默认是没有密码的,它可以直接执行。
image1770×876 74.2 KB
对于运维人员来说,docker这类容器引擎是很常用的,但是我遗憾地发现,它是不能安装容器引擎的,因为这个虚拟环境里没有systemd,而是用hsl_init来完成环境初始化的(类似wsl 1?)。
[user@localhost ~]$ ps -aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
user 1 0.0 0.0 2040 860 ? Ss 22:03 0:00 /usr/bin/hsl_init
user 2 0.0 0.2 9776 8824 pts/0 Ss 22:03 0:00 /bin/bash
这样的话,即使在上面部署了一些服务,也没法做到开机自启,需要每次手动启动,有些麻烦。
接下来我试着安装了qemu,并在上面跑一台Alpine Linux虚拟机,引导成功了:
image1623×959 102 KB
先写这么多,后续我再跑一下性能测试啥的。有什么想法也可以说出来,我试一试。
网友解答:--【壹】--:
目前只有欧拉
CPU:
[user@localhost ~]$ sysbench cpu --threads=4 --time=60 run
sysbench 1.0.20 (using system LuaJIT 2.1.ROLLING)
Running the test with following options:
Number of threads: 4
Initializing random number generator from current time
Prime numbers limit: 10000
Initializing worker threads...
Threads started!
CPU speed:
events per second: 20609.47
General statistics:
total time: 60.0002s
total number of events: 1236604
Latency (ms):
min: 0.19
avg: 0.19
max: 8.50
95th percentile: 0.20
sum: 239617.12
Threads fairness:
events (avg/stddev): 309151.0000/60.75
execution time (avg/stddev): 59.9043/0.00
RAM:
[user@localhost ~]$ sysbench memory --threads=4 --time=60 --memory-block-size=1M --memory-total-size=4G run
sysbench 1.0.20 (using system LuaJIT 2.1.ROLLING)
Running the test with following options:
Number of threads: 4
Initializing random number generator from current time
Running memory speed test with the following options:
block size: 1024KiB
total size: 4096MiB
operation: write
scope: global
Initializing worker threads...
Threads started!
Total operations: 4096 (55380.94 per second)
4096.00 MiB transferred (55380.94 MiB/sec)
General statistics:
total time: 0.0723s
total number of events: 4096
Latency (ms):
min: 0.04
avg: 0.06
max: 3.89
95th percentile: 0.12
sum: 240.75
Threads fairness:
events (avg/stddev): 1024.0000/0.00
execution time (avg/stddev): 0.0602/0.01
磁盘随机读写:
[user@localhost ~]$ sysbench fileio --threads=4 --file-total-size=12G --file-test-mode=rndrw run
sysbench 1.0.20 (using system LuaJIT 2.1.ROLLING)
Running the test with following options:
Number of threads: 4
Initializing random number generator from current time
Extra file open flags: (none)
128 files, 96MiB each
12GiB total file size
Block size 16KiB
Number of IO requests: 0
Read/Write ratio for combined random IO test: 1.50
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing random r/w test
Initializing worker threads...
Threads started!
File operations:
reads/s: 1273.44
writes/s: 848.96
fsyncs/s: 2762.58
Throughput:
read, MiB/s: 19.90
written, MiB/s: 13.27
General statistics:
total time: 10.1260s
total number of events: 48973
Latency (ms):
min: 0.01
avg: 0.81
max: 10.22
95th percentile: 1.70
sum: 39853.98
Threads fairness:
events (avg/stddev): 12243.2500/89.45
execution time (avg/stddev): 9.9635/0.00
磁盘顺序读:
[user@localhost ~]$ sysbench fileio --threads=4 --file-total-size=12G --file-test-mode=seqrd run
sysbench 1.0.20 (using system LuaJIT 2.1.ROLLING)
Running the test with following options:
Number of threads: 4
Initializing random number generator from current time
Extra file open flags: (none)
128 files, 96MiB each
12GiB total file size
Block size 16KiB
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing sequential read test
Initializing worker threads...
Threads started!
File operations:
reads/s: 41370.07
writes/s: 0.00
fsyncs/s: 0.00
Throughput:
read, MiB/s: 646.41
written, MiB/s: 0.00
General statistics:
total time: 10.0040s
total number of events: 414049
Latency (ms):
min: 0.00
avg: 0.10
max: 23.61
95th percentile: 0.03
sum: 39518.95
Threads fairness:
events (avg/stddev): 103512.2500/322.55
execution time (avg/stddev): 9.8797/0.00
磁盘顺序写:
[user@localhost ~]$ sysbench fileio --threads=4 --file-total-size=12G --file-test-mode=seqwr run
sysbench 1.0.20 (using system LuaJIT 2.1.ROLLING)
Running the test with following options:
Number of threads: 4
Initializing random number generator from current time
Extra file open flags: (none)
128 files, 96MiB each
12GiB total file size
Block size 16KiB
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing sequential write (creation) test
Initializing worker threads...
Threads started!
File operations:
reads/s: 0.00
writes/s: 2628.98
fsyncs/s: 3411.13
Throughput:
read, MiB/s: 0.00
written, MiB/s: 41.08
General statistics:
total time: 10.0778s
total number of events: 60372
Latency (ms):
min: 0.01
avg: 0.66
max: 60.50
95th percentile: 1.23
sum: 39867.75
Threads fairness:
events (avg/stddev): 15093.0000/158.27
execution time (avg/stddev): 9.9669/0.00
--【贰】--:
这个是真没有,啥都能玩一玩,就homo没玩过
--【叁】--:
有没有别的系统了? 跑个sysbench看看

