使用preseed脚本安装Ubuntu 14.04

使用PXE来安装Linux系统是系统集成中最基础的工作,,同时也是最容易被忽略的,平时一旦系统安装好之后,很少再管这部分。

关于PXE的集成工具,现在已经很多了,如cobbler。

但为了减少在这方面投入的时间,我们依然采用DHCP+TFTP+HTTP的方式来安装Linux系统。

PXE服务器是基于Ubuntu12.04-server-amd64配置的,CentOS系统使用kickstart脚本安装,Ubuntu系统采用preseed脚本安装。

关于CentOS的kickstart脚本,可以通过kickstart图形界面直接配置生成,此处不做具体介绍。

对于Ubuntu系统的preseed脚本,一直是使用人工配置。

1.使用本地HTTP proxy代替公共的HTTP proxy

之前使用preseed脚本安装Ubuntu 12.04过程中,为了方面安装都采用公共的HTTP的mirror(cn.archive.ubuntu.com)。

preseed脚本中关于mirror部分配置:

d-i mirror/protocol string httpd-i mirror/http/hostname string cn.archive.ubuntu.comd-i mirror/http/directory string /ubuntud-i mirror/http/proxy string

今天忽然想到使用本地代理,于是将Ubuntu12.04.4的preseed文件配置至本地HTTP服务器。

d-i mirror/country string manuald-i mirror/protocol string httpd-i mirror/http/hostname string 172.16.112.133 #HTTP服务器d-i mirror/http/directory string /ubuntu12.04.4 #ISO目录d-i mirror/http/proxy string #proxy地址

使用本地HTTP服务器后,安装过程中,报错为:

ubuntu 12.04 preseed debootstrap warning。

was corrupt。

此警告可忽略,直接点击continue可继续安装。

经过Google,有网友提出使用alternate版本的ISO安装可以回避这个问题,但经过实验使用alternate版本的ISO文件安装依然会报警。

经实验,从cn.archive.ubuntu.com下载Package.gz文件至HTTP服务器,依然会出现警告。

2.配置安装Ubuntu14.04的preseed脚本

ubuntu14.04使用preseed脚本安装会出现一些变化。

1.安装过程中,需添加自动处理脚本先卸载掉原有磁盘:

### Unmount the /dev/sda1.d-i preseed/early_command string umount /media

2. 在Ubuntu14.04系统安装过程中,需处理live-installer的问题

在ubuntu12.10以后的版本中,当install base system 时,会出现一下错误:

main-menu[954]: info:Menu item ‘live-installer’ selected

base-installer: error: cloud not find any live images.

需在preseed脚本中添加live-installer处理:

###After the Ubuntu12.10, preseedfile need live-installer.

d-i live-installer/net-image string

经过以上处理,安装ubuntu-14.04.2-server-amd64系统使用的preseed脚本为:

### Localization.d-i auto-install/enable boolean trued-i debian-installer/locale string en_USd-i localechooser/translation/warn-light boolean trued-i localechooser/translation/warn-severe boolean trued-i console-setup/ask_detect boolean falsed-i keyboard-configuration/layoutcode string us

### Net interface setting.d-i netcfg/choose_interface select eth0d-i netcfg/dhcp_timeout string 60d-i netcfg/get_hostname string novad-i netcfg/get_domain string xinlixun.cn

### Mirror setting. use the local proxy.d-i mirror/country string manuald-i mirror/protocol string httpd-i mirror/http/hostname string 172.16.112.133d-i mirror/http/directory string /ubuntu14.04.2/d-i mirror/http/proxy string

### Clock and timezone setting. use local ntp.d-i clock-setup/utc boolean trued-i time/zone string Asia/Chongqingd-i clock-setup/ntp boolean trued-i clock-setup/ntp-server 172.16.112.133

### Partioning setting.#d-i partman-auto/disk string /dev/sdad-i partman-auto-lvm/guided_size string maxd-i partman-auto/choose_recipe select atomicd-i partman-auto/method string lvmd-i partman-lvm/confirm boolean trued-i partman-lvm/confirm boolean trued-i partman-lvm/confirm_nooverwrite boolean trued-i partman-lvm/device_remove_lvm boolean trued-i partman/choose_partition select finishd-i partman/confirm boolean trued-i partman/confirm_nooverwrite boolean trued-i partman/confirm_write_new_label boolean true

### Account setting.d-i passwd/root-login boolean falsed-i passwd/user-fullname string testd-i passwd/username string testd-i passwd/user-password password test123d-i passwd/user-password-again password test123d-i user-setup/allow-password-weak boolean trued-i user-setup/encrypt-home boolean false

###After the Ubuntu12.10, preseedfile need live-installer.d-i live-installer/net-image string

### Package selection.d-i pkgsel/include string openssh-serverd-i pkgsel/upgrade select noned-i pkgsel/update-policy select nonetasksel tasksel/first multiselect standard, ubuntu-server

### Boot loader installation.d-i grub-installer/only_debian boolean trued-i grub-installer/with_other_os boolean true

### finishing up the installation.d-i finish-install/reboot_in_progress note

### Running custom commands.d-i preseed/late_command string echo “hello” >> /root/test

### Unmount the /dev/sda1.d-i preseed/early_command string umount /media

Ubuntu 14.04 下载、安装、配置的相关知识

Ubuntu 14.04系统下载地址:

Windows 7下硬盘安装Ubuntu 14.04图文教程

本文永久更新链接地址:

会让你的心态更平和更坦然,也会让你心无旁骛,更会让你的心灵得到解脱和抚慰。

使用preseed脚本安装Ubuntu 14.04

相关文章:

你感兴趣的文章:

标签云: