debian+pxe+preseed.cfg安裝配置

來源:互聯網
上載者:User

debian+pxe+preseed.cfg安裝配置 debian+pxe 最主要的是preseed 檔案的的配置,其他的基本沒有什麼難度。具體如下: apt-get install  apt-cacher-ng apache2 vim /etc/apt-cacher-ng/backends_debianhttp://mirrors.163.com/debian/ cat /etc/default/tftpd-hpa # /etc/default/tftpd-hpaTFTP_USERNAME="tftp"TFTP_DIRECTORY="/var/lib/tftpboot"TFTP_ADDRESS="0.0.0.0:69"TFTP_OPTIONS="--secure" vi /etc/dhcp/dhcpd.confsubnet 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/tftpbootcd /var/lib/tftpbootwget http://ftp.fr.debian.org/debian/dists/wheezy/main/installer-amd64/current/images/netboot/debian-installer/amd64/pxelinux.0mkdir -p /var/lib/tftpboot/debian/wheezy/amd64cd /var/lib/tftpboot/debian/wheezy/amd64wget http://ftp.fr.debian.org/debian/dists/wheezy/main/installer-amd64/current/images/netboot/debian-installer/amd64/linuxwget http://ftp.fr.debian.org/debian/dists/wheezy/main/installer-amd64/current/images/netboot/debian-installer/amd64/initrd.gzmkdir -p /var/lib/tftpboot/debian/wheezy/amd64/boot-screenscd /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/amd64wget http://people.debian.org/~dannf/add-firmware-to/add-firmware-tosed -i 's/lenny/wheezy/' add-firmware-tochmod +x add-firmware-to./add-firmware-to initrd.gz initrd.nonfree.gz wheezymv initrd.gz initrd.free.gzln -s initrd.nonfree.gz initrd.gz vim /var/lib/tftpboot/pxelinux.cfg/default # D-I config version 2.0include debian/wheezy/amd64/boot-screens/menu.cfgdefault debian/wheezy/amd64/boot-screens/vesamenu.c32prompt 1timeout 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_CNd-i console-keymaps-at/keymap select usd-i console-setup/ask_detect boolean falsed-i keyboard-configuration/xkb-keymap select usd-i keyboard-configuration/layoutcode string usd-i netcfg/choose_interface select autod-i netcfg/get_hostname string noconfiguredd-i netcfg/get_domain string test.comd-i netcfg/no_default_route boolean trued-i mirror/country string manuald-i mirror/protocol string httpd-i mirror/http/hostname string 192.88.50.46:3142d-i mirror/http/directory string /debian/d-i mirror/http/proxy stringd-i mirror/suite string wheezy### 設定時區d-i time/zone string Asia/Shanghaid-i clock-setup/utc boolean trued-i clock-setup/ntp boolean true### 設定分區 分別為swap 8G /home 2G / 10G /tmp 1G /use 40G /var 10G 剩餘的全部分給 /wwwd-i partman-auto/disk string /dev/vda  ###需要分區的磁碟檔案,預設為/dev/sdad-i partman-auto/method string lvmd-i partman-auto/choose_recipe select fsmd-i partman-lvm/device_remove_lvm boolean trued-i partman-md/device_remove_md boolean trued-i partman-auto-lvm/no_boot boolean trued-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 trued-i partman-lvm/confirm boolean trued-i partman-partitioning/confirm_write_new_label boolean trued-i partman/confirm_nooverwrite boolean trued-i partman/confirm boolean true### 儲存磁碟分割資訊d-i partman/choose_partition \    select Finish partitioning and write changes to disk d-i passwd/root-login boolean trued-i passwd/make-user boolean false### 設定root 使用者密碼d-i passwd/root-password password 111111d-i passwd/root-password-again password 111111d-i user-setup/allow-password-weak boolean true #d-i apt-setup/restricted boolean true### 安裝的軟體包tasksel tasksel/first multiselect standardd-i pkgsel/include string ruby openssh-server sysstat xinetd build-essential curl tcpdump chkconfig lrzsz atop htop iotop dstat  ethtool vim screen curl dmidecode lsb-release ntp ipmitool###d-i grub-installer/only_debian boolean trued-i grub-installer/with_other_os boolean truepopularity-contest popularity-contest/participate boolean falsed-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/firstbootchmod +x /root/firstboot # create a service that will run our firstboot scriptcat > /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 INFOcd /root ; /usr/bin/nohup sh -x /root/firstboot &EOF# install the firstboot servicechmod +x /etc/init.d/firstbootupdate-rc.d firstboot defaultsecho "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 sourcescat << EOF >/etc/apt/sources.listdeb http://mirrors.163.com/debian/ wheezy maindeb-src http://mirrors.163.com/debian/ wheezy main deb http://security.debian.org/ wheezy/updates main contribdeb-src http://security.debian.org/ wheezy/updates main contrib # wheezy-updates, previously known as 'volatile'deb http://mirrors.163.com/debian/ wheezy-updates main contribdeb-src http://mirrors.163.com/debian/ wheezy-updates main contribEOF update-rc.d firstboot removerm /etc/init.d/firstboot /root/firstboot chkconfig  rmnologin offchkconfig  nfs-common     offchkconfig  rpcbind     offchkconfig  rsync     offchkconfig  ipmievd       offchkconfig  exim4        offchkconfig  ntp        offchkconfig  salt-master offsed -i 's/false/true/g' /etc/default/sysstatcat << EOF >> /etc/hostnmaedebianEOF cat << EOF >> /root/.bashrcexport LS_OPTIONS='--color=auto'eval "``dircolors``"alias ls='ls $LS_OPTIONS'alias l='ls $LS_OPTIONS -lA'EOF /sbin/reboot 然後pxe引導後自己安裝,無需手工幹預。完成後記得修改機器名與Ip地址即可。
 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.