0 Preface
- In daily development, it is often necessary to consider both x86 and arm system environments. This article provides the functions of installing the linux subsystem in the win10 system and configuring the arm subsystem in the x86 system
- This article uses wsl to install the subsystem in the win10 system, and uses qemu to configure the arm environment in the x86 system
1. Install the linux subsystem in the win10 system
- Open cmd, get the list of subsystems that wsl can install, and select an installation, here is ubuntu22.04
- After the installation is complete, restart the computer and open the subsystem
The first time you open it, you need to configure the account password (the account has sudo authority and can be cut to root)
-
First configure the apt source
- Reference link
(If you think it is well written, please give me a like, thank you~)
- Reference link
-
update apt
apt-get update apt-get upgrade
-
Configure the network
apt-get install net-tools apt-get install openssh-server # 编辑网络配置文件 vi /etc/ssh/sshd_config # 找到下面两行取消注释并配置 PermitRootLogin yes PermitEmptyPasswords no
-
Configure ssh to take effect and check, if there is active, it means success
systemctl start ssh systemctl status ssh
-
After the configuration is complete, you can try to change the password for root first, and then try to log in yourself
ssh root@localhost
-
If you can log in, exit and exit
-
-
Try to copy the file to local
-
first create a file
-
Open cmd on the PC and try to copy the file out
-
2. Configure the arm environment in the x86 system
-
First download an arm image
wget https://cdimage.ubuntu.com/releases/22.04/release/ubuntu-22.04.2-live-server-arm64.iso
-
Get the arm file system
mkdir myos mount ubuntu-22.04.2-live-server-arm64.iso myos/ cp myos/casper/ubuntu-server-minimal.squashfs . umount myos
-
Configure the folder of the arm system
unsquashfs ubuntu-server-minimal.squashfs apt-get install qemu-user-static cp /usr/bin/qemu-aarch64-static squashfs-root/usr/bin/
-
Configure the apt source and proxy
# 参考上面的apt-get源配置,注意这个是arm的源 vi ./squashfs-root/etc/apt/sources.list # 配置两个代理 vi ./squashfs-root/etc/resolv.conf # 补在上面打开的文件的最后 nameserver 8.8.8.8 nameserver 114.114.114.114
-
Switch to the arm subsystem and configure
# 进入子系统 chroot squashfs-root/ # 测试是否能联网 curl www.baidu.com # 更新apt apt-get update apt-get upgrade # 安装网络相关软件 apt-get install net-tools openssh-server # 可以装一下常用软件 apt-get install -y g++ gfortran iproute2 iputils-ping libbz2-dev libsqlite3-dev \ libblas-dev libblas3 libopenblas-dev libssl-dev libxslt1-dev libffi-dev \ make net-tools openssh-server openssl pciutils sudo unzip vim wget \ xz-utils zlib1g zlib1g-dev cron cmake # 根据需要安装python wget www.python.org/ftp/python/3.9.2/Python-3.9.2.tgz tar -zxf Python-3.9.2.tgz cd Python-3.9.2 ./configure --prefix=/usr/local/python3.9.2 --enable-shared make -j8 && make install -j8 cp /usr/local/python3.9.2/lib/libpython3.9.so.1.0 /usr/lib \ && ln -sf /usr/local/python3.9.2/bin/python3 /usr/bin/python \ && ln -sf /usr/local/python3.9.2/bin/python3 /usr/bin/python3 \ && ln -sf /usr/local/python3.9.2/bin/python3 /usr/bin/python3.9 \ && ln -sf /usr/local/python3.9.2/bin/python3 /usr/bin/python3.9.2 \ && ln -sf /usr/local/python3.9.2/bin/pip3 /usr/bin/pip3.9 \ && ln -sf /usr/local/python3.9.2/bin/pip3 /usr/bin/pip3.9.2
At this point, the system can be used as an arm system.