debian+pxe+preseed.cfg 安装配置
2019独角兽企业重金招聘Python工程师标准>>>
debian+pxe 最主要的是preseed 文件的的配置,其他的基本没有什么难度。具体如下:
apt-get install apt-cacher-ng apache2
vim /etc/apt-cacher-ng/backends_debian
http://mirrors.163.com/debian/
cat /etc/default/tftpd-hpa
# /etc/default/tftpd-hpa
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/var/lib/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="--secure"
vi /etc/dhcp/dhcpd.conf
subnet 192.88.50.0 netmask 255.255.255.0 {
range 192.88.50.200 192.88.50.253;
option domain-name-servers 192.88.50.42;
option routers 192.88.50.1;
default-lease-time 600;
max-lease-time 7200;
next-server 192.88.50.46;
filename "pxelinux.0";
}
mkdir /var/lib/tftpboot
cd /var/lib/tftpboot
wget http://ftp.fr.debian.org/debian/dists/wheezy/main/installer-amd64/current/images/netboot/debian-installer/amd64/pxelinux.0
mkdir -p /var/lib/tftpboot/debian/wheezy/amd64
cd /var/lib/tftpboot/debian/wheezy/amd64
wget http://ftp.fr.debian.org/debian/dists/wheezy/main/installer-amd64/current/images/netboot/debian-installer/amd64/linux
wget http://ftp.fr.debian.org/debian/dists/wheezy/main/installer-amd64/current/images/netboot/debian-installer/amd64/initrd.gz
mkdir -p /var/lib/tftpboot/debian/wheezy/amd64/boot-screens
cd /var/lib/tftpboot/debian/wheezy/amd64/boot-screens
lftp http://ftp.fr.debian.org/debian/dists/wheezy/main/installer-amd64/current/images/netboot/debian-installer/amd64/boot-screens/
下载所需文件:
get syslinux.cfg menu.cfg vesamenu.c32
mkdir -p /var/lib/tftpboot/pxelinux.cfg/
cd /var/lib/tftpboot/pxelinux.cfg/
wget http://ftp.fr.debian.org/debian/dists/wheezy/main/installer-amd64/current/images/netboot/debian-installer/amd64/pxelinux.cfg/default
cd /var/lib/tftpboot/debian/wheezy/amd64
wget http://people.debian.org/~dannf/add-firmware-to/add-firmware-to
sed -i 's/lenny/wheezy/' add-firmware-to
chmod +x add-firmware-to
./add-firmware-to initrd.gz initrd.nonfree.gz wheezy
mv initrd.gz initrd.free.gz
ln -s initrd.nonfree.gz initrd.gz
vim /var/lib/tftpboot/pxelinux.cfg/default
# D-I config version 2.0
include debian/wheezy/amd64/boot-screens/menu.cfg
default debian/wheezy/amd64/boot-screens/vesamenu.c32
prompt 1
timeout 3
DEFAULT wheezy_amd64
LABEL wheezy_amd64
kernel debian/wheezy/amd64/linux
append vga=normal initrd=debian/wheezy/amd64/initrd.gz auto=true interface=auto netcfg/dhcp_timeout=60 netcfg/choose_interface=auto priority=critical url=http://192.88.50.46/pxe/preseed.cfg DEBCONF_DEBUG=5
IPAPPEND 2
mkdir /var/www/pxe
vim /var/www/pxe/preseed.cfg
d-i debian-installer/locale string zh_CN
d-i console-keymaps-at/keymap select us
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/xkb-keymap select us
d-i keyboard-configuration/layoutcode string us
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string noconfigured
d-i netcfg/get_domain string test.com
d-i netcfg/no_default_route boolean true
d-i mirror/country string manual
d-i mirror/protocol string http
d-i mirror/http/hostname string 192.88.50.46:3142
d-i mirror/http/directory string /debian/
d-i mirror/http/proxy string
d-i mirror/suite string wheezy
### 设置时区
d-i time/zone string Asia/Shanghai
d-i clock-setup/utc boolean true
d-i clock-setup/ntp boolean true
### 设置分区 分别为swap 8G /home 2G / 10G /tmp 1G /use 40G /var 10G 剩余的全部分给 /www
d-i partman-auto/disk string /dev/vda ###需要分区的磁盘文件,默认为/dev/sda
d-i partman-auto/method string lvm
d-i partman-auto/choose_recipe select fsm
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-auto-lvm/no_boot boolean true
d-i partman-auto-lvm/new_vg_name string vg0
d-i partman-auto/expert_recipe string \
fsm :: \
1024 100% 8192 linux-swap method{ swap } \
format{ } $lvmok{ } lv_name{ swap } \
. \
2048 2048 2048 ext4 method{ lvm } \
$lvmok{ } mountpoint{ /home } lv_name{ home } \
format{ } use_filesystem{ } filesystem{ ext4 } \
. \
10240 10240 10240 ext4 method{ lvm } \
$lvmok{ } mountpoint{ / } lv_name{ root } \
format{ } use_filesystem{ } filesystem{ ext4 } \
options/relatime{ relatime } \
. \
768 1024 1024 ext4 method{ lvm } \
$lvmok{ } mountpoint{ /tmp } lv_name{ tmp } \
format{ } use_filesystem{ } filesystem{ ext4 } \
options/relatime{ relatime } \
. \
10240 40960 40960 ext4 method{ lvm } \
$lvmok{ } mountpoint{ /usr } lv_name{ usr } \
format{ } use_filesystem{ } filesystem{ ext4 } \
options/relatime{ relatime } \
. \
7680 10240 10240 ext4 method{ lvm } \
$lvmok{ } mountpoint{ /var } lv_name{ var } \
format{ } use_filesystem{ } filesystem{ ext4 } \
options/relatime{ relatime } \
. \
1 2048 1000000000 ext4 method{ lvm } \
$lvmok{ } mountpoint{ /www } lv_name{ www } \
format{ } use_filesystem{ } filesystem{ ext4 } \
options/relatime{ relatime } \
.
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-lvm/confirm boolean true
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman/confirm boolean true
### 保存磁盘分区信息
d-i partman/choose_partition \
select Finish partitioning and write changes to disk
d-i passwd/root-login boolean true
d-i passwd/make-user boolean false
### 设置root 用户密码
d-i passwd/root-password password 111111
d-i passwd/root-password-again password 111111
d-i user-setup/allow-password-weak boolean true
#d-i apt-setup/restricted boolean true
### 安装的软件包
tasksel tasksel/first multiselect standard
d-i pkgsel/include string ruby openssh-server sysstat xinetd build-essential curl tcpdump chkconfig lrzsz atop htop iotop dstat ethtool vim screen curl dmi
decode lsb-release ntp ipmitool
###
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
popularity-contest popularity-contest/participate boolean false
d-i finish-install/reboot_in_progress note
# Once the installation is done we'll set the system up for some firstboot
# magic. 安装完成后需要执行的其他命令
d-i preseed/late_command string chroot /target sh -c "/usr/bin/curl -o /tmp/postinstall http://192.88.50.46/pxe/postinstall && /bin/sh -x /tmp/postinstall"
vim /var/www/pxe/postinstall
#!/bin/bash
# grab our firstboot script
/usr/bin/curl -o /root/firstboot http://192.88.50.46/pxe/firstboot
chmod +x /root/firstboot
# create a service that will run our firstboot script
cat > /etc/init.d/firstboot << EOF
### BEGIN INIT INFO
# Provides: firstboot
# Required-Start: $networking
# Required-Stop: $networking
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: A script that runs once
# Description: A script that runs once
### END INIT INFO
cd /root ; /usr/bin/nohup sh -x /root/firstboot &
EOF
# install the firstboot service
chmod +x /etc/init.d/firstboot
update-rc.d firstboot defaults
echo "finished postinst"
vim /var/www/pxe/firstboot
#!/bin/sh
PXESERVER=192.88.50.46
# This script will run the first time the system boots. Even
# though we've told it to run after networking is enabled,
#
# Introducing a brief sleep makes things work right all the
# time. The time for DHCP to catch up.
sleep 120
# install our new sources
cat << EOF >/etc/apt/sources.list
deb http://mirrors.163.com/debian/ wheezy main
deb-src http://mirrors.163.com/debian/ wheezy main
deb http://security.debian.org/ wheezy/updates main contrib
deb-src http://security.debian.org/ wheezy/updates main contrib
# wheezy-updates, previously known as 'volatile'
deb http://mirrors.163.com/debian/ wheezy-updates main contrib
deb-src http://mirrors.163.com/debian/ wheezy-updates main contrib
EOF
update-rc.d firstboot remove
rm /etc/init.d/firstboot /root/firstboot
chkconfig rmnologin off
chkconfig nfs-common off
chkconfig rpcbind off
chkconfig rsync off
chkconfig ipmievd off
chkconfig exim4 off
chkconfig ntp off
chkconfig salt-master off
sed -i 's/false/true/g' /etc/default/sysstat
cat << EOF >> /etc/hostnmae
debian
EOF
cat << EOF >> /root/.bashrc
export LS_OPTIONS='--color=auto'
eval "``dircolors``"
alias ls='ls $LS_OPTIONS'
alias l='ls $LS_OPTIONS -lA'
EOF
/sbin/reboot
然后pxe引导后自己安装,无需手工干预。完成后记得修改机器名与Ip地址即可。
转载于:https://my.oschina.net/u/142602/blog/171328
debian+pxe+preseed.cfg 安装配置相关推荐
- RHEL6 PXE+KickStart全自动安装配置指南
笔者之前也配置过RHEL5.4的PXE+KickStart自动安装,这次在RHEL6上面测试了下PXE+KickStart配置,发现6和5版本对比存在一些细微的差别,因而记录操作步骤如下,在开始操作之 ...
- Debian Linux下安装配置 Pure-ftpd
PureFTPd 是一款专注于程序健壮和软件安全的免费FTP服务器软件(基于BSD License).其可以在多种类Unix操作系统中编译运行,包括Linux.OpenBSD.FreeBSD.Sola ...
- debian 10 buster 安装配置 elastic search 和 中文, 拼音分词
debian 10 buster 安装配置 es 和 中文, 拼音分词 安装 测试 配置 分词 IK 分词器 拼音分词 一个完整的动态映射模板(包含geo, pinyin, IK) 安装 1, 安装j ...
- linux配置PXE+DHCP批量安装操作系统
PXE(preboot execute environment,预启动执行环境) 如果只有一两台电脑要装系统,我们可以使用光盘或者U盘装系统,假如有成百上千台电脑需要装操作系统,如果还用光盘U盘的方式 ...
- 如何在Debian上安装配置ownCloud
如何在Debian上安装配置ownCloud 据其官方网站,ownCloud可以让你通过一个Web界面或者WebDAV访问你的文件.它还提供了一个平台,可以轻松地查看.编辑和同步您所有设备的通讯录.日 ...
- debian sarge + postfix + mysql + webmail + web admin安装配置指南
非常简明的debian sarge + postfix + mysql + webmail + web admin安装配置指南 想在debian上安装postfix邮件系统很多年了,参考了许多网上的资 ...
- CentOS 6.4下PXE+Kickstart无人值守安装操作系统
一.简介 1.1 什么是PXE PXE(Pre-boot Execution Environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持 ...
- 运维自动化之Cobbler安装配置
Cobbler是一个快速网络安装linux的服务,而且在经过调整也可以支持网络安装windows.该工具使用python开发,小巧轻便(才15k行代码),使用简单的命令即可完成PXE网络安装环境的配置 ...
- 通过PXE服务器批量安装系统
通过PXE服务器批量安装系统 一.环境介绍 1.PXE服务器版本 2.挂载光盘 3.配置yum仓库 二.部署DHCP服务器 1.安装相关软件包 2.编辑DHCP配置文件 3.重启dhcp服务 4.放行 ...
最新文章
- java中Array和ArrayList区别 可以将 ArrayList想象成一种会自动扩增容量的Array
- python装饰器类-python_类装饰器
- 【Flutter】Image 组件 ( 加载网络图片 | 加载静态图片 | 加载本地图片 | path_provider 插件 )
- 计算机操作和电子技术应用,电子技术应用是学什么
- Vue组件化|通用组件开发——Notification通知组件
- java混淆工具zelix比较_常用的5款java混淆器
- 【单位圆覆盖最多点】POJ 1981
- 类工厂模式(TDB)
- mysql基础入门之cmd登录等简单操作
- 《Python数据分析与挖掘》实战项目 - Python程序设计(期末大作业、课程设计、毕业设计)2012-2021近十年考研英语一真题词汇词频统计与可视化(附代码)
- 禅道安装/禅道远程数据库连接
- OCR光学字符识别(一)
- openssl bio
- 小鹏高增长下的隐忧:太像特斯拉是一个魔咒?
- Scientific Linux 6(x86_64) 之旅
- rc52实现的部分代码
- cent os通过ssh安装图形桌面
- 计算机基础教学评价ppt,教学PPT课件:教学PPT的设计原理和评价标准
- Windows 技巧集锦
- 人工智能医疗应用浪潮背后问题多:AI与医疗结合的机遇和风险
热门文章
- 中电信抢滩云计算 在上海开建“信息银行”
- 【跃迁之路】【530天】刻意练习系列289(2018.07.20)
- Uber将动态调价机制引入其外卖服务UberEats
- 解决linux病毒导致带宽跑满的解决过程 ,可以参考参考
- mybatis调用oracle存储过程
- [SharePoint 2010] Configuration SMTP for SharePoint 2010
- 忘了root口令解决方法
- SSO(Single Sign-on) in Action
- 自定义弹出框控件制作及示例
- 演示:动态路由协议RIPv1的配置