Linux学习笔记(4)--软件安装

来源:互联网 发布:linux vim c语言 编辑:程序博客网 时间:2024/05/05 12:30

Linux学习笔记(4)--软件安装

#################################################
# shell脚本创建虚拟机
##################################################
#使用本地镜像:
#vim virt_create.sh:
 #!/bin/bash #编译器
 virt-install \
 --cdrom /home/kiosk/rhel-server-7.3-x86_64-dvd.iso \#镜像路径
 --ram 1024 \ #内存大小
 --vcpus 1 \ #cpu数量
 --file /var/lib/libvirt/images/$*.qcow2 \ #创建路径
 --file-size 8 \ #虚拟机大小
 --name $* & #虚拟机名字参数
*********************************************************************
#使用软件生成配置文件:
#yum install system-config-kickstart #安装写配置文件的软件
**********************************************
#vim ks.cfg: #生成的自动安装的配置文件
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part /boot --fstype="xfs" --size=200
part swap --fstype="swap" --size=500
part / --fstype="xfs" --grow --size=1


%packages #安装文件的包
@base #包集
vnc #要安装的软件
%end #结束语句
***********************************************************
#ksvalidator ks.cfg #检查语法错误


#chmod +x virt_create.sh #添加执行权
#./virt_create.sh test03 #执行,创建名字为:test03的虚拟机
***********************************************************
#yum install httpd -y #安装httpd
#systemctl stop firewalld #关闭防火墙
#systemctl start httpd #开启httpd
#cp ks.cfg /var/www/html/ #将ks文件复制到共享目录
# 就可以通过浏览器访问
*********************************************************************
#使用网络镜像的配置文件:
#vim virt_create.sh:
# #!/bin/bash
# virt-install \
# --location http://172.25.254.250/rhel7.3/x86_64/dvd \
# --ram 1024 \
# --vcpus 1 \
# --file /var/lib/libvirt/images/$*.qcow2 \
# --file-size 8 \
# --name $* \
# --extra-args "ks=http://172.25.254.5/ks.cfg" &
#####################################################################
# 软件安装
#####################################################################
#rpm -q   firefox#查看软件是否安装
# -qa #查看系统中所有安装的软件
# -e #卸载
# -ivh #安装
# -qi #查询信息
# -ql #查询安装路径
# -qf #查询文件属于安装包的名称
# -ivh firefox-45.4.0-1.el7_2.x86_64.rpm --force#强制安装
##########################################################
# yum命令
##########################################################
#可以解决软件的依赖关系
 yum install firefox
 yum remove firefox
 yum list installed
 yum list available
 yum info firefox
 yum whatprovides /usr/bin/firefox
 yum search gcc
##########################################################

原创粉丝点击