您的位置:首页 > 其它

软件安装与配置yum仓库

2017-07-30 20:02 429 查看
####软件安装####

1.软件名称识别

[abrt-addon-ccpp]-[2.1.11-19].[el7].[x86_64].rpm
       ##rpm结尾的适用与redhat操作系统

       ||                        ||         ||       ||

    软件名称   软件版本 软件适用系统 64位

2.如何安装软件

1.rpm

rpm -ivh
name.rpm ##安装 ,-v显示过程,-h指定加密方式为hash
rpm -e
name ##卸载

##此处软件安装存在问题,不能解决软件的依赖关系问题,遂不推荐使用此命令来安装卸载软件,下面会介绍更好的命令来解决此问题

##下面一些命令所显示的东西特别多,只截部分做参考

rpm -ql
name ##查询软件生成文件



rpm -qlp
name.rpm ##查询软件安装后会生成什么文件



rpm -qa
##查询系统中安装的所有软件名称



rpm -qa |grep name
##查询软件是否安装

rpm -q name
##查询软件是否安装

rpm -qp name.rpm
##查询软件安装包安装后的名字



rpm -qf filename
##查看filename属于那个安装包



rpm -ivh name.rpm --force
##强制安装,但不能忽略依赖性
rpm -ivh name.rpm --nodeps --force
##忽略依赖性并且强制安装
rpm -qi name
##查看软件信息
rpm -Kv name.rpm
##检测软件包是否被篡改

rpm -qp name.rpm --scripts
##检测软件在安装或卸载过程中执行的动作

注:此命令在安装一些网上非官方的软件非常重要,一些流氓软件会再安装后进行一些流氓操作,请谨慎



####yum命令####
yum install
softwarename ##安装





yum repolist
##列出设定yum源信息



yum remove
softwarename ##卸载





yum list
softwarename ##查看软件源中是否有次软件



yum list all
##列出所有软件名称



yum list installd
##列出已经安装的软件名称



yum list available
##列出可以用yum安装的软件名称
yum clean all
##清空yum缓存
yum search
softwareinfo ##根据软件信息搜索软件名字



yum whatprovides
filename ##在yum源中查找包含filename文件的软件包



yum update
##更新软件
yum history
##查看系统软件改变历史
yum reinstall
softwarename ##重新安装
yum info
softwarename ##查看软件信息
yum groups list
##查看软件组信息



yum groups info
softwaregroup ##查看软件组内包含的软件
yum groups install
softwaregroup ##安装组件
yum groups remove
softwaregroup ##卸载组件

#####yum仓库的搭建####

yum

上层软件管理工具,最重要的功能是可以解决软件的倚赖关系

yum能够投入使用的前提是必须要有yum源,以及配置源的指向文件

###server源端####

1.从网络上下本机系统版本匹配的iso镜像文件

rhel-server-7.1-x86_64-dvd.iso

2.把rhel-server-7.1-x86_64-dvd.iso挂在到/mnt以便访问镜像中的文件

mount rhel-server-7.1-x86_64-dvd.iso /mnt

3.配置本机yum源指向

