网络全自动安装ubuntu server推荐

服务端:centos5u4 x64(IP:192.168.242.253/24)

所需环境:dhcp (dhcp / dhcp-devel) httpd tftp (tftp / tftp-server) xinetd syslinux本文只针对如何通过net全自动安装ubuntu10.4-server,关于安装redhat不在本篇讨论,只是通过centos服务端的pxe引导与tftp等一系列所需iso镜像为:ubuntu10.4-server-amd64.iso挂载镜像:#cd /var/www/html/# cp ubuntu64/install/netboot/ubuntu-installer/amd64/initrd.gz ./#gunzipinitrd.gz#mvinitrdinitrd.img#mkdirinitrd#cdinitrd#cpio-i ../initrd.img 解压到当前目录制作gpg key(防止安装时出现bad mirrors 错误),需要安装rng-utils#gpg–gen-key 安装提示一步步下去,如果出现如下错误: Not enough random bytes available,说明系统中的熵值不足,没有足够的随机数给GPG来产生密钥。打开另一终端 可以通过这个命令查看有多少剩余的熵 # cat /proc/sys/kernel/random/entropy_avail 如果不足的话,可以用rngd来产生 # rngd -r /dev/urandom -o /dev/random -f -t 1#gpg–import ubuntu-archive-keyring.gpg导入当前key#gpg–list-key得到三个key的pub值#gpg–export437D05B5 FBB75451 92B92869 ubuntu-archive-keyring.gpg制作自动安装的cfg文件#cd/var/www/html/initrd就上面的那个initrd目录#vipreseed.cfg(貌似名字要固定),写入如下: d-i netcfg/get_domain string ubuntu #d-i netcfg/get_nameservers string 202.96.209.5 #d-i netcfg/get_ipaddress string 192.168.242.250 #d-i netcfg/get_netmask string 255.255.255.0 #d-i netcfg/get_gateway string 192.168.242.1 #d-i netcfg/confirm_static boolean true # Mirror settings d-i mirror/country string manual d-i mirror/http/hostname string 192.168.242.253 d-i mirror/http/directory string /ubuntu64 d-i mirror/http/proxy string # Clock and time zone setup d-i clock-setup/utc boolean false d-i time/zone string Asia/Shanghai # Partitioning d-i partman-auto/method string lvm d-i partman-lvm/device_remove_lvm boolean true d-i partman-md/device_remove_md boolean true d-i partman-lvm/confirm boolean true d-i partman-auto-lvm/guided_size string max d-i partman-auto/choose_recipe select atomic d-i partman/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 # Base system installation d-i base-installer/kernel/image string linux-generic # Account setup d-i passwd/root-login boolean true d-i passwd/root-password password 123qwe d-i passwd/root-password-again password 123qwe d-i passwd/make-user boolean false d-i user-setup/encrypt-home boolean false # Apt setup d-i apt-setup/use_mirror boolean false d-i apt-setup/services-select multiselect security d-i apt-setup/security_host string 192.168.242.253 d-i apt-setup/security_path string /ubuntu64 d-i debian-installer/allow_unauthenticated string true # Package selection tasksel tasksel/first multiselect standard d-i pkgsel/include string openssh-server vim d-i pkgsel/upgrade select none d-i pkgsel/language-packs multiselect en, zh d-i pkgsel/update-policy select none # Boot loader installation d-i grub-installer/only_debian boolean true # Finishing up the installation d-i finish-install/reboot_in_progress notebinetc initrdlib64mnt procsysusrdevinitlib mediapreseed.cfgsbintmpvar现在可以把initrd打包了#find . | cpio -o -H newc |gzip -9 ../initrd.gz#cd ..#mv initrd.gzinitrd.img#cp initrd.img/tftpboot/initrd-ubuntu.img2.复制必要的文件(此时centos还挂载在/mnt下)# cp /usr/lib/syslinux/pxelinux.0 /tftpboot/# mkdir /tftpboot/pxelinux.cfg# cp /mnt/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default# cp /var/www/html/ubuntu64/install/vmlinuz /tftpboot/vmlinuz-ubuntu# cp /mnt/isolinux/*.msg /tftpboot/3、修改/tftpboot/pxelinux.cfg/default文件修改后默认会安装ubuntu,如果有其他系统,类似修改相应的label项,然后在boot.msg中写明default ubuntuprompt 1display boot.msgF1 boot.msgF2 options.msgF3 general.msgF4 param.msgF5 rescue.msglabel ubuntukernel vmlinuz-ubuntuappend initrd=initrd-ubuntu.img devfs=nomount ramdisk_size=8192label linux textkernel vmlinuzappend text initrd=initrd.img devfs=nomount ramdisk_size=8192label linux expertkernel vmlinuzappend expert initrd=initrd.img devfs=nomount ramdisk_size=8192label linux rescuekernel vmlinuzappend rescue initrd=initrd.img devfs=nomount ramdisk_size=81924.配置DHCP及TFTP服务1. 配置tftp服务器#vi /etc/xined.d/tftp#cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.confcp:是否覆盖 /etc/dhcpd.conf ? y#vi /etc/dhcpd.conf filename pxelinux.0 //PXE得到IP以后的引导文件 next-server 192.168.242.253; //服务器IP地址。 subnet 192.168.242.0 netmask 255.255.255.0 { //所属网段及掩码。 # — default gateway option routers 192.168.242.1; //路由器IP,可以写网关IP option subnet-mask 255.255.255.0; # option nis-domain domain.org //注销 # option domain-name domain.org //注销 option domain-name-servers 192.168.242.253; //DNS服务器IP option time-offset -18000; # Eastern Standard Time # option netbios-node-type 2; range dynamic-bootp 192.168.242.100 192.168.242.200; //IP地址池范围。 default-lease-time 21600; ......后面省略 //写配置文件的时候注意每句后面的分号(;)不要丢了。#apt-get update 时出错,应该下载不到镜像Some index files failed to download, they have been ignored……解决:#mv /etc/apt/sources.list /etc/apt/sources.list.bk#vi /etc/apt/sources.list 添加如下:

deb http://Ubuntu.cn99.com/ubuntu/ lucid main universe restricted multiversedeb-src http://Ubuntu.cn99.com/ubuntu/ lucid main universe restricted multiversedeb http://Ubuntu.cn99.com/ubuntu/ lucid-security universe main multiverse restricteddeb-src http://Ubuntu.cn99.com/ubuntu/ lucid-security universe main multiverse restricteddeb http://Ubuntu.cn99.com/ubuntu/ lucid-updates universe main multiverse restricteddeb http://Ubuntu.cn99.com/ubuntu/ lucid-proposed universe main multiverse restricteddeb-src http://Ubuntu.cn99.com/ubuntu/ lucid-proposed universe main multiverse restricteddeb http://Ubuntu.cn99.com/ubuntu/ lucid-backports universe main multiverse restricteddeb-src http://Ubuntu.cn99.com/ubuntu/ lucid-backports universe main multiverse restricteddeb-src http://Ubuntu.cn99.com/ubuntu/ lucid-updates universe main multiverse restricted

#vi /etc/apt/apt.conf 把第一行注释#Acquire::http::Proxy http://192.168.242.254

如果心胸不似海,又怎能有海一样的事业。

网络全自动安装ubuntu server推荐

相关文章:

你感兴趣的文章:

标签云: