通过http服务,来对系统的install进行ks的引导
本章内容是针对稍微有一点点linux操作常识的人员来编写,可能写的比较粗糙,如果有什么地方不懂的,大家可以留言或者直接联系鬼见愁,大不了咱可以远程教学演示,当然我有时间的情况下
第一,利用上一章节的vmare和iso文件,通过百度自己安装部署一个系统,并配置好网络,确保能进入操作系统。
操作系统 |
网络模式 |
特别说明 |
centos7.5 |
nat |
第一:网络选择nat,是为了方便宿主机和虚拟机之间的文件上传,包括可以上网;第二:这个虚拟机就是暂时用http来进行ks.cfg文件传输的,只用一下,和咱的kvm虚拟机没有多大的关系 |
[root@localhost ~]# yum -y install httpd #安装httpd服务
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-97.el7.centos will be installed
--> Processing Dependency: httpd-tools = 2.4.6-97.el7.centos for package: httpd-2.4.6-97.el7.centos.x86_64
--> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-97.el7.centos.x86_64
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-97.el7.centos.x86_64
--> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-97.el7.centos.x86_64
--> Running transaction check
---> Package apr.x86_64 0:1.4.8-7.el7 will be installed
---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed
---> Package httpd-tools.x86_64 0:2.4.6-97.el7.centos will be installed
---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=================================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================================
Installing:
httpd x86_64 2.4.6-97.el7.centos updates 2.7 M
Installing for dependencies:
apr x86_64 1.4.8-7.el7 base 104 k
apr-util x86_64 1.5.2-6.el7 base 92 k
httpd-tools x86_64 2.4.6-97.el7.centos updates 93 k
mailcap noarch 2.1.41-2.el7 base 31 k
Transaction Summary
=================================================================================================================================================
Install 1 Package (+4 Dependent packages)
Total download size: 3.0 M
Installed size: 10 M
Downloading packages:
(1/5): apr-util-1.5.2-6.el7.x86_64.rpm | 92 kB 00:00:00
(2/5): apr-1.4.8-7.el7.x86_64.rpm | 104 kB 00:00:00
(3/5): mailcap-2.1.41-2.el7.noarch.rpm | 31 kB 00:00:00
(4/5): httpd-tools-2.4.6-97.el7.centos.x86_64.rpm | 93 kB 00:00:00
(5/5): httpd-2.4.6-97.el7.centos.x86_64.rpm | 2.7 MB 00:00:01
-------------------------------------------------------------------------------------------------------------------------------------------------
Total 2.2 MB/s | 3.0 MB 00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : apr-1.4.8-7.el7.x86_64 1/5
Installing : apr-util-1.5.2-6.el7.x86_64 2/5
Installing : httpd-tools-2.4.6-97.el7.centos.x86_64 3/5
Installing : mailcap-2.1.41-2.el7.noarch 4/5
Installing : httpd-2.4.6-97.el7.centos.x86_64 5/5
Verifying : httpd-2.4.6-97.el7.centos.x86_64 1/5
Verifying : apr-1.4.8-7.el7.x86_64 2/5
Verifying : mailcap-2.1.41-2.el7.noarch 3/5
Verifying : httpd-tools-2.4.6-97.el7.centos.x86_64 4/5
Verifying : apr-util-1.5.2-6.el7.x86_64 5/5
Installed:
httpd.x86_64 0:2.4.6-97.el7.centos
Dependency Installed:
apr.x86_64 0:1.4.8-7.el7 apr-util.x86_64 0:1.5.2-6.el7 httpd-tools.x86_64 0:2.4.6-97.el7.centos mailcap.noarch 0:2.1.41-2.el7
Complete! ###出现这个字样代表着完成
[root@localhost ~]# yum -y install lrzsz #本人用的是xshell,安装这个服务可以直接实现文件从宿主机到虚拟机的拖拽
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package lrzsz.x86_64 0:0.12.20-36.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=================================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================================
Installing:
lrzsz x86_64 0.12.20-36.el7 base 78 k
Transaction Summary
=================================================================================================================================================
Install 1 Package
Total download size: 78 k
Installed size: 181 k
Downloading packages:
lrzsz-0.12.20-36.el7.x86_64.rpm | 78 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : lrzsz-0.12.20-36.el7.x86_64 1/1
Verifying : lrzsz-0.12.20-36.el7.x86_64 1/1
Installed:
lrzsz.x86_64 0:0.12.20-36.el7
Complete! #安装完成
[root@localhost ~]# cd /var/www/html/ #到http服务的默认目录
[root@localhost html]# ls #查看当前目录为空
第二、将ks.cfg文件直接拖拽进虚拟机里面,位置为http服务首页的默认目录里面
方法一:
方法二、
第三、查看ks.cfg文件是不是正常的拖拽到了虚拟机里面并启动http服务
[root@localhost html]# ls
anaconda-ks.cfg #查看文件
[root@localhost html]# systemctl start httpd #开启http服务
[root@localhost html]# ss -antup | grep 80 #查看http服务的80端口是否存在
tcp ESTAB 0 0 192.168.100.128:22 192.168.100.1:56549 users:(("sshd",pid=1780,fd=3))
tcp LISTEN 0 128 :::80 :::* users:(("httpd",pid=30988,fd=4),("httpd",pid=30987,fd=4),("httpd",pid=30986,fd=4),("httpd",pid=30985,fd=4),("httpd",pid=30984,fd=4),("httpd",pid=30983,fd=4))
[root@localhost html]#
第四、查看自己的ip地址,并通过宿主机,登录到网页上面看是否可以正常浏览ks.cfg文件
[root@localhost html]# ifconfig #可以看到ip地址为192.168.100.128
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.100.128 netmask 255.255.255.0 broadcast 192.168.100.255
inet6 fe80::9153:44ca:e35e:1505 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:a4:87:74 txqueuelen 1000 (Ethernet)
RX packets 13933 bytes 18750051 (17.8 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 5352 bytes 431426 (421.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@localhost html]# sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/sysconfig/selinux 关闭selinux
[root@localhost html]# setenforce 0 #临时关闭selinux
[root@localhost html]# systemctl stop firewalld.service #关闭防火墙
[root@localhost html]# ls
anaconda-ks.cfg
用宿主机登录到虚拟机网页上面浏览ks.cfg文件:
http服务的ks.cfg文件已经部署好了,下一篇kvm之通过ks.nfg文件引导安装centos7.5系统