在centos6.5上编译安装lamp

author author     2022-08-10     752

关键词:

LAMP组合的编译安装

基于centos6.5实现

httpd+php

modulesphp编译成httpdDSO对象

prefork:libphp5

event,worker:libphp5-zts

cgi

fastcgifpm:php作为独立的服务

httpdfastcgi协议的支持

httpd-2.2需要额外安装fcgi模块

httpd-2.4自带fcgi模块

 

安装次序

httpdMariadbphp

 

安装开发环境httpd安装依赖pcre因此要安装pcre-devel

1.yum groupinstall "Development Tools" "Server Platform Development" -y

yum install pcre-devel -y

2.安装新版apr

#tar xf apr-1.5.0.tar.bz2

#cd apr-1.5.0

#ls

#./configure --prefix=/usr/local/apr为了防止覆盖系统已安装的版本

#make && make install

 

安装新版apr-util

#tar xf apr-util-1.5.3.tar.bz2

#cd apr-util-1.5.3

#./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

#make && make install

 

httpd的编译安装

#tar xf httpd-2.4.9.tar.bz2

#cd httpd-2.4.9

#groupadd -r apache添加系统组

#useradd -r -g apache apache添加系统用户

#id apache

注意首先安装pcre-devel

yum -y install pcre-devel

#./configure --help|less

#./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-modules=most --enable-mpms-shared=all --with-mpm=event

 

注意--sysconfdir=/etc/httpd24默认配置文件目录

--prefix=/usr/local/apache默认安装目录

技术分享 

#make && make install

#cd /etc/rc.d/init.d/

发现/etc/rc.d/init.d/下没有httpd这个文件执行rpm -q httpd命令提示package httpd is not installed即需要安装httpd包执行yum install httpd* -y

#cp httpd httpd24

#vim httpd24

技术分享 

将上如中的参数修改如下

技术分享 

chkconfig --add httpd24

chkconfig --list httpd24

chkconfig httpd24 on

启动服务

/usr/local/apache/bin/apachectl

提示错误

AH00558: httpd: Could not reliably determine the server‘s fully qualified domain name, using ::1. Set the ‘ServerName‘ directive globally to suppress this message

解决办法

如果想使用apachectl启动服务需要

vim /etc/profile.d/httpd.sh

export PATH=/usr/local/apache/bin:$PATH

./etc/profile.d/httpd.sh重读配置文件

echo $PATH

httpd -t

提示错误httpd: Could not reliably determine the server‘s fully qualified domain name, using ::1 for ServerName

Syntax OK

解决办法

技术分享 

hash -r

service httpd start

ss -tnl

ps aux|grep httpd验证是否运行event进程

技术分享 

查看80端口是否被占用ss -tnl

关闭selinux

如果访问不了清空一下访问规则

iptables -L -n

iptables -F

setenforce 0

service httpd start

httpd -M 查看装载的模块

cd /etc/httpd24目录

vim httpd.conf下启用或禁用某一模块

技术分享 

 

 

技术分享 

 

 

 

 

 

3.安装mariadbl

#tar xf mariadb-5.5.36-linux-i686.tar.gz -C /usr/local

#mkdir -pv /mydata/data

#useradd -r mysql

#chown -R mysql.mysql /mydata/data/

#cd /usr/local

# ln -sv mariadb-5.5.36-linux-i686 mysql

#cd mysql

#chown -R root.mysql ./*

#

#[[email protected] mysql]#scripts/mysql_install_db --datadir=/mydata/data/ --user=mysql 初始化操作

提示错误-bash: scripts/mysql_install_db: No such file or directory

解决办法

发现先前安装的mariadb版本为mariadb-10.0.13.tar换包。

#mkdir /etc/mysql

#cp support-files/my-large.cnf /etc/mysql/my.cnf

#vim /etc/mysql/my.cnf

技术分享 

#cp support-files/mysql.server /etc/rc.d/init.d/mysqld

#chkconfig --add mysqld

#service mysqld start

技术分享 

#ss -tnl

技术分享 

#/usr/local/mysql/bin/mysql

# mysql_secure_installation安全初始化(方法)

提示-bash: mysql_secure_installation: command not found

解决办法

#yum install mysql* -y

再次执行mysql_secure_installation

 

4.安装phpl

#cd /mnt

#tar xf php-5.4.26.tar.bz2

# cd php-5.4.26

解决依赖关系

请配置好yum源系统安装源及epel源后执行如下命令

yum -y groupinstall Desktop Platform Development

