温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

RHEL6基础二十四之RHEL软件包管理③源码安装

发布时间:2020-05-18 22:31:26 来源:网络 阅读:794 作者:justin_peng 栏目:移动开发

、概述

  • Linux系统中的软件大都是开源软件,这些软件总是以源码的形式最先发布,之后才会逐渐出现rpm、deb等封装包。下载应用程序的最新源码并编译安装,可以在程序功能、安全补丁等方面得到及时更新

  • 对于RPM格式封装的应用程序,当作者在编译源代码程序的时候,有可能绑定了许多功能,安装时被绑定的其它功能也一并安装到Linux主机上,这样就可能造成一些安全隐患。因为RPM软件包的更新并没有源代码。通过对程序源代码进行重新配置并编译安装后,可以定制更灵活、更丰富的功能

  • 当需要对现有的程序源代码进行适当修改,以便增加新的功能时,也必须释放出该软件的源代码,进行修改后再重新编译安装

二、编译安装

编译安装的基本步骤

  • 解包---tar

    解包,释放出源代码文件

  • 配置---./configure

    该过程的主要作用是生成makefile文件。配置工作通常由源代码目录中的“configure”脚本文件来完成,配置结果将保存到源码目录中的makefile文件中。如果在配置过程中出现错误,通常是缺少相关的依赖软件包所致,一般只需根据提示安装对应的软件即可“./configure”表示执行当前目录下的configure脚本文件,不同的应用程序其配置参数会存在区别具体配置参数可以在源代码目录中执行“./configure --help”进行查看,但是有一个“--prefix”参数却是大多数开源软件所通用的,该配置参数用于指定软件包安装的目标文件夹。

    [root@justin nagios-4.0.1]# ./configure -h
    `configure' configures this package to adapt to many kinds of systems.
    Usage: ./configure [OPTION]... [VAR=VALUE]...
    ...
    Installation directories:
      --prefix=PREFIX         install architecture-independent files in PREFIX
                              [/usr/local/nagios]
      --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                              [PREFIX]
    ...
    Fine tuning of the installation directories:
      --bindir=DIR            user executables [EPREFIX/bin]
      --sbindir=DIR           system admin executables [EPREFIX/sbin]
    ...
    Optional Packages:
      --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
      --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
      --with-nagios-user=<user>
                              sets user name to run nagios
      --with-nagios-group=<grp>
                              sets group name to run nagios
      --with-command-user=<user>
                              sets user name for command access
      --with-command-group=<grp>
                              sets group name for command access
    ...
    Report bugs to the package provider.
    [root@justin nagios-4.0.1]#


RHEL6基础二十四之RHEL软件包管理③源码安装

  • 编译---make

将源代码文件转变为二进制可执行程序,编译的过程主要是根据makefile文件中的配置信息,将源代码编译、连接成可执行程序

  • 检测---make test / make check

顾名思义,这一步就是对上一步 make 的检查了,要确保 make 是没有错误的,也就是这一步的 test、check要全部是 OK 的,error 为0;这步可省略

  • 安装---make install

    编译完成以后,就可以执行“make install”命令将软件的执行程序、配置文件等相关文件复制到Linux系统中了,即应用程序的最后“安装”过程

三、源码编译安装程序的卸载

很多source的Makefile都有写uninstall规则,如果原先的source还在,可直接在Souce里make uninstall&&make clean,然后重新configure......如果没有uninstall规则一句一句看Makefile里install部分他都干了些什么,然后挨个删除


编译安装ntfs-3g

[root@justin src]# wget http://tuxera.com/opensource/ntfs-3g_ntfsprogs-2013.1.13.tgz
[root@justin src]# tar zxvf ntfs-3g_ntfsprogs-2013.1.13.tgz -C /usr/local/
[root@justin src]# cd /usr/local/ntfs-3g_ntfsprogs-2013.1.13
[root@justin ntfs-3g_ntfsprogs-2013.1.13]# yum -y install gcc
[root@justin ntfs-3g_ntfsprogs-2013.1.13]# ./configure --prefix=/usr/local/ntfs
[root@justin ntfs-3g_ntfsprogs-2013.1.13]# make && make install
[root@justin ntfs-3g_ntfsprogs-2013.1.13]# ntfs-3g
ntfs-3g: No device is specified.
ntfs-3g 2013.1.13 integrated FUSE 27 - Third Generation NTFS Driver
        Configuration type 1, XATTRS are on, POSIX ACLS are off
Copyright (C) 2005-2007 Yura Pakhuchiy
Copyright (C) 2006-2009 Szabolcs Szakacsits
Copyright (C) 2007-2012 Jean-Pierre Andre
Copyright (C) 2009 Erik Larsson
Usage:    ntfs-3g [-o option[,...]] <device|p_w_picpath_file> <mount_point>
Options:  ro (read-only mount), windows_names, uid=, gid=,
          umask=, fmask=, dmask=, streams_interface=.
          Please see the details in the manual (type: man ntfs-3g).
Example: ntfs-3g /dev/sda1 /mnt/windows
News, support and information:  http://tuxera.com
[root@justin ntfs-3g_ntfsprogs-2013.1.13]#



向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI