程序安装

安装

yum安装

  • 检测系统是否已配置(虚拟机右下角··类似光盘的组件,点开设置,设备状态为已连接,并且时启动时连接)
    /dev/sr0 /media iso9660 defaults 0 0
`查看设备文件`
[root@localhost tmp]# ls /dev/sr0
/dev/sr0
`修改配置文件,设置文件为启动时自动挂载`
[root@localhost tmp]# vi /etc/fstab
- /dev/sr0        /media  iso9660 defaults        0       0
- 设备			  挂载点	  设备类型  默认参数		 备份     自检
[root@localhost tmp]# cd /etc/yum.
yum.conf     yum.repos.d/ 
[root@localhost tmp]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# mkdir bak
`将默认文件移至新建文件下`
[root@localhost yum.repos.d]#mv Cen* bak/
[root@localhost yum.repos.d]# vi centos7.repo
`添加内容`
[centos7]
name=centos7
baseurl=file:///media/
gpgcheck=0
enabled=1
[root@localhost yum.repos.d]# ls 
bak  centos7.repo
`清空历史缓存`
[root@localhost yum.repos.d]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: centos7
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors
`新建缓存`
[root@localhost yum.repos.d]# yum makecache
Loaded plugins: fastestmirror
Determining fastest mirrors
file:///media/repodata/repomd.xml: [Errno 14] curl#37 - "Couldn't open file /media/repodata/repomd.xml"
Trying other mirror.


 One of the configured repositories failed (centos7),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=centos7 ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable centos7
        or
            subscription-manager repos --disable=centos7

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=centos7.skip_if_unavailable=true

failure: repodata/repomd.xml from centos7: [Errno 256] No more mirrors to try.
file:///media/repodata/repomd.xml: [Errno 14] curl#37 - "Couldn't open file /media/repodata/repomd.xml"
  • 配置好之后便可以安装程序。
  • yum list显示可安装的清单;
  • yum list updates显示已更新的包;
  • yum install安装;
  • yum updates更新包;
  • yum remove卸载;
  • yum search搜索;

源码安装

  • 安装编译工具;
[root@localhost ~]# yum install gcc gcc-c++ gcc-g77
  • 下载源码包(建议将源码包保存在/usr/local/src);
  • 进入到文件保存位置;
  • 安装;
  • ./configure
    • 指定安装路径(–prefix=/usr/local/apache);
    • 启用或者禁用某项功能( --enable-ssl, --disable-filter --with-http_ssl_module);
    • 关联某些文件(–with-pcre);
    • 检查安装环境,最终生成makefile文件。
  • make clean清理以前产生的.o文件;
  • make/按Makefile文件编译;
  • make install //按Makefile定义的文件路径安装。

RPM安装

  • 查看系统自带的rpm包;
[root@localhost Packages]# pwd
/media/Packages
[root@localhost Packages]# ls
yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
yum-plugin-aliases-1.1.31-45.el7.noarch.rpm
yum-plugin-changelog-1.1.31-45.el7.noarch.rpm
yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm
yum-utils-1.1.31-45.el7.noarch.rpm
zenity-3.22.0-1.el7.x86_64.rpm
zip-3.0-11.el7.x86_64.rpm
zlib-1.2.7-17.el7.x86_64.rpm
zlib-devel-1.2.7-17.el7.x86_64.rpm
zsh-5.0.2-28.el7.x86_64.rpm
zziplib-0.13.62-5.el7.x86_64.rpm
  • 以zziplib-0.13.62-5.el7.x86_64.rpm为例
  • zziplib 软件包名
  • 0.13.62 主版本、次版本、修正号
  • 5 发布版本号
  • el7表示在7/centos平台下运行
  • x86表示cpu构架平台
  • 64 支持系统位数
  • rpm 后缀名。

rpm -i安装;

rpm -v 显示安装详细信息;

rpm -hmarks输出进度条,每个#表示%2的进度;

rpm -U 升级或者安装;

rpm -F升级;

rpm -e 卸载;

rpm -nodeps 不检测依赖;

rpm -test 测试卸载;

rpm -q 查询包是否安装;

rpm -f 查询系统文件属于那个软件包;

rpm -qf 查询某个命令或者软件需要安装的包名;

rpm -a查询所有安装的包;

rpm -p 查询未安装包信息;

rpm -l 列表显示;

rpm -R 查找依赖性。

总结

  • rpm安装相对其他安装比较简单,是最起码的安装命令,在yum安装和源码安装的时候就需要细心安装,配置文件也不能出问题。否则将会安装不成功。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值