yum -y install bzip2-devel libmcrypt-devel libxml2-devel

编译安装php-5.4.26

首先下载源码包至本地目录

tar xf php-5.4.26

cd php-5.4.26

./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --with-mysql=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-freeytpe-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-sockets --with-apxs2=/usr/local/apache/bin/apxs --with-mcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2 --enable-maintainer-zts

报错

configure: error: xml2-config not found. Please check your libxml2 installation.

解决办法yum install libxml2-devel -y

 

configure: error: mcrypt.h not found. Please reinstall libmcrypt.

解决办法yum install libmcrypt libmcrypt-devel mcrypt mhash -y

 

configure: error: Cannot find MySQL header files under /usr/local/mysql/bin/mysql_config

Note that the MySQL client library is not bundled anymore!

解决办法

--with-mysql=/usr/local/mysql/bin/mysql_config改为--with-mysql

技术分享 

make && make install

-z多启用几个线程

说明

这里为了支持apacheworkerevent这两个MPM编译时使用了--enable-maintainer-zts选项。

如果视频PHP5.3以上版本为了连接MySQL数据库可以指定mysqlnd这样在本机就不需要先安装MySQLMySQL开发包了。mysqlndphp5.3开始可用可以编译时绑定到它而不用和具体的MySQL客户端绑定形成依赖但从PHP5.4开始它就是默认设置了。

 

 

php提供配置文件

cp php.ini-production /etc/php.ini

技术分享 

 问题service httpd24 reload

Reloadinghttpd:             [FAILED]

解决办法

修改httpd.pid的位置

技术分享 

vim /etc/rc.d/init.d/httpd24

技术分享 

改为

技术分享 

 

 

3.编辑apache配置文件httpd.conf,apache支持php

cd /etc/httpd24

cp httpd.conf{,.bak}

vim httpd.conf.bak

首先确保

技术分享 

其次添加如下两行

AddType application/x-httpd-php.php

AddType application/x-httpd-php-spurce.phps

定位至DirectoryIndex index.html

修改为:

DirectoryIndexindex.phpindex.html

而后重新启动httpd或让其重新载入配置文件即可测试php是否已经可以正常使用。

技术分享 

 

cd /usr/local/apache/

cd htdocs/

mv index.html index.php

vim index.php

测试页面index.php示例如下

<?php

        $conn = mysql_connect(‘127.0.0.1‘,‘root‘,‘beijing‘);

        if($conn)

                echo "ok";

        else

                echo "Failure";

        mysql_close();

        phpinfo();

?>

技术分享

 

 

 

 

 

 

 

 


在centos6.9上编译安装lamp并搭建个人博客

准备阶段:1、两台安装了centos6.9的机器,A和B;A:192.168.1.100B:192.168.1.102其中A机器上跑http和php,B机器是mysql服务器2、准备软件包apr-1.6.2.tar.gz   apr-util-1.6.0.tar.gz #Apache可移植运行库,为上层应用程序提供一个可以... 查看详情

centos6.5编译安装lamp

...iApache安装目录:/usr/local/nginx二、准备工作1、最小化安装Centos6.5建立一个 查看详情

centos6.5编译安装lamp开发环境

...tp://pan.baidu.com/s/1jIjqinc  密码:ghc2  说明:由于centos6.5是分卷压缩的,且压缩为三个压缩包,所以请下载三个压缩包,并放于同一文件夹中,解压CentOS-6.5-x86_64-bin-DVD.zip即可。     lamp安装包文件夹中有19个安装包... 查看详情

centos6.5搭建lamp

1.首先安装apache可以直接yum安装apache命令:yuminstallhttpd//根据提示,输入Y安装即可成功安装。2.设置系统让Apache开机自动启动。servicehttpdstart//启动Apachechkconfighttpdon//设置开机自启3.防火墙设置关闭内核防火墙selinux。vi/etc/selinux/conf... 查看详情

linux(centos6.5)下编译安装nginx1.10.1

首先在特权账号(root)下安装编译时依赖项:yuminstallgccgcc-c++perl-y 首先以非特权账号(本文以账号comex为例)登陆OS:进入data目录下载相关安装介质mkdir/comexData/packagecd/comexData/packagewgethttp://nginx.org/download/nginx-1.10.1.tar.gzwgethttp... 查看详情

在 windows 64 位上编译和安装 openssl

】在windows64位上编译和安装openssl【英文标题】:CompilingandinstallingopensslOnwindows64bit【发布时间】:2012-08-2006:16:01【问题描述】:我想在Windows7HomePremium64位上安装openssl,我已经下载了openssl包并将其解压缩到c目录中,但是我找不到... 查看详情

无法在新的 Homestead 安装上编译 Laravel 资产

】无法在新的Homestead安装上编译Laravel资产【英文标题】:CannotcompileLaravelassetsonnewHomesteadinstall【发布时间】:2021-01-0800:02:53【问题描述】:更新3(最新)根据以下建议(来自justanothereddie),将驱动器配置为NFS解决了问题。不过... 查看详情

在 64 位 Arm 上编译和安装 Chez 方案?

】在64位Arm上编译和安装Chez方案?【英文标题】:CompilingandInstallingChezSchemeon64BitArm?【发布时间】:2021-03-2417:02:47【问题描述】:我尝试编译和安装ChezScheme编译器的Racket后端变体,因为它现在似乎支持aarch64Arm64架构,不像mainlineCh... 查看详情

在centos上编译安装mariadb数据库

一、安装前提(准备数据文件、安装其他依赖的软件)1、准备数据存放的目录[[email protected]~]#fdisk/dev/sdb (fdisk/dev/sdb创建一个逻辑分区/dev/sdb1)DevicecontainsneitheravalidDOSpartitiontable,norSun,SGIorOSFdisklabelBuildinganewDOSdisk 查看详情

在macos上编译ffmpeg(代码片段)

本文转自:在MacOS上编译FFmpeg|www.samirchen.com安装Xcode和CommandLineTools从AppStore上安装Xcode,并确保在Xcode的 Preferences->Downloads->Components 下安装好CommandLineTools。当然你也可以从 https://developer.apple. 查看详情

centos6.5下搭建lamp环境

安装apache服务Step1:使用yum安装apacheSudoyuminstallhttpd-yPS:采用该方法进行安装apache的配置文件的默认路径为:/etc/httpd/conf/httpd.conf Step2:配置防火墙(开启80端口)Sudovim/etc/sysconfig/iptables1-AINPUT-mstate--stateESTABLISHED,RELAT 查看详情

无法在 Windows 7 上编译 restbed

】无法在Windows7上编译restbed【英文标题】:Can\'tcompilerestbedonWindows7【发布时间】:2017-04-2715:08:41【问题描述】:我已经结束了16个小时的配置、安装、删除、修改和多次敲击我的键盘......我想使用restbed进行独立于平台的C++编程,... 查看详情

centos6.5使用yum快速搭建lamp环境

...性不强,而且软件版本较低。一般用于实验和学习环境。CentOS6.5安装配置LAMP http:/ 查看详情

如何在centos6.5下编译64位的hadoop2.x

1,安装gcc,执行如下的几个yum命令即可,Java代码yum-yinstallgccyum-yinstallgcc-c++yuminstallmakeyuminstallautoconfautomakelibtoolcmakencurses-developenssl-develgcc*2,安装JDK,并设置环境变量,完成后测试安装成功否Java代码[root@ganglia~]#java-versionjavaversion"... 查看详情

在ubuntu上编译chrome

在ubuntu上编译chrome红心地瓜1.获取代码1)下载tarball,http://chromium-browser-source.commondatastorage.googleapis.com/chromium_tarball.html2) 解压缩3)安装dept_tools:http://www.chromium.org/developers/how-tos/install- 查看详情

如何在windows上编译tesseractocr

安装安装过程中勾选Tesseractdevelopmentfiles:编译在安装目录中找到vs2008到工程目录:找到所有编译相关的库:打开VisualStudio2008(没有的可以去官网下载express版本),导入工程编译。最后生成DEBUG和RELEASE两个版本的DLL参考技术Aso是... 查看详情

无法在 Windows 上编译 exqlite

】无法在Windows上编译exqlite【英文标题】:CannotcompileexqliteonWindows【发布时间】:2021-11-0809:36:37【问题描述】:背景我正在尝试在我的WindowsVM中运行这个Elixir桌面应用程序:https://github.com/elixir-desktop/desktop-example-app我已经在我的Win... 查看详情

peak学linux--基于centos6.5搭建lamp并安装discuzx3.2

实验环境:VMwareWorkstation 10.0.0build-1295980centos6.532位(系统ip:192.168.10.50,与物理机桥接,保证可以上外网)所需的压缩包及下载地址mysql-5.1.72-linux-i686-glibc23http://mirrors.sohu.com/mysql/MySQL-5.1/mysql-5.1.72-linux-i686- 查看详情