软件包的安装(源码包和yum企业用的多)
(1)rpm
(2)二进制
(3)源码包(4)yum(可以解决包的依赖关系)
实验-RPM
mkdir /mnt/cdrom
mount /dev/cdrom /mnt/cdrom
rmp -ivh /mnt/cdrom/Packages/* #安装(全路径)
rpm -ivh /mnt/cdrom/Packages/* --force
rpm -qa | grep zsh #查看是否安装
rpm -e zsh #卸载(不用全路径)
rpm -qpi /mnt/cdrom/Packages/httpd #查看包的详细信息
which rm
rpm -qf /usr/bin/rm #查看rm 从哪个包安装的
实验-恢复误删命令
which rm
rpm -qf /usr/bin/rm
rm -f /usr/bin/rm
rpm -ivh /mnt/cdrm/Packages/coreutils~~ --force
实验-二进制(最简单)
以.bin结尾的程序(Java包)
直接执行就是安装
实验-源码包(50%使用 使用脚本执行安装)
安装过程
1.tar zvxf xxx.tar.gz(解压)
2../configure(配置) -----./configure--help
3.make(编译)
4.make install (安装)
5.make uninstall(卸载)
实验-yum(50%使用,红帽6/5的手写yum源,红帽7使用命令搭建yum源)
rm -f /etc/yum.repos.d/* #删除这个下面的所有文件
mount /dev/cdrom /mnt/cdrom #挂载光盘
yum-config-manager --add-repo=file:///mnt/cdrom #file:// 本地文件 ftp:// ftp文件 http:// 网络文件
echo gpgcheck=0 >> /etc/yum.repos.d/mnt_cdrom.repo #不检测
yum list
yum list | grep httpd
yum groups list
yum groupinstall Mariadb
yum install httpd #安装
yum search htt #搜索软件包
yum remove httpd -y #卸载
实验-搭建远程yum源
在rhel7-1上
systemctl stop firewalld.service #关闭防火墙
systemctl stop iptables
systemctl stop ip6tables
systemctl stop ebtables
setenforce 0 #关闭SELinux
ifconfig eno16777736 192.168.100.1/24 #配置临时IP
yum install vsftp -y #安装ftp
systemctl restart vsftp #启动ftp
cp /mnt/cdrom/Package/* /var/ftp #拷贝到/var/ftp
createrepo /var/ftp/ #做软件包的依赖性关系数据库(红帽7默认安装着这个命令,红帽6需要安装)
ll /var/ftp/
ll /var/ftp/repodata #完成之后会多出来这个文件
在rhel7-2上
systemctl stop firewalld.service
systemctl stop iptables
systemctl stop ip6tables
systemctl stop ebtables
setenforce 0
ifconfig eno16777736 192.168.100.2/24
rm -f /etc/yum.repo.d/*
yum-config-manager --add-repo=ftp://192.168.100.1 #yum源为frp://192.168.100.1
echo gpgcheck=0 >> /etc/yum.repo.d/192.168.100.1.repo
yum install httpd #可以安装说明配置成功