当前位置: 首页 > news >正文

VirtualBox Debian 自动安装脚本

概览

相较于原脚本(安装目录/UnattendedTemplates/debian_pressed.cfg)更新如下内容:

  1. 配置清华镜像源
  2. 配置仅主机网卡(后续只需添加仅主机网卡即可)
  3. 配置Root用户远程登录
  4. 配置用户sudo组

脚本 debian_pressed.cfg

### Partitioning
d-i partman-auto/disk string /dev/sda
d-i partman-auto/method string regular
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-auto/choose_recipe select atomic# This makes partman automatically partition without confirmation
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true# Locale
d-i debian-installer/locale string @@VBOX_INSERT_LOCALE@@
d-i console-setup/ask_detect boolean false
d-i console-setup/layoutcode string us
d-i keyboard-configuration/xkb-keymap select us# Network
d-i netcfg/get_hostname string @@VBOX_INSERT_HOSTNAME_WITHOUT_DOMAIN@@
d-i netcfg/get_domain string @@VBOX_INSERT_HOSTNAME_DOMAIN@@
d-i netcfg/choose_interface select auto# Clock
@@VBOX_COND_IS_RTC_USING_UTC@@
d-i clock-setup/utc-auto boolean true
d-i clock-setup/utc boolean true
@@VBOX_COND_END@@
@@VBOX_COND_IS_NOT_RTC_USING_UTC@@
d-i clock-setup/utc-auto boolean false
d-i clock-setup/utc boolean false
@@VBOX_COND_END@@
d-i time/zone string @@VBOX_INSERT_TIME_ZONE_UX@@
@@VBOX_COND_IS_INSTALLING_ADDITIONS@@d-i clock-setup/ntp boolean false@@VBOX_COND_END@@
@@VBOX_COND_IS_NOT_INSTALLING_ADDITIONS@@d-i clock-setup/ntp boolean true@@VBOX_COND_END@@# Packages, Mirrors, Image
d-i base-installer/kernel/override-image string linux-server
d-i base-installer/kernel/override-image string linux-image-amd64
d-i pkgsel/install-language-support boolean false@@VBOX_COND_AVOID_UPDATES_OVER_NETWORK@@
# d-i apt-setup/use_mirror boolean true
# d-i netcfg/no_default_route true
d-i netcfg/get_nameservers ""
@@VBOX_COND_END@@@@VBOX_COND_IS_NOT_MINIMAL_INSTALLATION@@
# d-i apt-setup/restricted boolean true
# d-i apt-setup/universe boolean true
tasksel tasksel/first multiselect minimal
d-i pkgsel/include string openssh-server sudo vim
d-i pkgsel/upgrade select none
@@VBOX_COND_END@@@@VBOX_COND_IS_MINIMAL_INSTALLATION@@
tasksel tasksel/first multiselect minimal
d-i pkgsel/include string openssh-server sudo vim
d-i pkgsel/upgrade select none
@@VBOX_COND_END@@# Users
d-i passwd/user-fullname string @@VBOX_INSERT_USER_FULL_NAME@@
d-i passwd/username string @@VBOX_INSERT_USER_LOGIN@@
d-i passwd/user-password password @@VBOX_INSERT_USER_PASSWORD@@
d-i passwd/user-password-again password @@VBOX_INSERT_USER_PASSWORD@@
d-i passwd/root-login boolean true
d-i passwd/root-password password @@VBOX_INSERT_ROOT_PASSWORD@@
d-i passwd/root-password-again password @@VBOX_INSERT_ROOT_PASSWORD@@
d-i user-setup/allow-password-weak boolean true
d-i passwd/user-default-groups string admin sudo# Grub
d-i grub-installer/grub2_instead_of_grub_legacy boolean true
d-i grub-installer/only_debian boolean true# Due notably to potential USB sticks, the location of the MBR can not be
# determined safely in general, so this needs to be specified:
#d-i grub-installer/bootdev  string /dev/sda
# To install to the first device (assuming it is not a USB stick):
d-i grub-installer/bootdev  string defaultd-i finish-install/reboot_in_progress note# Custom Commands.
# Note! Debian netboot images use busybox, so no bash.
#       Tell script to use target bash.
# 1. 配置清华像源
# 2. 配置仅主机网卡
# 3. 配置Root用户远程登录
d-i apt-setup/use_cdrom boolean false
d-i preseed/late_command string cp /cdrom/vboxpostinstall.sh /target/root/vboxpostinstall.sh \&& chmod +x /target/root/vboxpostinstall.sh \&& /bin/sh /target/root/vboxpostinstall.sh --need-target-bash --preseed-late-command; \in-target sh -c "mv /etc/apt/sources.list /etc/apt/sources.list.bak && touch /etc/apt/sources.list"; \in-target sh -c "echo 'deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware' > /etc/apt/sources.list"; \in-target sh -c "echo 'deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware' >> /etc/apt/sources.list"; \in-target sh -c "echo 'deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware' >> /etc/apt/sources.list"; \in-target sh -c "echo 'deb https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware' >> /etc/apt/sources.list"; \in-target apt-get update; \in-target sh -c "echo 'auto enp0s8' >> /etc/network/interfaces"; \in-target sh -c "echo 'iface enp0s8 inet dhcp' >> /etc/network/interfaces"; \in-target sed -i 's/^#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config;
http://www.lryc.cn/news/431344.html

相关文章:

  • 最好的开放式耳机?五款红榜开放式耳机推荐!
  • 线性代数之线性方程组
  • 速盾:怎么查看是否使用cdn服务?
  • 828华为云征文|采用Flexus云服务器X实例部署RTSP直播服务器
  • Spring Cloud Gateway(二)
  • docker 简易入门
  • 【看雪-注册安全分析报告】
  • 记录一个前端学习小组的收集的模版
  • Rk3588 Android12 AIDL 开发
  • 两个长整数字符串求和(不允许使用ES6+)
  • 11 Java 方法引用、异常处理、Java接口之函数式编程(接口知识补充Function<T,R>、BiFunction<T, U, R>和自定义泛型接口)
  • 深入探索 Go 语言的编译器与垃圾回收机制
  • 2024国赛数学建模-模拟火算法(MATLAB 实现)
  • YOLOv8 只检测人 只画框不要标签
  • 如何将网络安全防范游戏化
  • Qt QGraphicsView实现图片放缩、鼠标拖动移动、鼠标点位置放大缩小_图片查看
  • Percona Toolkit 神器全攻略(复制类)
  • SQLite3 数据类型深入全面讲解
  • Python高效实现Trie(前缀树)及其插入和查找操作
  • 傅里叶变换家族
  • 深度学习——强化学习算法介绍
  • 轴承知识大全,详细介绍(附3D图纸免费下载)
  • 【PyTorch】基础环境如何打开
  • QT教程:QTime和QTimer的使用场景
  • MySQL 迁移中 explicit_defaults_for_timestamp 参数影响
  • 树状数组记录
  • 客户端时间和服务器时间的区别
  • 已入职华为!!关于我成功拿下华为大模型算法岗经验总结
  • 从安卓开发到AI产品经理——我的AI绘画之旅
  • 代码随想录八股训练营第三十四天| C++