编译安装软件

编译安装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

相关推荐

  • 第七周作业

      1、创建一个10G分区,并格式为ext4文件系统;  (1) 要求其block大小为2048, 预留空间百分比为2,   卷标为MYDATA, 默认挂载属性包含acl;  (2) 挂载至/data/mydata目录,要求挂载时禁止程序自动运行,且不更新文件的访问时间戳; 1.创建分区/dev/sdb1,容量为10G fdisk /dev/sdb…

    2018-05-02
  • bash脚本进阶

    过程式编程语言:顺序执行选择执行if判断if 判断条件;那么条件为真的分支代码fi if 判断条件;then条件为真的分支代码else条件为假的分支代码fi多分支if 判断条件1; then条件为真的分支代码elif 判断条件2; then条件为真的分支代码elif 判断条件3; then条件为真的分支代码else以上条件都为假的分支代码ficase 变量引…

    2018-05-11
  • Linux文本处理工具

    抽取文本的工具: 文件查看命令: 分页查看文件内容: 显示文本前或后行的内容: 抽取文本cut和合并文件paste cut和paste: 分析文本的工具: 文件排序sort:  

    Linux笔记 2018-04-08
  • 使用gpg工具实现公钥加密

    本实验通过gpg工具 实现 用非对称密钥加密方法,对Centos 7 主机的文件fstab,用Centos6的公钥加密,并且到Centos6 用私钥解密文件。

    2018-05-16
  • 目录操作

    索引节点:  

    Linux笔记 2018-04-01
  • LINUX的哲学思想

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

    Linux笔记 2018-06-27