ubuntu文件系统制作(从无到有)-ubuntu文件操作

目录

1,下载ubuntu-base

2,解压文件

3,安装 qemu

4,设置源

5,挂载文件系统

6,设置账户名和密码

7,添加主机入口到/etc/hosts

8,添加nameserver

9,安装桌面

10,取消挂载

11,制作IMG镜像

1,下载ubuntu-base

 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-cdimage/ubuntu-base/releases/20.04/release/ 

ubuntu文件系统制作(从无到有)-ubuntu文件操作

2,解压文件mkdir ubuntu2004-rootfs sudo tar -xpvf ubuntu-base-20.04.5-base-arm64.tar.gz -C ubuntu2004-rootfs3,安装 qemusudo apt-get install qemu-user-static sudo cp /usr/bin/qemu-arm-static ubuntu2004-rootfs/usr/bin/4,设置源#将主机DNS拷贝至虚拟机,为了方便虚拟机能上网 sudo cp /etc/resolv.conf ./etc/resolv.conf

清华源

安装apt-transport-https工具

apt update apt install apt-transport-https

遇到问题

问题:Ceritificate verification failed:

Err:5 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports focal Release Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown. Could not handshake: Error in the certificate verification. [IP: 101.6.15.130 443]

ubuntu文件系统制作(从无到有)-ubuntu文件操作

解决办法

touch apt/apt.conf.d/99verify-peer.conf \ && echo >>/etc/apt/apt.conf.d/99verify-peer.conf “Acquire { https::Verify-Peer false }”

问题2

ubuntu文件系统制作(从无到有)-ubuntu文件操作

apt install –reinstall ca-certificates

5,挂载文件系统

挂载脚本(ch-mount.sh)

#!/bin/bash # function mnt() { echo “MOUNTING” sudo mount -t proc /proc ${2}proc sudo mount -t sysfs /sys ${2}sys sudo mount -o bind /dev ${2}dev sudo mount -o bind /dev/pts ${2}dev/pts sudo chroot ${2} } function umnt() { echo “UNMOUNTING” sudo umount ${2}proc sudo umount ${2}sys sudo umount ${2}dev/pts sudo umount ${2}dev } if [ “$1” == “-m” ] && [ -n “$2” ] ; then mnt $1 $2 elif [ “$1” == “-u” ] && [ -n “$2” ]; then umnt $1 $2 else echo “” echo “Either 1st, 2nd or both parameters were missing” echo “” echo “1st parameter can be one of these: -m(mount) OR -u(umount)” echo “2nd parameter is the full path of rootfs directory(with trailing /)” echo “” echo “For example: ch-mount -m /media/sdcard/” echo “” echo 1st parameter : ${1} echo 2nd parameter : ${2} fi
<
chmod a+x ch-mount.sh ./ch-mount.sh -m ubuntu-rootfs/6,设置账户名和密码7,设置主机名useradd -s /bin/bash -m -G adm,sudo joyu passwd joyu passwd rootecho ubuntu.joyu > /etc/hostname7,添加主机入口到/etc/hosts127.0.0.1 localhost 127.0.0.1 ubuntu.joyu 127.0.1.1 joyu 8,添加nameservervim /etc/resolvconf/resolv.conf.d/head #添加nameserver nameserver 114.114.114.114 nameserver 8.8.8.89,安装桌面

安装桌面软件,包括系统面板、窗口管理器、文件浏览器、终端等各类桌面应用程序。

apt install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal ubuntu-desktop10,取消挂载exit ./ch-mount.sh -u ubuntu-rootfs/11,制作IMG镜像dd if=/dev/zero of=ubuntu2004-rootfs.img bs=1M count=4000 mkfs.ext4 ubuntu2004-rootfs.img sudo mount ubuntu2004-rootfs.img rootfs/ sudo cp -rfp ubuntu-rootfs/* rootfs/ sudo umount rootfs/ e2fsck -p -f ubuntu2004-rootfs.img resize2fs -M ubuntu2004-rootfs.img

免责声明:文章内容来自互联网,本站不对其真实性负责,也不承担任何法律责任,如有侵权等情况,请与本站联系删除。
转载请注明出处:ubuntu文件系统制作(从无到有)-ubuntu文件操作 https://www.yhzz.com.cn/a/9288.html

上一篇 2023-04-20 13:27:28
下一篇 2023-04-20 13:29:58

相关推荐

联系云恒

在线留言: 我要留言
客服热线:400-600-0310
工作时间:周一至周六,08:30-17:30,节假日休息。