大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。
Jetbrains全系列IDE稳定放心使用
制作ubuntu rootfs
下载base镜像:
http://cdimage.ubuntu.com/ubuntu-base/releases/16.04.1/release/
解压:
tar -zxf ubuntu-xx-base-amd64.tar.gz -C ./ubuntu-rootfs/
apt-get install qemu-user-static
cp /usr/bin/qemu-amd64-static usr/bin
cp -b /etc/resolv.conf etc/
#!/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 1’st, 2’nd or both parameters were missing”
echo “”
echo “1’st parameter can be one of these: -m(mount) OR -u(umount)”
echo “2’nd 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
sudo bash ./ch_mount.sh -m ./ubuntu-rootfs
挂载到根文件系统中去
先设置下用户名密码:
useradd -s ‘/bin/bash’ -m -G adm,sudo yourusername
echo “Set password for yourusername:”
passwd yourusername
echo “Set password for root:”
passwd root
设置主机名:
echo ‘ubuntu.yourusername’ > /etc/hostname
设置自动更新dns
dpkg-reconfigure resolvconf
安装各种常用的包
apt-get install \
language-pack-en-base \
sudo \
ssh \
net-tools \
network-manager \
iputils-ping \
rsyslog \
bash-completion
apt install gcc gdb tmux wget curl vim kmod -y
打包生成镜像
#!/bin/bash
image_name=$1
set -x
rm -rf tmpfs ${image_name}.img ${image_name}.img.tar.gz
dd if=/dev/zero of=${image_name}.img bs=1G count=4
mkfs.ext4 ${image_name}.img
mkdir -p tmpfs
mount ${image_name}.img tmpfs
cp -rfp ./ubuntu-amd64/* ./tmpfs/
umount tmpfs
e2fsck -p -f ${image_name}.img
resize2fs -M ${image_name}.img
tar zcf ${image_name}.img.tar.gz ${image_name}.img
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/185035.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...