zoukankan      html  css  js  c++  java
  • kickstart一键自动安装Linux系统

    kickstart,无人值守,自动安装系统。本文介绍kickstart的用法。

    #安装系统的信息——可以参考
    [root@larrywen pdf]# vim ~/anaconda-ks.cfg

    第一步 安装kickstart

    [root@larrywen /]#yum installsystem-config-kickstart -y
    #退出,再以X Window的形式登录
    [root@serv01 opt]# exit
    logout
    Connection to 192.168.1.11 closed.
    [root@larrywen Desktop]# ssh 192.168.1.11-X
    [root@larrywen Desktop]#system-config-kickstart

    第二步 生成ks.cfg文件

    第一项,基本配置。默认语言选择English(USA),键盘选择U.S.English,时区选择Africa/Chongqing,虚拟机下不建议勾选"Use UTC clock",设定root密码,如果我们不选择加密root密码,生成的文件中密码就以明文显示,高级配置中把目标架构选择x86, AMD64, or Intel EM64T,然后把"Rebootsystem after installation"。



    第二项,安装方法。安装方法选择“Perfome new installation(新安装)",安装源选择NFS,NFS 服务器:192.168.1.11,NFS 目录:/iso      

     


    第三项,Boot Loader 选项。安装类型选择:安装新的boot loader,GRUB 忽略不写,这个是启动GRUB时使用的密码,如果没设置GRUB密码,进入单用户模式是可以的,但是设置了GRUB密码后,进入单用户模式必须输入GRUB密码。安装选项把"Install boot loader on Master Boot Record(MBR)"勾选该上,内核参数忽略。

     


    第四项,Partition Information(分区信息)。Master Boot Record:Clear Master Boot Record(清除MBR)。Partitions:Remove allexisting partitions(移除所有存在的分区)。Disk label:Do not initialize the disk lable(不初始化卷标)。布局:测试用:我这样分区:/boot(200M) swap(1024M) /(其他的空间分配给根分区)。

                    


    第五项,Network Configuration(网络配置)。我们配置一个eth0,自动获取IP。      



    第六项,Authentication(验证)。保持默认即可。



    第七项,Firewall Configuration(防火墙配置)。我们激活SELinux,启用防火墙,信任的服务把SSH勾选上。



    第八项,Display Configuration(显示配置)。在图形化环境安装后,我们第一次启动时把配置的图形化界面禁用掉。



    第九项,Package Selection(包的选择)。在语言包中把“Chinese Support(中文支持”勾选上。



    第十项,Pre-Installation Script(安装前脚本)。这是在安装前执行的脚本,此处忽略。



    第十一项,Post-Installation(安装后脚本)。这是安装后执行的脚本,此处我们添加两条命令,以做测试。



    useradd oracle;
    echo "testoracle" | passwd--stdin oracle;
    #查看配置的文件
    [root@serv01 opt]# cat ks.cfg
    #platform=x86, AMD64, or Intel EM64T
    ##version=DEVEL
    ## Firewall configuration
    #firewall --enabled --ssh
    ## Install OS instead of upgrade
    #install
    ## Use NFS installation media
    #nfs --server=192.168.1.11 --dir=/iso
    ## Root password
    #rootpw --plaintext uplooking
    ## System authorization information
    #auth --useshadow  --passalgo=sha512
    ## Use graphical install
    #graphical
    #firstboot --disable
    ## System keyboard
    #keyboard us
    ## System language
    #lang en_US
    ## SELinux configuration
    #selinux --enforcing
    ## Installation logging level
    #logging --level=info
    ## Reboot after installation
    #reboot
    ## System timezone
    #timezone Asia/Chongqing
    ## 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 /boot --fstype="ext4"--size=200
    #part swap --fstype="swap"--size=1024
    #part / --fstype="ext4" --grow--size=1
    #
    #%post
    #useradd oracle;
    #echo "uplooking" | passwd--stdin oracle;
    #%end
    #
    #%packages
    #@chinese-support
    #
    #%end
    #

    第三步 配置nfs

    [root@serv01 opt]# vim /etc/exports
    [root@serv01 opt]# cat /etc/exports
    /iso *(ro)
    /opt *(ro)
     
    #安装nfs相关的RPM包
    [root@serv01 opt]# yum install nfs* -y
     
    Installed:
     nfs-utils.x86_64 1:1.2.3-7.el6          nfs-utils-lib.x86_64 0:1.1.5-3.el6           nfs4-acl-tools.x86_64 0:0.3.3-5.el6         
    Complete!
    #启动rpcbind服务
    [root@serv01 opt]# /etc/init.d/rpcbindstart
    Starting rpcbind:                                         [  OK  ]
    #启动nfs服务
    [root@serv01 opt]# /etc/init.d/nfs start
    Starting NFS services:                                     [  OK  ]
    Starting NFS daemon:                                       [  OK  ]
    Starting NFS mountd:                                       [  OK  ]
    Starting RPC idmapd:                                       [  OK  ]
     
    #以上两步可以通过service nfsstart解决

    第四步 关闭防火墙和SELINUX

    [root@serv01 opt]# /etc/init.d/iptablesstop
    [root@serv01 opt]# setenforce 0

    第五步 新建虚拟机


    选择安装镜像作为引导,然后按ESC键,输入linux ks=nfs:192.168.1.11:/opt/ks.cfg:等待自动安装系统吧。


    5.1镜像选择

     


    5.2DHCP配置

     


     

    5.3Linux kickstart安装界面

     

    5.4测试oracle用户安装成功


    注意

    1.Vmware中所使用网卡需要选择DHCP,因为我们通过kickstart安装的系统使用的是DHCP。

    2.我们需要在配置虚拟机时需要选择ISO镜像作为引导,然后进入安装界面后按ESC,输入nfs相关的命令进行安装。

    3.保存后的配置文件不要保存到root目录下,因为是以普通用户读取的。

    4.如果出现错误,要么是拼写错误,要么是NFS服务未正确配置或者没启动,要么是防火墙没关,要么是网络不通。


    我的邮箱wgbno27@163.com  新浪微博@Wentasy27
      微信公众平台:JustOracle(微信号:justoracle)
      数据库技术交流群:336882565(加群时验证 From CSDN XXX)
      Oracle交流讨论组https://groups.google.com/d/forum/justoracle
      By Larry Wen
    


    katoon Sina CSDN
    @Wentasy 博文仅供参考,欢迎大家来访。如有错误之处,希望批评指正。原创博文如需转载请注明出处,谢谢 :) [CSDN博客]
  • 相关阅读:
    CSS3:三个矩形,一个宽200px,其余宽相等且自适应满铺
    pidera安装node.js(树莓派)
    深入JavaScript模块化编程
    c# 多显示器设置主屏幕(Set primary screen for multiple monitors)
    c# 获取移动硬盘信息、监听移动设备的弹出与插入事件
    C# 弹出USB外接硬盘(U盘)
    log4net 自定义Appender
    Scrum 思考
    监控浏览器关闭事件
    判断地图的点是否在面内 腾讯地图
  • 原文地址:https://www.cnblogs.com/pangblog/p/3243966.html
Copyright © 2011-2022 走看看