rm -fr /etc/yum.repos.d/*

vim /etc/yum.repos.d/yum.repo

[Server]

name=rhel7.1

baseurl=file:///mnt

gpgcheck=0

4.安装资源共享服务

yum install httpd -y

systemctl stop firewalld  

systemctl disable firewalld 

systemctl start httpd 

systemctl enable httpd 

5.建立共享目录,并挂在镜像文件到共享目录上

mkdir /var/www/html/rhel7.1

umount /mnt

mount rhel-server-7.1-x86_64-dvd.iso /var/www/html/rhel7.1

6.测试

在浏览器中输入:http://本机ip/rhel7.1

可以看到镜像中的内容

7.修改本机yum源指向

[server]

name=rhel7.1

baseurl=file:///var/www/html/rhel7.1

gpgcheck=0

8.开机自动挂在iso

vim /etc/rc.d/rc.local

mount rhel-server-7.1-x86_64-dvd.iso /var/www/html/rhel7.1

:wq

chmod +x /etc/rc.d/rc.local

9.第三方软件仓库的搭建

把所有的rpm软件包放到一个目录中,这个目录中只能存在rpm文件

createrepo -v /rpm存放目录

vim /etc/yum.repos.d/xxx.repo

[Software]

name=software

baseurl=file:///rpm存放目录

gpgcheck=0

####client指向端####

vim /etc/yum.repos.d/xxxx.repo ##仓库指向文件位置

[xxxx] ##自定义软件仓库名称

name=xxxx ##自定义软件仓库描述

baseurl=ftp://|http://|file:// ##仓库位置

gpgcheck=0 ##不检测gpgkey
##gpgkey表示软件的出品logo

yum clean all ##清空yum缓存识别新配置

在此附上我的脚本仅供参考

#!/bin/bash

##要求:必须在mnt目录下有rhel-server-7.2-x86_64-dvd.iso文件

mkdir /iso

mv /mnt/rhel-server-7.2-x86_64-dvd.iso /iso

mkdir /mnt/rhel7.2

mount /iso/rhel-server-7.2-x86_64-dvd.iso /mnt/rhel7.2

rm -rf /etc/yum.repos.d/*

touch /etc/yum.repos.d/yum.repo

cat > /etc/yum.repos.d/yum.repo <<EOF

[rhel7.2]

name=rhel7.2

baseurl=file:///mnt/rhel7.2

gpgcheck=0

EOF

yum clean all

yum install httpd.x86_64 -y

systemctl stop firewalld

systemctl disable firewalld

systemctl start httpd

systemctl enable httpd

mkdir /var/www/html/rhel7.2

umount /mnt/rhel7.2

echo "mount /iso/rhel-server-7.2-x86_64-dvd.iso /var/www/html/rhel7.2" >>/etc/rc.d/rc.local

cat > /etc/yum.repos.d/yum.repo <<EOF

[rhel7.2]

name=rhel7.2

baseurl=file:///var/www/html/rhel7.2

gpgcheck=0

EOF

yum clean all

createrepo /softwear

cat >> /etc/yum.repos.d/yum.repo <<EOF

[softwear]

name=softweat from internet

baseurl=file:///softwear

gpgcheck=0

EOF

yum clean all

#!/bin/bash

##要求:必须在mnt目录下有rhel-server-7.2-x86_64-dvd.iso文件

mkdir /iso

mv /mnt/rhel-server-7.2-x86_64-dvd.iso /iso

mkdir /mnt/rhel7.2

mount /iso/rhel-server-7.2-x86_64-dvd.iso /mnt/rhel7.2

rm -rf /etc/yum.repos.d/*

touch /etc/yum.repos.d/yum.repo

cat > /etc/yum.repos.d/yum.repo <<EOF

[rhel7.2]

name=rhel7.2

baseurl=file:///mnt/rhel7.2

gpgcheck=0

EOF

yum clean all

yum install httpd.x86_64 -y

systemctl stop firewalld

systemctl disable firewalld

systemctl start httpd

systemctl enable httpd

mkdir /var/www/html/rhel7.2

umount /mnt/rhel7.2

echo "mount /iso/rhel-server-7.2-x86_64-dvd.iso /var/www/html/rhel7.2" >>/etc/rc.d/rc.local

cat > /etc/yum.repos.d/yum.repo <<EOF

[rhel7.2]

name=rhel7.2

baseurl=file:///var/www/html/rhel7.2

gpgcheck=0

EOF

yum clean all

createrepo /softwear

cat >> /etc/yum.repos.d/yum.repo <<EOF

[softwear]

name=softweat from internet

baseurl=file:///softwear

gpgcheck=0

EOF

yum clean all
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: