编译安装软件

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

相关推荐

  • MySQL之SQL语法介绍

    结构化查询语言(Structured Query Language)简称SQL,是一种特殊目的的编程语言,是一种数据库查询和程序设计语言,用于存取数据以及查询、更新和管理关系数据库系统;同时也是数据库脚本文件的扩展名

    2018-06-07
  • 十六周

    1、源码编译安装LNMP架构环境; centos 7系统 编译安装nginx 安装编译环境 [root@localhost ~]# yum -y groupinstall “Development Tools” “Development Libraries” [root@localhost ~]# yum -y…

    Linux笔记 2018-03-26
  • Linux系统命令格式及常用命令

    一.Linux命令使用格式      #COMMAND OPTIONS ARGUMENTS 1.发起一命令:请求内核将某个二进制程序运行进一个程序;                    程序——>进程 静态——>动态(有生命周期)           命令本身是一个可执行的程序文件:二进制格式的文件,有可能会调用共享库文件; 2.多系统程序文件…

    2018-05-12
  • linux下练习及答案

    1.显示当前时间,格式:201-06-18  10:20:30 2.显示前天是星期几 3.设置当前日期为2019-08-07 06:05:10 4、在本机字符终端登录时,除显示原有信息外,再显示当前登录终端号,主机名和当前时间 6.今天19:30自动关机,并提示用户 7.显示/var目录下所有以l开头,以一个小写字母结尾,且中间出现至少一位数字的文件或目录 …

    2018-03-31
  • Work Tow

    1、Linux上的文件管理类命令都有哪些,其常用的使用方法及其相关示例演示。 linux上一切皆文件 (1)文件管理命令:cat、tac、head、tail、more、less等 cat:查看文件内容,一次性输出所有内容 ​                  -n :输出所有行编号 ​                  -b 对非空输出行号 例如:cat /…

    2018-07-15