linux中的软件管理
一、yum源的安装
1.使用网络已经安装资源的安转软件
hahahahaha 下载的软件仓库名称
http 软件网址
gpgcheck1 社区版(供使用)官方授权
vim /etc/yum.repos.d/yum.repo ##文件名称必须以repo结尾
[rhel7.2]
name=rhel7.2 source ##对软件源的描述
baseurl=http://172.25.254.250/rhel7.2/x86_64/dd ##网络安装源
gpgcheck=0 ##不检测gpgkey
enabled=1 ##此安装源语句块生效
yum clean all ##清空系统中原有的yum信息
2.配置本地yum源
1)获得一个与本机系统版本一致的系统镜像
2)挂载镜像
mount /xxx/xxxxxx.iso /rhel7.2
3)设定永久挂载
vim /etc/rc.d/rc.local
mount /xxx/xxxxxx.iso /rhel7.2
chmod 755 /etc/rc.d/rc.local ##在系统开机时会自动执行此脚本
4)设定系统安装源指向
mkdir /etc/yum.repos.d/backup
mv /etc/yum.repos.d/* /etc/yum.repos.d/backup
vim /etc/yum.repos.d/yum.repo
[rhel7.2]
name=rhel7.2
baseurl=file:///rhel7.2
gpgcheck=0
yum clean all
yum install httpd -y
file://访问本地的文件
3.共享型yum源的部署
1)在一台已经连接好本地yum源的主机中安装httpd
yum install httpd
2)配置网络yum源
systemctl start httpd
systemctl stop firewalld
systemctl enable httpd
systemctl disable firewalld
mkdir /var/www/html/rhel7.2
mount /xxx/xxxxxx.iso /var/www/html/rhel7.2
测试:
在浏览器中输入地址:
http://ip/rhel7.2
http://172.25.254.33/rhel7.2 <<<此地址就是网络yum源地址
二、yum命令
1)yum命令的使用必须是在yum源搭建成功后才能正常运行
2)yum命令的详细用法
yum clean all ##清除原有yum缓存
repolist ##列出仓库信息
yum install softwar ##安装软件
yum update ##更新软件
yum list software ##查看软件
yum list all ##查看所有软件
yum list installed ##列出已安装软件
yum list available ##列出可安装软件
yum reinstall software ##重新安装软件
yum remove software ##卸载软件
yum info software ##查看软件信息
yum search software ##根据软件信息查找软件
yum whatprovides file ##根据文件找出包含此文件的软件
yum groups list ##列出软件组
yum groups info ##查看软件组的信息
groups install sfgroup ##安装软件组
group remove sfgroup ##卸载软件组
三、用rpm命令处理软件
rpm -ivh software.rpm ##安装软件(无法解决软件的依赖性)