編譯安裝軟件

編譯安裝httpd軟件
1先配置yum源
準備工作:把所有yum源改成本地光盤
[root@centos7 etc]#find *yum*(查找yum配置目錄)
1.[root@centos6 ~]#df
.[root@centos6 ~]#cd /misc/cd/ (神奇文件自動掛載)光盤
[root@centos7 yum.repos.d]#ls(說明還沒配置好)
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo先去配置
[root@centos6 yum.repos.d]#yum repolist(測試yum配置是否成功)
Loaded plugins: fastestmirror, refresh-packagekit, security
Determining fastest mirrors
base | 4.0 kB 00:00 …
base/primary_db | 4.7 MB 00:00 …
repo id repo name status
base base 6,706
repolist: 6,706
2.安裝包組
#yum grouplist “Development Tools”
3.找源碼(官網)安裝httpd
解壓#tar xvf httpd-2.2.34
[root@centos6 ~]#cd httpd-2.2.34
[root@centos6 httpd-2.2.34]#ls 進入目錄查看重要文件
ABOUT_APACHE CHANGES httpd.dsp libhttpd.dep NOTICE server
acinclude.m4 config.layout httpd.mak libhttpd.dsp NWGNUmakefile srclib
Apache.dsw configure httpd.spec libhttpd.mak os support
build configure.in include LICENSE README test
BuildAll.dsp docs INSTALL Makefile.in README.platforms VERSIONING
BuildBin.dsp emacs-style InstallBin.dsp Makefile.win README-win32.txt
buildconf httpd.dep LAYOUT modules ROADMAP
4.編譯./configure文件
[root@centos6 src]#./configure \
> –prefix=/root/app \(必須要改的)
> –sysconfdir=/etc/httpd22 \(把這個文件獨立出來)
> –enable-ssl
checking openssl/opensslv.h presence… no
checking for openssl/opensslv.h… no
checking openssl/ssl.h usability… no
checking openssl/ssl.h presence… no
checking for openssl/ssl.h… no(報錯提示缺少openssl開發包組)
所以去安裝openssl
[root@centos6 src]#yum list *openssl*
Loaded plugins: fastestmirror, refresh-packagekit, security
?
openssl.i686 1.0.1e-57.el6 base
openssl-devel.i686 1.0.1e-57.el6 base
openssl-devel.x86_64 1.0.1e-57.el6 base (和編譯相關大部份都要是devel包)
[root@centos6 src]#yum install openssl-devel把開發包組裝上
[root@centos6 src]#chec./configure \(然后再跑一次,看看還少什
它缺啥就裝啥
> –prefix=/root/app \
> –sysconfdir=/etc/httpd22 \
> –enable-ssl
[root@centos6 src]#echo $?
0 (說明前面命令沒問題了)
5.make 編譯(去設置cpu加為4個)
執行完畢聲音提示
[root@centos6 src]#make -j 4 && echo -e “\a” && sleep 1&& echo -e “\a” && sleep 1&& echo -e “\a” && sleep 1&& echo -e “\a” && sleep 1&& echo -e “\a” && sleep 1sleep 1&& echo -e “\a”
ok軟件已經裝好
最后看看效果,讓它跑起來,自己的機上有沒有web服務,如果不能訪問,打開安裝程序文檔INSTALL
[root@centos6 httpd-2.2.34]#cat INSTALL
http://httpd.apache.org/docs/2.2/install.html
$ ./configure –prefix=PREFIX
$ make
$ make install
$ PREFIX/bin/apachectl start(最后一步意思要運行/bin下的apachectl start程序運行起來)所以把/bin這個文件夾放到PATH變量里,以后就可以不用再重復寫了,
開始改PATH變量
[root@centos6 src]#vi /etc/profile.d/env.sh(隨便一個文件名)
1 PS1=”\[\e[1;35m\][\u@\h \W]\\$\[\e[0m\]”
2 PATH=/usr/local/apache2/bin:$PATH(把當前/bin的絕對路徑加進去)
[root@centos6 src]#. /etc/profile.d/env.sh(生效)
[root@centos6 src]#echo $PATH(看改的咱樣)
/usr/local/apache2/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
[root@centos6 src]#apachectl start(啟動程序)
ok!!!!!!
更改網頁內容,讓它更漂亮點
[root@centos6 apache2]#ls
bin build cgi-bin conf error htdocs icons include lib logs man manual modules
[root@centos6 apache2]#cd htdocs(這個是放網頁文件的文件夾)
[root@centos6 htdocs]#ls
index.html(網頁文件內容的文件)
[root@centos6 htdocs]#cat index.html
<html><body><h1>It works!</h1></body></html>[root@centos6 htdocs]#^C
[root@centos6 htdocs]#vim index.html
1 <html><body><h1>well come to my space—</h1></body></

本文來自投稿,不代表Linux運維部落立場,如若轉載,請注明出處:http://www.www58058.com/96802

(0)
單爆手單爆手
上一篇 2018-04-22
下一篇 2018-04-22

相關推薦

  • shell回顧

    測試基礎知識

    2018-05-17
  • 初學linux你該死記它們

    最笨的方法往往是最好的方法

    Linux筆記 2018-04-08
  • LAMP、php、mariadb

    LAMP: a:apache m:mariadb、mysql p:php,perl,python LAMMP:memcached   靜態資源:靜態內容,客戶端從服務器獲得的資源的表現形式與源文件相同; 動態資源:通常是程序文件,需要在服務器執行之后,將執行的結果返回給客戶端; CGI:common gateway interface通用網關接口 …

    Linux筆記 2018-05-21
  • CENTOS開機流程

    開機流程 centos 5和6版本開機流程kernel==>rootfs(根文件系統)首先內核啟動,然后加載根文件系統,然后啟動init(第一個文件系統)它負責所有的程序的啟動、管理、調用、刪除等(這一切是運行在用戶空間的)。 “`kernel:進程管理內存管理網絡管理驅動程序文件系統安全功能 rootfs:glibc“` 庫:…

    Linux筆記 2018-05-13
  • 初識VIM和正則表達式

    vim和正則表達式練習

    Linux筆記 2018-05-31
欧美性久久久久