系統(tǒng)之家 - 系統(tǒng)光盤下載網(wǎng)站!

當(dāng)前位置:系統(tǒng)之家 > 系統(tǒng)教程 > Linux全自動(dòng)安裝

Linux全自動(dòng)安裝操作實(shí)例

時(shí)間:2015-02-07 17:03:23 作者:qipeng 來源:系統(tǒng)之家 1. 掃描二維碼隨時(shí)看資訊 2. 請(qǐng)使用手機(jī)瀏覽器訪問: https://m.xitongzhijia.net/xtjc/20150207/37599.html 手機(jī)查看 評(píng)論

  手動(dòng)安裝Linux系統(tǒng)費(fèi)時(shí)費(fèi)力,需要操作的步驟非常多,使用kickstart等工具就能實(shí)現(xiàn)Linux系統(tǒng)的全自動(dòng)安裝,下面小編就給大家介紹下Linux全自動(dòng)安裝操作實(shí)例,一起來學(xué)習(xí)下吧。

 Linux全自動(dòng)安裝操作實(shí)例

  原理:

  使用光盤安裝linux系統(tǒng)過程:

  第一步,POST自檢

  第二步,MBR引導(dǎo),這里使用的GRUB是CDROM中isolinux/文件夾中的grub.conf。

  第三步,啟動(dòng)帶有安裝、升級(jí)、修復(fù)等選項(xiàng)的選擇菜單,這是由isolinux.bin啟動(dòng)的。

  第四步,vmlinuz(initrd)掛載根文件系統(tǒng)。

  第五步,啟動(dòng)anaconda安裝界面。而anaconda

  詳細(xì)解析:

  第二步中,grub.conf菜單中定義了第三步中的引導(dǎo)內(nèi)容。

  所以這里的顯示內(nèi)容可以自定義

  [root@CentOS6 cdrom]# cat isolinux/grub.conf

  #debug --graphics

  default=0

  splashimage=@SPLASHPATH@

  timeout 5

  hiddenmenu

  title @PRODUCT@ @VERSION@

  kernel @KERNELPATH@

  initrd @INITRDPATH@

  title Install system with basic video driver

  kernel @KERNELPATH@ xdriver=vesa nomodeset askmethod

  initrd @INITRDPATH@

  title rescue

  kernel @KERNELPATH@ rescue askmethod

  initrd @INITRDPATH@

  第三步,進(jìn)入啟動(dòng)界面,這里定義了啟動(dòng)界面的各種顯示內(nèi)容,

  由isolinux.bin執(zhí)行,由isolinux.cfg提供配置文件。

  display boot.msg

  引用boot.msg,其配置文件為boot.cfg

  menu background splash.jpg

  menu title Welcome to CentOS 6.4!最上面顯示的內(nèi)容

  menu color border 0 #ffffffff #00000000定義界面的顏色顯示

  menu color sel 7 #ffffffff #ff000000

  定義選項(xiàng)

  label linux

  menu label ^Install or upgrade an existing system

  menu default

  kernel vmlinuz

  append initrd=initrd.img

  label vesa

  menu label Install system with ^basic video driver

  kernel vmlinuz

  append initrd=initrd.img xdriver=vesa nomodeset

  label rescue

  menu label ^Rescue installed system

  kernel vmlinuz

  append initrd=initrd.img rescue

  label local

  menu label Boot from ^local drive

  localboot 0xffff

  label memtest86

  menu label ^Memory test

  kernel memtest

  append -

  第五步,真正進(jìn)入安裝時(shí),需要加載Packages/anaconda-VERSION.rpm文件

  anaconda程序可以實(shí)現(xiàn)圖形、字符方式的安裝,而在這兩種方式下,

  也可以選擇交互式安裝或自問自答的自動(dòng)安裝。

  anaconda安裝詳解:

  其自動(dòng)安裝的配置文件是口kickstart。kickstart可以手動(dòng)編寫,可以文本方式生成,也可以

  圖形方式生成。(ks.cfg文件在安裝完成后會(huì)在root家目錄下生成anaconda.cfg詳細(xì)配置)

  下面是圖形生成的步驟:

  1,安裝system-config-kickstart

  yum install system-config-kickstart

  2,啟動(dòng)system-config-kickstart

  system-config-kickstart &

  3,配置kickstart

  Basic Configuration:

  Encrypt root password表示加密root的密碼串

  Target Architecture:表示平臺(tái)

  Reboot system after installation安裝后的動(dòng)作是重啟,需要勾上。

  Perform installation in text text mode (grphical is default)

  安裝界面默認(rèn)使用圖形界面,所以這個(gè)需要勾上。

  Perform installlation in interactive mode使用交互式模式,不勾。

  Install Method:安裝源

  HTTP Server:安裝源的IP

  HTTP Directory:目錄

  Boot Loader Options:引導(dǎo)選項(xiàng)

  Install new boot loader安裝新的bootloader,下面是使用舊的。

  Use GRUB password:GRUB要不要加密。

  Install boot loader on Master Boot Record(MBR)

  將bootloader裝入MBR中

  Install boot loasder on first sector of the boot partition

  將bootloader裝入某一個(gè)分區(qū)中引導(dǎo)。

  kernel parameters:crashkernel=auto rhgb quiet使用靜默模式。

  Partition Information定義分區(qū)

  Network Configuration網(wǎng)絡(luò)配置

  Authentication認(rèn)證,默認(rèn)sha512就可以

  pre

  post這里不用指定#!/bin/bash

  4,保存kickstart配置文件。

  文件默認(rèn)保存名字為ks.cfg

  5,檢查ks.cfg配置文件的錯(cuò)誤。

  # ksvalidator 2ks.cfg

  kscfg配置文件詳解:

  命令段:

  #platform=x86, AMD64, 或 Intel EM64T

  #version=DEVEL

  # Firewall configuration

  firewall --disabled禁用防火墻

  # Install OS instead of upgrade

  install默認(rèn)動(dòng)作是安裝

  # Use network installation

  url --url=“ftp://1.0.0.12/centos/”使用FTP安裝源

  repo --name=“CentOS” --baseurl=“ftp://1.0.0.12/centos”

  # Root password

  rootpw --iscrypted $1$dpCtQEn6$pC3UGFPZEJJ5nVftiaScq0

  # System authorization information

  auth --useshadow --passalgo=sha512

  # Use text mode install

  text使用文本安裝方式

  # System keyboard

  keyboard us使用美式英語鍵盤

  # System language

  lang zh_CN設(shè)置默認(rèn)語言

  # SELinux configuration

  selinux --disabled禁用SELINUX

  # Do not configure the X Window System

  skipx

  # Installation logging level

  logging --level=info

  # Reboot after installation

  reboot安裝完成時(shí)的動(dòng)作

  # System timezone

  timezone Asia/Shanghai

  # Network information

  network --bootproto=static --device=eth0 --ip=1.0.0.7 --netmask=255.0.0.0 --onboot=on

  # System bootloader configuration

  bootloader --append=“crashkernel=auto rhgb quiet” --location=mbr --driveorder=“sda”

  # Clear the Master Boot Record

  zerombr

  # Partition clearing information

  clearpart --all --initlabel清空磁盤分區(qū)

  # Disk partitioning information磁盤分區(qū)

  part /boot --asprimary --fstype=“ext4” --ondisk=sda --size=100

  part / --asprimary --fstype=“ext4” --ondisk=sda --size=20480

  part swap --asprimary --fstype=“swap” --ondisk=sda --size=500

  腳本段:

  %post

  touch /tmp/abc.txt

  %end

  軟件包段:

  %packages

  @base

  @basic-desktop

  @chinese-support

  @core

  @debugging

  @desktop-debugging

  @desktop-platform

  @desktop-platform-devel

  @development

  @directory-client

  @fonts

  使用引導(dǎo)光盤引導(dǎo)后的選擇:

  點(diǎn)擊兩次“ESC”鍵,進(jìn)入命令行模式,然后

  linux ip=1.0.0.7 netmask=255.0.0.0 ks=ftp://1.0.0.12/pub/ks.cfg

  ftp安裝源自動(dòng)安裝linux詳細(xì)步驟:

  1,制作引導(dǎo)光盤:

  # mount /dev/cdrom /media/cdrom/

  # mkdir /root/myboot

  # cp /media/cdrom/isolinux/ /root/myboot/isolinux

  # cd /root/myboot/isolinux

  # chmod +w 。/*

  # chmod +x vmlinuz

  # mkisofs -R -J -T -v -no-emul-boot -boot-load-size 4 -boot-info-table -V “MageEdu Testing Image” (-V跟光盤標(biāo)簽) -b isolinux/isolinux.bin (明確指定isolinux.bin的存放位置) -c isolinux/boot.cat (指定boot.cat的位置) -o /tmp/boot.iso (指定輸出位置) /root/myboot/ (指定輸入源)

  2,制作ftp安裝源

  # yum install vsfptd

  # service vsftpd start

  # mkdir /var/ftp/CentOS

  # mount /media/cdrom /var/ftp/CentOS,

  3,將制作好的ks.cfg文件放到ftp目錄

  # cp /root/ks.cfg /var/ftp/pub

  4,將前面的boot.iso掛載到目標(biāo)主機(jī)的光驅(qū),啟動(dòng)后兩次“ESC”鍵,然后就輸入:

  linux ip=1.0.0.7 netmask=255.0.0.0 ks=ftp://1.0.0.12/pub/ks.cfg

  5,自動(dòng)安裝啟動(dòng)

  上面就是Linux全自動(dòng)安裝的方法介紹了,本文通過編譯腳本實(shí)現(xiàn)Linux系統(tǒng)全自動(dòng)化安裝,需要安裝anaconda,編譯完anaconda后啟動(dòng)即可。

標(biāo)簽

發(fā)表評(píng)論

0

沒有更多評(píng)論了

評(píng)論就這些咯,讓大家也知道你的獨(dú)特見解

立即評(píng)論

以上留言僅代表用戶個(gè)人觀點(diǎn),不代表系統(tǒng)之家立場(chǎng)

其他版本軟件

熱門教程

人氣教程排行

Linux系統(tǒng)推薦

掃碼關(guān)注
掃碼關(guān)注

掃碼關(guān)注 官方交流群 軟件收錄