编译安装软件

编译安装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.178linux.com/96802

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

相关推荐