编译安装软件

编译安装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 16:45
下一篇 2018-04-22 17:15

相关推荐

  • LINUX的哲学思想

    1.一切皆文件 把几乎所有资源统统抽象为文件形式,不仅普通的文件,目录、字符设备、块设备、 套接字等还包括硬件设备,甚者通信接口等。在Linux 中都是以文件被对待;它们虽然类型不同,但是对其提供的却是同一套操作界面。访问任何设备都可以用统一的一个接口。方便统一管理 由众多功能单一的程序组成。一个程序只做一件事,并且要做好,保证linux程序的高效运行。需要…

    Linux笔记 2018-06-27
  • Apache介绍及常用配置

    Apache是世界使用排名第一的Web服务器软件。它可以运行在几乎所有广泛使用的计算机平台上,由于其跨平台和安全性被广泛使用,是最流行的Web服务器端软件之一。

    2018-06-21
  • 加密与安全

    加密与安全 SSH端口转发 SSH 会自动加密和解密所有 SSH 客户端与服务端之间的网络数据。但是,SSH 还能够将其他 TCP 端口的网络数据通过 SSH 链接来转发,并且自动提供了相应的加密及解密服务。这一过程也被叫做“隧道”(tunneling),这是因为 SSH 为其他 TCP 链接提供了一个安全的通道来进行传输而得名。例如,Telnet,SMTP…

    Linux笔记 2018-06-11
  • linux基础之自动登陆和自动开启网卡设置

    Centos7.4设置自动登陆以及设置网卡开机自动启用功能 1、进入命令行模式,输入 nano /etc/gdm/custom.conf ,在[daemon]下添加2条命令,分别是 AutomaticLoginEnable=true AutomaticLogin=root 2、然后按住Ctrl+X退出并保存,接着选择Y,再按回车键即可保存更改,到这里设置自动…

    2018-03-29
  • if,case,for 脚本练习

    shell脚本练习

    2018-05-06