网站上最新发布的软件都是以源码包形式发布的,源码包通常是压缩包,自己解压、配置、编译、安装。所以掌握源码包的安装方式对于我们学习Linux的来说是很重要的。下面我就为大家介绍一下如何安装源码包的软件:以安装Aapche为例

1,挂载软件光盘查找我们需要的Aapche源码包

[root@localhost ~]# mount /dev/hdc /media/

mount: block device /dev/hdc is write-protected,mounting read-only

[root@localhost ~]# cd /media/

[root@localhost media]# ls

AdobeReader_chs-8.1.2-1.i486.tar.gz          httpd-2.2.25.tar.gz …….此为Aapche源码包

LibreOffice_4.1.1.2_Linux_x86-64_rpm.tar.gz  linuxqq-v1.0.2-beta1.i386.rpm

RealPlayer11GOLD.rpm                         webmin-1.630.tar.gz

aria2-1.17.1.tar.gz

2,解压httpd-2.2.25.tar.gzroot目录

[root@localhost media]# tar -zxvf httpd-2.2.25.tar.gz-C /root

3,进入解压目录

[root@localhost media]# cd

[root@localhost ~]# ls

Desktop anaconda-ks.cfg  httpd-2.2.25  install.log install.log.syslog

[root@localhost ~]# cd httpd-2.2.25/

[root@localhost httpd-2.2.25]# ls

ABOUT_APACHE   LAYOUT        README-win32.txt config.layout  httpd.mak     os

Apache.dsw     LICENSE        README.platforms  configure     httpd.spec    server

BuildAll.dsp   Makefile.in    ROADMAP           configure.in   include      srclib

BuildBin.dsp   Makefile.win   VERSIONING        docs           libhttpd.dep  support

CHANGES        NOTICE         acinclude.m4      emacs-style    libhttpd.dsp  test

INSTALL        NWGNUmakefile  build             httpd.dep      libhttpd.mak

InstallBin.dsp README         buildconf         httpd.dsp      modules

[root@localhost httpd-2.2.25]#

4,找到绿色可执行文件configure,执行此配置文件

[root@localhosthttpd-2.2.25]# ./configure

checking for chosen layout... Apache

checking for working mkdir -p... yes

checking build system type...x86_64-unknown-linux-gnu

checking host system type... x86_64-unknown-linux-gnu

checking target system type...x86_64-unknown-linux-gnu


Configuring Apache Portable Runtime library ...

5,发现无法执行成功,提示无gcc环境

安装gcc

[root@localhost httpd-2.2.25]# yum install gcc* -y

6,重新执行./configure

[root@localhost httpd-2.2.25]# ./configure

7,编译并安装

[root@localhost httpd-2.2.25]# make&&makeinstall

8,验证

找到安装路径开启Aapche服务

[root@localhost httpd-2.2.25]#/usr/local/apache2/bin/apachectl start

[root@localhost httpd-2.2.25]#

打开浏览器输入本机ip127.0.0.1

wKiom1MICFKT1oLCAAEY3v4NDXM688.jpg

9,另外通过这段时间对Linux安装软件方法的学习我总结了一些知识希望和大家分享一下

1配置yum软件仓库安装

详见http://1570880775.blog.51cto.com/3105756/1361910

2程序是源码包,解压后查看解压目录内是否有绿色INSTALL可执行文件,如果有直接执行,方法./INSTALL,如果没有绿色的install可执行文件或者install文件执行未成功可用第三种方法

3程序是源码包,解压后用程序自带的*.sh/*.pl安装,方法./*.sh./*.pl如:./ setup.shsetup.shshell脚本)如果解压包里没有sh/pl脚本文件则选择第四种方法

4rpm安装:I程序直接是rpm格式的安装包直接安装II程序是源码包解压后寻找rpm安装包安装,多个程序可用rpm ivh *.rpm