【linux安装软件步骤】

【linux安装软件步骤】

一、解析linux应用软件安装包:

通常Linux应用软件的安装包有三种:

  • tar包,如software-1.2.3-1.tar.gz。它是使用UNIX系统的打包工具tar打包的。
  • rpm包,如software-1.2.3-1.i386.rpm。它是Redhat Linux提供的一种包封装格式。
  • dpkg包,如software-1.2.3-1.deb。它是Debain Linux提供的一种包封装格式。

大多数Linux应用软件包的命名也有一定的规律,它遵循:

名称-版本-修正版-类型

例如:

  • software-1.2.3-1.tar.gz 意味着:
    • 软件名称:software
    • 版本号:1.2.3
    • 修正版本:1
    • 类型:tar.gz,说明是一个tar包。
  • sfotware-1.2.3-1.i386.rpm
    • 软件名称:software
    • 版本号:1.2.3
    • 修正版本:1
    • 可用平台:i386,适用于Intel 80×86平台。
    • 类型:rpm,说明是一个rpm包。

    注:由于rpm格式的通常是已编译的程序,所以需指明平台。

  • 对于software-1.2.3-1.deb就请大家自己练习一下。

二、了解包里面的内容

一个Linux应用程序的软件包中可以包含两种不同的内容:

  • 一种就是可执行文件,也就是解开包后就可以直接运行的。在Windows中所 有的软件包都是这种类型。安装完这个程序后,你就可以使用,但你看不到源程序。而且下载时要注意这个软件是否是你所使用的平台,否则将无法正常安装。
  • 另一种则是源程序,也就解开包后,你还需要使用编译器将其编译成为可执行文件。这在Windows系统中是几乎没有的,因为Windows的思想是不开放源程序的。

通常,用tar打包的,都是源程序;而用rpm、dpkg打包的则常是可执行程序。一般来说,自己动手编译源程序能够更具灵活性,但也容易遇到各种问题和困难。而相对来说,下载那些可执行程序包,反而是更容易完成软件的安装,当然那样灵活性就差多了。所以一般一个软件总会提供多种打包格式的安装程序的。你可以根据自己的情况来选择。

三、搞定使用tar包的应用原件

  • 安装

    整个安装过程可以分为以下几步:

    1. 取得应用软件:通过下载、购买光盘的方法获得;
    2. 解压缩文件:一般tar包,都会再做一次压缩,如gzip、bz2等,所以你需要先解压。如果是最常见的gz格式,则可以执行:“tar –xvzf 软件包名”,就可以一步完成解压与解包工作。如果不是,则先用解压软件,再执行“tar –xvf 解压后的tar包”进行解包;
    3. 阅读附带的INSTALL文件、README文件;
    4. 执行“./configure”命令为编译做好准备;
    5. 执行“make”命令进行软件编译;
    6. 执行“make install”完成安装;
    7. 执行“make clean”删除安装时产生的临时文件。

    好了,到此大功告成。我们就可以运行应用程序了。但这时,有的读者就会问,我怎么执行呢也是一个Linux特色的问题。其实,一般来说,Linux的应用软件的可执行文件会存放在/usr/local/bin目录下!不过这并不是“放四海皆准”的真理,最可靠的还是看这个软件的INSTALL和README文件,一般都会有说明。

  • 卸载

    通常软件的开发者很少考虑到如何卸载自己的软件,而tar又仅是完成打包的工作,所以并没有提供良好的卸载方法。

    那么是不是说就不能够卸载呢!其实也不是,有两个软件能够解决这个问题,那就是Kinstall和Kife,它们是tar包安装、卸载的黄金搭档。它们的使用方法,笔者会另行文介绍。在此就不加赘述了。

四、搞定使用rpm打包的应用软件

rpm可谓是Redhat公司的一大贡献,它使Linux的软件安装工作变得更加简单容易。

  • 安装

    执行:

    rpm –ivh rpm软件包名

    更高级的,请见下表:

    rpm参数 参数说明
    -i 安装软件
    -t 测试安装,不是真的安装
    -p 显示安装进度
    -f 忽略任何错误
    -U 升级安装
    -v 检测套件是否正确安装

    这些参数可以同时采用。更多的内容可以参考RPM的命令帮助。

  • 卸载

    我同样只需简单的一句话,就可以说完。执行:

    rpm –e 软件名

    不过要注意的是,后面使用的是软件名,而不是软件包名。例如,要安装software-1.2.3-1.i386.rpm这个包时,应执行:

    rpm –ivh software-1.2.3-1.i386.rpm

    而当卸载时,则应执行:

    rpm –e software。

    另外,在Linux中还提供了象GnoRPM、kpackage等图形化的RPM工具,使得整个过程会更加简单。这些软件的具体应用,笔者会另行文介绍。

五、搞定使用deb打包得让应用程序

这是Debian Linux提供的一个包管理器,它与RPM十分类似。但由于RPM出现得更早,所以在各种版本的Linux都常见到。而debian的包管理器dpkg则只出现在Debina Linux中,其它Linux版本一般都没有。我们在此就简单地说明一下:

  • 安装

    dpkg –i deb软件包名

    如:

    dpkg –i software-1.2.3-1.deb

  • 卸载

    dpkg –e 软件名

    如:

    dpkg –e software

 

  • Linux下安装nginx    

