无人值守安装linux文本新机
- 格式:doc
- 大小:1.19 MB
- 文档页数:21
注:绿色:代表输入的命令黄色:代表注释红色:代表修改的内容浅蓝色:代表修改的文件或文件的行本安装实现文本操作界面,网络挂载yum,远程主机登陆无需密码,窗口大小是800X600IP段根据个人情况来定在新机器上配置yum[root@lcy77 ~]# vim /etc/yum.repos.d/local.repo编辑的yum文件内容[base]name=basebaseurl=file:///mnt/cdrom/Serverenabled=1gpgcheck=0[VT]name=VTbaseurl=file:///mnt/cdrom/VTenabled=1gpgcheck=0[Cluster]name=Clusterbaseurl=file:///mnt/cdrom/Clusterenabled=1gpgcheck=0[ClusterStorage]name=ClusterStoragebaseurl=file:///mnt/cdrom/ClusterStorageenabled=1gpgcheck=0创建光盘挂载目录[root@lcy77 ~]# mkdir /mnt/cdrom挂载光盘[root@lcy77 ~]# mount /dev/cdrom /mnt/cdrom装http包dhcp包dns包和kickstart包[root@lcy77~]# yum install -y dhcp httpd system-config-kickstart bind bind-chroot caching-nameserver拷贝dhcp样本文件到/etc/dhcpd.conf[root@lcy77 ~]# cp /usr/share/doc/dhcp-3.0.5/ dhcpd.conf.sample /etc/dhcpd.conf编辑dhcp配置文件[root@lcy77 ~]# vim /etc/dhcpd.conf1 ddns-update-style interim;2 ignore client-updates;34 subnet 192.168.7.0 netmask 255.255.255.0 {56 # --- default gateway7 option routers 192.168.7.77;8 option subnet-mask 255.255.255.0;910 option nis-domain "";11 option domain-name "";12 option domain-name-servers 192.168.7.77;1314 option time-offset -18000; # Eastern Standard Time15 # option ntp-servers 192.168.1.1;16 # option netbios-name-servers 192.168.1.1;17 # --- Selects point-to-point node (default is hybrid). Don't change this unless18 # -- you understand Netbios very well19 # option netbios-node-type 2;2021 range dynamic-bootp 192.168.7.100 192.168.7.200;22 default-lease-time 21600;23 max-lease-time 43200;2425 next-server 192.168.7.77; 注意分号“;”26 filename "pxelinux.0";27 }编辑dns配置文件[root@lcy77 ~]# cd /var/named/chroot/etc/[root@lcy77 etc]# lslocaltime named.caching-nameserver.conf named.rfc1912.zones rndc.key拷贝样本文件并改名为name.conf注意文件的属性要保证与原来一样[root@lcy77 etc]# cp -p named.caching-nameserver.conf named.conf [root@lcy77 etc]# lslocaltime named.caching-nameserver.conf named.conf named.rfc1912.zones rndc.key编辑改名的dns配置文件[root@lcy77 etc]# vim named.conf把第15,16,27,28行用//注释掉,并修改37,38行把localhost改成any14 options {15 // listen-on port 53 { 127.0.0.1; };16 // listen-on-v6 port 53 { ::1; };17 directory "/var/named";18 dump-file "/var/named/data/cache_dump.db";19 statistics-file "/var/named/data/named_stats.txt";20 memstatistics-file "/var/named/data/named_mem_stats.txt";2122 // Those options should be used carefully because they disable port23 // randomization24 // query-source port 53;25 // query-source-v6 port 53;2627 // allow-query { localhost; };28 // allow-query-cache { localhost; };29 };30 logging {31 channel default_debug {32 file "data/named.run";33 severity dynamic;34 };35 };36 view localhost_resolver {37 match-clients { any; };38 match-destinations { any; };39 recursion yes;40 include "/etc/named.rfc1912.zones";41 };编辑该目录下得关联文件name.rfc1912.zones[root@lcy77 etc]# vim named.rfc1912.zones复制21行到31行,在空白处粘贴并修改21 zone "localhost" IN {22 type master;23 file "localhost.zone";24 allow-update { none; };25 };2627 zone "0.0.127.in-addr.arpa" IN {28 type master;29 file "named.local";30 allow-update { none; };31 };3233 zone "" IN { 填写的时准备解析的域34 type master;35 file ".zone"; 填写的是相关联的文件名,后面会创建36 allow-update { none; };37 };3839 zone "7.168.192.in-addr.arpa" IN { 填写的是反向解析的IP段40 type master;41 file "192.168.7.local";填写的是相关的文件名,后面也会创建42 allow-update { none; };43 };修改dns区配置文件[root@lcy77 etc]# cd /var/named/chroot/var/named/查看目录内有哪些文件[root@lcy77 named]# lsdata localdomain.zone localhost.zone named.broadcast named.ca named.ip6.local named.local named.zero slaves拷贝样本文件并改名,注意文件的属性要保证与原来一样[root@lcy77 named]# cp -p localhost.zone .zone[root@lcy77 named]# cp -p named.local 192.168.7.local这两个文件名要与上一个配置文件中修改的名字一致[root@lcy77 named]# ls192.168.10.local localdomain.zone named.broadcast named.ip6.local named.zero .zonedata localhost.zone named.ca named.local slaves编辑修改过的区配置文件[root@lcy77 named]# vim .zone正向解析的区配置文件$TTL 86400@ IN SOA . . (42 ; serial (d. adams)3H ; refresh15M ; retry1W ; expiry1D ) ; minimumIN NS .dns IN A 192.168.7.77$GENERATE 100-200 lcy$ IN A 192.168.7.$这个为泛解析的写法[root@lcy77 named]# vim 192.168.7.local反向解析的区配置文件$TTL 86400@ IN SOA . . (1997022700 ; Serial28800 ; Refresh14400 ; Retry3600000 ; Expire86400 ) ; MinimumIN NS .77 IN PTR . $GENERATE 100-200 $ IN PTR lcy$.编辑tftp配置文件[root@lcy77 named]# vim /etc/xinetd.d/tftp1 # default: off2 # description: The tftp server serves files using the trivial file transfer \3 # protocol. The tftp protocol is often used to boot diskless \4 # workstations, download configuration files to network-aware printers, \5 # and to start the installation process for some operating systems.6 service tftp7 {8 socket_type = dgram9 protocol = udp10 wait = yes11 user = root12 server = /usr/sbin/in.tftpd13 server_args = -s /tftpboot/linux-install指定tftp传输的目录14 disable = no 允许访问tftp15 per_source = 1116 cps = 100 217 flags = IPv418 }~到挂载目录去拷贝内核和驱动到上一步指定的目录内[root@lcy77 named]# cd /mnt/cdrom/isolinux/查看目录找出需要拷贝的文件[root@lcy77 isolinux]# lsboot.cat general.msg isolinux.bin memtest param.msg splash.lss vmlinuzboot.msg initrd.img isolinux.cfg options.msg rescue.msg TRANS.TBL[root@lcy77 isolinux]# cp initrd.img vmlinuz /tftpboot/linux-install/ 拷贝系统启动的配置文件并改名为default[root@lcy77 isolinux]# cp isolinux.cfg /tftpboot/linux-install/pxelinux.cfg/default编辑修改的系统启动的配置文件[root@lcy77 isolinux]# vim /tftpboot/linux-install/pxelinux.cfg/defaultdefault ks 指定启动要读取的标签prompt 1timeout 10 等待的时间display boot.msg 或 msgs/snake.msg 界面图形F1 boot.msgF2 options.msgF3 general.msgF4 param.msgF5 rescue.msglabel kskernel vmlinuzappend ks=http://192.168.7.77/ks.cfg initrd=initrd.img指定ks标签的路径:wq! 保存并强制退出因为文件是只读文件创建网络光盘挂载目录并挂载[root@lcy77 html]# mkdir /var/www/html/iso[root@lcy77 html]# mount /dev/hdc /var/www/html/iso/生成公钥[root@lcy77 html]# ssh-keygenGenerating public/private rsa key pair.Enter file in which to save the key (/root/.ssh/id_rsa): 回车Created directory '/root/.ssh'.Enter passphrase (empty for no passphrase): 回车Enter same passphrase again: 回车Your identification has been saved in /root/.ssh/id_rsa.Your public key has been saved in /root/.ssh/id_rsa.pub.The key fingerprint is:回车d5:7e:db:9c:2c:9d:36:0f:68:b5:ab:d5:1a:0d:aa:3f root@ 把公钥拷贝到页面发布目录内并改名为authorized_keys[root@lcy77 html]# cp /root/.ssh/id_rsa.pub /var/www/html/authorized_keys拷贝多重系统启动配置文件grub.conf到页面发布目录内[root@lcy77 html]# cp /boot/grub/grub.conf /var/www/html/改变该文件的权限[root@lcy77 html]# chmod 777 grub.conf[root@lcy77 html]# lsauthorized_keys grub.conf iso local.repo编辑该配置文件[root@lcy77 html]# vim grub.conf1 # grub.conf generated by anaconda2 #3 # Note that you do not have to rerun grub after making changes tothis file4 # NOTICE: You have a /boot partition. This means that5 # all kernel and initrd paths are relative to /boot/, eg.6 # root (hd0,0)7 # kernel /vmlinuz-version ro root=/dev/sda28 # initrd /initrd-version.img9 #boot=/dev/sda10 default=011 timeout=512 splashimage=(hd0,0)/grub/splash.xpm.gz13 hiddenmenu14 title Red Hat Enterprise Linux Server (2.6.18-194.el5)15 root (hd0,0)16 kernel /vmlinuz-2.6.18-194.el5 ro root=LABEL=/ vga=788规定屏幕的分辨率和开机的时候显示企鹅17 initrd /initrd-2.6.18-194.el5.img 拷贝yum到http的页面发布目录[root@lcy77 isolinux]# cd /var/www/html/[root@lcy77 html]# cp /etc/yum.repos.d/local.repo /var/www/html/修改成网络挂载[root@lcy77 html]# vim local.repo[base]name=basebaseurl=http://192.168.7.77/iso/Serverenabled=1gpgcheck=0[VT]name=VTbaseurl=http://192.168.7.77/iso/VTenabled=1gpgcheck=0[Cluster]name=Clusterbaseurl=http://192.168.7.77/iso/Clusterenabled=1gpgcheck=0[ClusterStorage]name=ClusterStoragebaseurl=http://192.168.7.77/iso/ClusterStorage enabled=1gpgcheck=0启动交互式配置系统启动命令,生成ks.cfg[root@lcy77 html]# system-config-kickstart 注:绿色方框内是所选内容和修改的内容[root@lcy77 html]# lsauthorized_keys grub.conf iso ks.cfg local.repo 编辑刚生成的ks.cfg[root@lcy77 html]# vim ks.cfg在文件中间加一行key - -skip是跳过序列号第44行%post下面写的是在新机器里准备下载的内容第52行%packages下面写的是装系统需要安装的包重启各项服务[root@lcy77 html]# /etc/init.d/named restart重启dns服务Stopping named: . [ OK ] Starting named: [ OK ]反向解析dns看是否好用[root@lcy77 html]# dig -x 192.168.7.110; <<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5_4.2 <<>> -x 192.168.7.110 ;; global options: printcmd;; Got answer:;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 3242;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1;; QUESTION SECTION:;110.7.168.192.in-addr.arpa. IN PTR;; ANSWER SECTION:110.7.168.192.in-addr.arpa. 86400 IN PTR .;; AUTHORITY SECTION:7.168.192.in-addr.arpa. 86400 IN NS .;; ADDITIONAL SECTION:. 86400 IN A 192.168.7.77;; Query time: 51 msec;; SERVER: 127.0.0.1#53(127.0.0.1);; WHEN: Mon Jul 30 16:02:06 2012;; MSG SIZE rcvd: 108正向解析dns是否好用[root@lcy77 html]# nslookup Server: 127.0.0.1Address: 127.0.0.1#53Name: Address: 192.168.7.150启动网络服务[root@lcy77 html]# /etc/init.d/network restartShutting down interface eth0: [ OK ] Shutting down loopback interface: [ OK ] Bringing up loopback interface: [ OK ] Bringing up interface eth0: [ OK ] 先关闭eth0 再关闭本地回环启动xinetd服务里的tftp服务[root@lcy77 html]# /etc/init.d/xinetd restartStopping xinetd: [ OK ] Starting xinetd: [ OK ]启动web服务[root@lcy77 html]# /etc/init.d/httpd restartStopping httpd: [FAILED] Starting httpd: [ OK ]启动dhcp服务[root@lcy77 html]# /etc/init.d/dhcpd restartStarting dhcpd: [ OK ] 配置全部结束创建新机进行安装。