注意,本節使用的源碼包,指的是軟件所有源代碼的壓縮包,其后綴名為 ".tar.gz" 或 ".tar.bz2";而 SRPM 源碼包本質上屬于 RPM 包,也就是源碼的RPM包,其文件后綴為 ".src.rpm"。雖然都叫源碼包,但不是一碼事。
軟件的源代碼,也就是軟件的原始數據,任何人都可以通過源代碼查看該軟件的設計架構和實現方法,但軟件源代碼無法再計算機中直接運行安裝,需要將源代碼通過編譯轉換為計算機可以識別的機器語言,然后才可以安裝。[root@localhost ~]# rpm -q gcc
gcc-4.4.6-4.el6.i686
[root@localhost yum. repos.d]# rpm -q make
make-3.81-20.el6.i686
yum -y install make 命令直接安裝 make。[root@localhost ~]#tar -zxvf httpd-2.2.9.tar.gz|more
[root@localhost ~]# ls
anaconda-ks.cfg httpd-2.2.9 httpd-2.2.9.tar.gz install.log install.log.syslog
[root@localhost ~]# cd httpd-2.2.9
[root@localhost httpd-2.2.9]#./configure --help|more
#查詢apache支持的選項功能(不是必需步驟)
[root@localhost httpd-2.2.9]# ./configure --prefix=/usr/local/apache2
checking for chosen layout...Apache
checking for working mkdir -p…yes
checking build system type...i686-pc-linux-gnu
checking host system type...i686-pc-linux-gnu
checking target system typa...i686-pc-linux-gnu
…省略部分輸出…
[root@localhost httpd-2.2.9]# make
編程過程較為耗時,需要有足夠的耐心。[root@localhost httpd-2.2.9]# make install
整個過程不報錯,即為安裝成功。make clean 命令,它會清空 Makefile 文件或編譯產生的 ".o" 頭文件。[root@localhost ~]# rm -rf /usr/local/apache2/
新聞熱點
疑難解答