美文网首页
自动化安装linux(2)

自动化安装linux(2)

作者: 姜饼人_9e7b | 来源:发表于2017-07-23 17:08 被阅读0次

    接下来,我们就尝试一下,如何用光盘引导启动,并选择ftp方式安装。

    一、搭建ftp服务器

    ftp服务器搭建,可以参考我这篇日记:http://www.jianshu.com/p/38a5e0c0bb69
    搭建好后,把光盘内容放到ftp服务器上面去。

    ftp服务器

    二、kickstart文件

    1、制作kickstart文件

    这里我们可以使用一个图形化工具system-config-kickstart,去定制kickstart文件。

    图1 system-config-kickstart

    图1,图形界面打开system-config-kickstart

    图2

    图2,设置基本配置

    图3 安装选项

    图3,选择FTP安装。我的ftp服务器事刚才已搭建好,并且把光盘内容也放到服务器上了。如下图4:

    图4 ftp服务器 图5 分区

    图5,按照自己的需求,划分分区。

    不要图形环境

    图6,我不安装图形环境

    图6 安装包选项

    图6,这里可以选择自己需要的安装包

    图7 安装后脚本

    图7 可以附上安装后脚本
    最后点击左上角file选项,保存生成ks.cf文件。

    2、确认ks.cfg文件

    生成ks.cfg文件后,可以自己确认一下,如果有补充,手动修改一下。

    [root@CentOS6 ~]#cat ks.cfg 
    #platform=x86, AMD64, or Intel EM64T
    #version=DEVEL
    # Firewall configuration
    firewall --disabled
    # Install OS instead of upgrade
    install
    # Use network installation
    url --url="ftp://192.168.0.113/pub/6/"
    # Root password
    rootpw --iscrypted $1$ep2DTWx3$RjNBQu4GDDuOOBGNxPTzy/
    # System authorization information
    auth  --useshadow  --passalgo=sha512
    # Use graphical install
    #graphical 
    #注释掉graphical,在下面写上text,选择命令行安装
    text
    # System keyboard
    keyboard us
    # System language
    lang en_US
    # SELinux configuration
    selinux --disabled
    # Do not configure the X Window System
    skipx
    # Installation logging level
    logging --level=info
    
    # System timezone
    timezone  Africa/Abidjan
    # Network information
    network  --bootproto=dhcp --device=eth0 --onboot=on
    # System bootloader configuration
    bootloader --location=mbr
    # Clear the Master Boot Record
    zerombr
    # Partition clearing information
    clearpart --all  
    # Disk partitioning information
    part / --fstype="ext4" --size=50240
    part /boot --fstype="ext4" --size=1024
    part /home --fstype="ext4" --size=50000
    
    %post
    useradd luo
    echo 123456|passwd --stdin luo
    reboot
    %end
    
    %packages
    @core
    @server-policy
    @workstation-policy
    %end
    

    以下命令可以检查ks.cfg文件格式是否正确

    [root@CentOS6 ~]#ksvalidator ks.cfg 
    #如果错误会有提示
    
    

    拷贝ks.cfg到ftp服务器上

    [root@CentOS6 ~]#cp ks.cfg /var/ftp/pub/centOS6.cfg
    [root@CentOS6 ~]#
    

    以上就是CentOS6的ks.cfg文件的制作过程。

    3、CentOS7补充

    CentOS7的ks.cfg有个小bug:

    centos 7 bug

    Package Selection安装包选择不显示。这是因为机器的yum配置有问题。
    按以下配置:

    [root@luo7 ~]#cd /etc/yum.repos.d/
    [root@luo7 yum.repos.d]#ls
    backup  base.repo
    [root@luo7 yum.repos.d]#vim base.repo 
    [development]
    name=Base7
    baseurl=file:///misc/cd
    gpgkey=file:///misc/cd/RPM-GPG-KEY-CentOS-7
    
    Paste_Image.png

    三、自动安装系统

    接下来就是用ks.cfg文件去安装操作系统了。

    图1 光盘启动

    图1,光盘引导启动,在这个界面上按ESC

    ESC

    图2,输入linux ks=ftp://192.168.0.113/pub/centOS6.cfg按回车。

    系统自动按照centOS6.cfg文件安装

    图3、接下来系统就会自动按照centOS6.cfg的内容安装。

    自动安装过程 安装完成

    相关文章

      网友评论

          本文标题:自动化安装linux(2)

          本文链接:https://www.haomeiwen.com/subject/uutmkxtx.html