1:将下载下来的Nginx上传到/opt/nginx目录下。运行“tar -zxvf nginx-1.6.2.tar.gz”进行解压

  

【linux安装软件步骤】

  

Linux下安装PCRE:

  

PCRE(Perl Compatible Regular Expressions)是一个轻量级的Perl函数库,包括 perl 兼容的正则表达式库。它比Boost之类的正则表达式库小得多。PCRE十分易用,同时功能也很强大,性能超过了POSIX正则表达式库和一些经典的正则表达式库。

1. PCRE目前最新版本为8.36,可以点这里进行下载。

2. 使用tar -zxvf pcre-8.36.tar.gz进行解压。

3. 运行 chmod -R 777 /pcre-8.36 对当前文件夹授予全部读写权限。

  在执行chmod 时出现:【linux-command not find解决方法 】 参见解决方法

4. 切换到/pcre-8.36目录下,运行 ./configure 进行pcre初始化配置,会在控制台打印出一大堆的输出信息。

  在执行./configure时出现:

【linux安装软件步骤】

解决方法:参见:【linux-./configure 配置文件时出错问题】

5. 执行make操作,进行编译。

[root@server06 pcre-8.36]# make 
rm -f pcre_chartables.c 
ln -s ./pcre_chartables.c.dist pcre_chartables.c 
make  all-am 
make[1]: Entering directory `/opt/nginx/pcre-8.36′ 
  CC      libpcre_la-pcre_byte_order.lo 
  CC      libpcre_la-pcre_compile.lo 
  CC      libpcre_la-pcre_config.lo 
  CC      libpcre_la-pcre_dfa_exec.lo 
  CC      libpcre_la-pcre_exec.lo 
  CC      libpcre_la-pcre_fullinfo.lo 
  CC      libpcre_la-pcre_get.lo 
  CC      libpcre_la-pcre_globals.lo 
  CC      libpcre_la-pcre_jit_compile.lo 
  CC      libpcre_la-pcre_maketables.lo 
  CC      libpcre_la-pcre_newline.lo 
  CC      libpcre_la-pcre_ord2utf8.lo 
  CC      libpcre_la-pcre_refcount.lo 
  CC      libpcre_la-pcre_string_utils.lo 
  CC      libpcre_la-pcre_study.lo 
  CC      libpcre_la-pcre_tables.lo 
  CC      libpcre_la-pcre_ucd.lo 
  CC      libpcre_la-pcre_valid_utf8.lo 
  CC      libpcre_la-pcre_version.lo 
  CC      libpcre_la-pcre_xclass.lo 
  CC      libpcre_la-pcre_chartables.lo 
  CCLD    libpcre.la 
  CC      libpcreposix_la-pcreposix.lo 
  CCLD    libpcreposix.la 
  CXX      libpcrecpp_la-pcrecpp.lo 
  CXX      libpcrecpp_la-pcre_scanner.lo 
  CXX      libpcrecpp_la-pcre_stringpiece.lo 
  CXXLD    libpcrecpp.la 
  CC      pcretest-pcretest.o 
  CC      pcretest-pcre_printint.o 
  CCLD    pcretest 
  CC      pcregrep-pcregrep.o 
  CCLD    pcregrep 
  CXX      pcrecpp_unittest-pcrecpp_unittest.o 
  CXXLD    pcrecpp_unittest 
  CXX      pcre_scanner_unittest-pcre_scanner_unittest.o 
  CXXLD    pcre_scanner_unittest 
  CXX      pcre_stringpiece_unittest-pcre_stringpiece_unittest.o 
  CXXLD    pcre_stringpiece_unittest 
make[1]: Leaving directory `/opt/nginx/pcre-8.36′

6. 运行 [root@server06 pcre-8.36]# make install,进行安装,至此PCRE安装完成。   
 
[root@server06 pcre-8.36]# make install

 

3: 安装完PCRE后,再次运行./configure进行初始化即可。注意这里生成的配置文件,尤其箭头所指的方向,是启动nginx时的路径。

=================================================================

[root@localhost javaSoft]# ls
nginx-1.8.0 nginx-1.8.0.tar.gz pcre-8.40 pcre-8.40.tar.gz
[root@localhost javaSoft]# cd nginx-1.8.0
[root@localhost nginx-1.8.0]# ls
auto CHANGES.ru configure html Makefile objs src
CHANGES conf contrib LICENSE man README
[root@localhost nginx-1.8.0]# pwd
/javaSoft/nginx-1.8.0

[root@localhost nginx-1.8.0]# ll
总用量 660
drwxr-xr-x. 6 1001 1001 4096 4月 11 22:04 auto
-rw-r–r–. 1 1001 1001 249124 4月 21 2015 CHANGES
-rw-r–r–. 1 1001 1001 379021 4月 21 2015 CHANGES.ru
drwxr-xr-x. 2 1001 1001 4096 4月 11 22:04 conf
-rwxr-xr-x. 1 1001 1001 2478 4月 21 2015 configure
drwxr-xr-x. 4 1001 1001 4096 4月 11 22:04 contrib
drwxr-xr-x. 2 1001 1001 4096 4月 11 22:04 html
-rw-r–r–. 1 1001 1001 1397 4月 21 2015 LICENSE
-rw-r–r–. 1 root root 46 4月 11 22:07 Makefile
drwxr-xr-x. 2 1001 1001 4096 4月 11 22:04 man
drwxr-xr-x. 2 root root 4096 4月 11 22:07 objs
-rw-r–r–. 1 1001 1001 49 4月 21 2015 README
drwxr-xr-x. 8 1001 1001 4096 4月 11 22:04 src
[root@localhost nginx-1.8.0]# ./configure
checking for OS
+ Linux 2.6.32-504.el6.x86_64 x86_64
checking for C compiler … found
+ using GNU C compiler
+ gcc version: 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC)
checking for gcc -pipe switch … found
checking for gcc builtin atomic operations … found
checking for C99 variadic macros … found
checking for gcc variadic macros … found
checking for unistd.h … found
checking for inttypes.h … found
checking for limits.h … found
checking for sys/filio.h … not found
checking for sys/param.h … found
checking for sys/mount.h … found
checking for sys/statvfs.h … found
checking for crypt.h … found
checking for Linux specific features
checking for epoll … found
checking for EPOLLRDHUP … found
checking for O_PATH … not found
checking for sendfile() … found
checking for sendfile64() … found
checking for sys/prctl.h … found
checking for prctl(PR_SET_DUMPABLE) … found
checking for sched_setaffinity() … found
checking for crypt_r() … found
checking for sys/vfs.h … found
checking for nobody group … found
checking for poll() … found
checking for /dev/poll … not found
checking for kqueue … not found
checking for crypt() … not found
checking for crypt() in libcrypt … found
checking for F_READAHEAD … not found
checking for posix_fadvise() … found
checking for O_DIRECT … found
checking for F_NOCACHE … not found
checking for directio() … not found
checking for statfs() … found
checking for statvfs() … found
checking for dlopen() … not found
checking for dlopen() in libdl … found
checking for sched_yield() … found
checking for SO_SETFIB … not found
checking for SO_ACCEPTFILTER … not found
checking for TCP_DEFER_ACCEPT … found
checking for TCP_KEEPIDLE … found
checking for TCP_FASTOPEN … not found
checking for TCP_INFO … found
checking for accept4() … found
checking for eventfd() … found
checking for int size … 4 bytes
checking for long size … 8 bytes
checking for long long size … 8 bytes
checking for void * size … 8 bytes
checking for uint64_t … found
checking for sig_atomic_t … found
checking for sig_atomic_t size … 4 bytes
checking for socklen_t … found
checking for in_addr_t … found
checking for in_port_t … found
checking for rlim_t … found
checking for uintptr_t … uintptr_t found
checking for system byte ordering … little endian
checking for size_t size … 8 bytes
checking for off_t size … 8 bytes
checking for time_t size … 8 bytes
checking for setproctitle() … not found
checking for pread() … found
checking for pwrite() … found
checking for sys_nerr … found
checking for localtime_r() … found
checking for posix_memalign() … found
checking for memalign() … found
checking for mmap(MAP_ANON|MAP_SHARED) … found
checking for mmap(“/dev/zero”, MAP_SHARED) … found
checking for System V shared memory … found
checking for POSIX semaphores … not found
checking for POSIX semaphores in libpthread … found
checking for struct msghdr.msg_control … found
checking for ioctl(FIONBIO) … found
checking for struct tm.tm_gmtoff … found
checking for struct dirent.d_namlen … not found
checking for struct dirent.d_type … found
checking for sysconf(_SC_NPROCESSORS_ONLN) … found
checking for openat(), fstatat() … found
checking for getaddrinfo() … found
checking for PCRE library … found
checking for PCRE JIT support … found
checking for md5 in system md library … not found
checking for md5 in system md5 library … not found
checking for md5 in system OpenSSL crypto library … not found
checking for sha1 in system md library … not found
checking for sha1 in system OpenSSL crypto library … not found
checking for zlib library … not found

./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using –without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using –with-zlib= option.

===================================================================

[root@localhost nginx-1.8.0]# make install
make: *** 没有规则可以创建目标“install”。 停止。

解决方法:

 

 

4: 运行 make install 进行编译。

5: 切换到步骤4生成的nginx运行目录下,运行./nginx,启动Nginx。

 

posted on 2017-04-11 13:54  nodeyang 阅读( ) 评论( ) 编辑 收藏

转载于:https://www.cnblogs.com/yangjian-java/p/6693236.html

文章知识点与官方知识档案匹配,可进一步学习相关知识云原生入门技能树首页概览8582 人正在系统学习中 相关资源:软件标书范本(技术部分)_软件技术标书-项目管理文档类资源-CSDN文库

来源:denglan7499

声明:本站部分文章及图片转载于互联网,内容版权归原作者所有,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2017年3月9日
下一篇 2017年3月9日

相关推荐