LAMP 环境搭建之源码包编译安装
mysql用的二进制包安装。 Apache php 用的源码包
mysql版本5.5.46 Apache版本2.4.7 PHP版本:5.5
安装mysql
mysql下载地址:http://mirrors.sohu.com/mysql/MySQL-5.5/
初始化
[root@localhost lamp]# tar zxvf mysql-5.5.46-linux2.6-x86_64.tar.gz #解压
[root@localhost lamp]# mv mysql-5.5.46-linux2.6-x86_64 /usr/local/mysql #移动位置,并去掉版本好
[root@localhost lamp]# useradd -s /sbin/nologin -M mysql #增加mysql用户。 不能登录 不创建家目录
[root@localhost lamp]# mkdir -p /data/mysql #创建datadir 数据库文件会放在这里
[root@localhost lamp]# chown -R mysql:mysql /data/mysql/ #更改属组 属主
[root@localhost lamp]# cd /usr/local/mysql/ #进入目录
[root@localhost mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql --user定义数据库的所属主,--datadir 定义安装目录
接下来会看到有两个OK.说明执行正确。
[root@localhost mysql]# cp support-files/mysql.server /etc/init.d/mysqld
#复制启动脚本文件
[root@localhost mysql]# chmod 755 /etc/init.d/mysqld
# 修改启动脚本权限
[root@localhost mysql]# vim /etc/init.d/mysqld
#修改启动脚本。 找到bashedir 增加下面的路径
basedir=/usr/local/mysql # 安装位置
datadir=/data/mysql # 数据库位置
然后把启动脚本加入系统服务项,设定开机启动
chkconfig --add mysqld
chkconfig mysqld on
service mysqld start
如果启动不了。请到/data/mysql 目录下查看错误日志。这个日志通常是主机名.err。
检查MYSQL石否启动的命令为:
ps aux |grep mysqld
netstat -an |grep 3306
安装Apache2.4.7版本。
下载地址为:http://mirrors.sohu.com/apache/
tar zxvf httpd-2.4.7.tar.gz #解压文件
cd httpd-2.4.7 #进入目录
./configure --prefix=/usr/local/apache2/ --sysconfdir=/usr/local/apache2/etc --with-included-apr --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared #编译参数
错误
configure: error:Bundled APR requested but not found at./srclib/.
tar zxvf apr-1.4.6.tar.gz #解压apr包
tar -zxvf apr-util-1.4.1.tar.gz #解压apr-util包
cp -r /lamp/apr-1.4.6 /lamp/httpd-2.4.7/srclib/apr
cp -r /lamp/apr-util-1.4.1 /lamp/httpd-2.4.7/srclib/apr-util # 然后把两个包复制到httpd-2.4.7/srclib/ 里面并且取消版本号。
错误:
configure: error: in `/lamp/httpd-2.4.7/srclib/apr':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
configure failed for srclib/apr
yum -y install gcc-c++ #安装 gcc
错误:
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
tar zxvf pcre-8.34.tar.gz
[root@localhost lamp]# cd pcre-8.34
[root@localhost pcre-8.34]# ./configure && make && make install
错误
checking whether to enable mod_deflate... configure: error: mod_deflate has been requested but can not be built due to prerequisite failures
yum -y install openssl-devel
把上面4个错误解决后。重新 ./configure 参数编译 无问题就执行
make
make install
/usr/local/apache2/bin/apachectl start # 启动apache
启动完后用以下命令检查apache是否正常启动,
ps aux |grep httpd
netstat -an |grep :80
如果不能启动 请清空防火墙规格。关闭selinux
iptables -F
service iptables save
通过浏览器输入地址访问:http://192.168.137.30 (我服务器的地址) 。若能显示“It works”表明apache正常工作。
设置Apache系统开机是自动开启。
vim /etc/rc.d/rc.local
增加一行 把下面增加进去。
/usr/local/apache2/bin/apachectl start
安装php5.5版本。
tar zxvf php-5.5.9.tar.gz #解压php安装包
cd php-5.5.9 #进入php文件
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif --disable-ipv6 --with-mcrypt=/usr/local/libmcrypt/ #编译参数
错误configure: error: xml2-config not found. Please check your libxml2 installation.yum install -y libxml2-devel错误configure: error: Please reinstall the BZip2 distribution
yum install -y bzip2 bzip2-devel错误
configure: error: jpeglib.h not found.
yum install libjpeg-devel -y
错误
configure: error: png.h not found.
yum install libpng-devel -y
错误
configure: error: freetype-config not found.
yum install -y freetype freetype-devel
错误
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
tar zxvf mcrypt-2.6.8.tar.gz #提示mcrypt包没有安装。安装mcrypt包 又依赖依赖 libmcrypt, mhash 这两个包。
1.首先编译安装 libmcrypt, mhash, mcrypt 二进制源码包。
下载libmcrypt-2.5.8.tar.gz
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure --prefix=/usr/local/related/libmcrypt
make
make install
安装 libltdl,也在libmcrypt源码包里面
cd libmcrypt-2.5.8 /libltdl
./configure --enable-ltdl-install
make
make install
下载mhash-0.9.9.9.tar.gz
tar zxvf mhash-0.9.9.9
cd mhash-0.9.9.9
./configrue --prefix
make
make install
这两个包安装完。然后在安装mcrypt包。
安装mcrypt
tar zxvf mcrypt-2.6.8.tar.gz
LD_LIBRARY_PATH=/usr/local/libmcrypt/lib:/usr/local/lib ./configure --with-libmcrypt-prefix=/usr/local/libmcrypt #编译参数
make
make install
#mcrypt 没有安装完成。这是php模块。需要等php安装完成之后。在继续安装。
把以上的依赖关系解决完了之后在继续安装PHP
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif --disable-ipv6 --with-mcrypt=/usr/local/libmcrypt/
make
make install
生成php.ini
cp /lamp/php-5.5.9/php.ini-production /usr/local/php/etc/php.ini
apache结合php
Apache的主配置文件为 :/usr/local/apache2/etc/httpd.conf #参数编译的时候指定到/usr/local/apache2/etc/ 这个目录下。
vim /usr/local/apache2/etc/httpd.conf
找到AddType application/x-gzip .gz .tgz 这一行在下面增加
AddType application/x-httpd-php .php
找到:<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
将中间一样的内容改为:DirectoryIndex index.html index.htm index.php
修改完成后保存退出。
启动前检测apache的配置文件是否正常。
/usr/local/apache2/bin/apachectl -t
如果显示“Syntax OK” 表示正常。
启动apache
/usr/local/apache2/bin/apachectl start
检测是否启动成功。
netstart -lnp |grep httpd
/usr/local/apache2/bin/apachectl graceful 加载apache配置文件 不用重启
/usr/local/apache2/bin/apachectl -t 查看php配置文件是否正常
/usr/local/php/bin/php -i |more 能查看php安装信息。。./configure 内容 等等
cat /usr/local/apache2/build/config.nice 查看apache 安装的编译代码
cat /usr/local/mysql/bin/mysqlbug |grep -i confi 参看musql安装的编译参数
LAMP 环境搭建之源码包编译安装的更多相关文章
- redhat6.2 clang编译环境搭建(采用源码包编译安装)
1. About clang++ office site:http://clang.llvm.org/ A major focus of our work on clang is to make it ...
- CentOS 7.2使用源码包编译安装MySQL 5.7.22及一些操作
CentOS 7.2使用源码包编译安装MySQL 5.7.22及一些操作 2018年07月05日 00:28:38 String峰峰 阅读数:2614 使用yum安装的MySQL一般版本比较旧,但 ...
- MySQL源码包编译安装
+++++++++++++++++++++++++++++++++++++++++++标题:MySQL数据库实力部署时间:2019年3月9日内容:MySQL源码包进行编译,然后部署MySQL单实例重点 ...
- CentOS 7.4 使用源码包编译安装MySQL 5.7.20
使用yum安装的MySQL一般版本比较旧,但是运行稳定.如果想要尝试最新的功能或者需要指定特殊的功能的话,就需要手工进行编译安装了. 一.下载安装包 (一).先下载MySQL源码,网址为:https: ...
- PHP-5.6.8 源码包编译安装
一.下载源码包后,进行解压 [root@www home]# .tar.bz2 gzip: stdin: not in gzip format tar: Error is not recoverabl ...
- MYSQL5.7源码包编译安装
Centos下用cmake编译安装MySQL 5.7安装依赖包yum -y install gcc gcc-c++ ncurses ncurses-devel cmake下载相应源码包cd /usr/ ...
- MYSQL5.5源码包编译安装
MYSQL5.5源码安装首先安装必要的库yum -y install gcc*###### 安装 MYSQL ######首先安装camke 一.支持YUM,则yum install -y cmake ...
- MYSQL5.6源码包编译安装
linux下用cmake编译安装mysql-5.6.35cmake编译安装mysql的方法:#useradd -M mysql -s /sbin/nologin#yum install -y cmak ...
- tomcat7源码包编译安装
tomcat/:作用解析jsp程序.先安装jdk容器.1.下载jdk, wget http://download.oracle.com/otn- pub/java/jdk/8u131- b11/d54 ...
随机推荐
- Python 升级
1.到官网下载对于的版本: 2.下载之后并解压出来,编译: tar xf python.xx.xx.tar.xz sudo mkdir /usr/local/python ./configure -- ...
- 什么是SPI通信?
SPI:高速同步串行口.3-4线接口,收发独立.可同步进行. SPI,是英语Serial Peripheral interface的缩写,顾名思义就是串行外围设备接口.是Motorola首先在其MC6 ...
- (摘)C#comboBox绑定数据
C#中comboBox用代码绑定数据库中在某一列.用处:跟radioButton联系在一起,可以根据radioButton在选择而在comboBox显示出不同的值. private void radi ...
- Borland license information was found,but it is not valid for delphi.
The start Delphi7 come amiss: Borland license information was found,but it is not valid for delphi. ...
- Java中一些常用的代码
总结一下最近程序中用到的代码吧,大部分不是自己写的,放到这里,备份一下,以后忘记了来看一下: //正则表达式验证手机号 public static void phoneTest(String phon ...
- 法爱格2014 春夏新款欧美纯色修身高腰无袖吊带V领 拼接性感 连衣裙 黑色 M【图片 价格 品牌 报价】-京东
法爱格2014 春夏新款欧美纯色修身高腰无袖吊带V领 拼接性感 连衣裙 黑色 M[图片 价格 品牌 报价]-京东 法爱格2014 春夏新款欧美纯色修身高腰无袖吊带V领 拼接性感 连衣裙 黑色 M
- Exchange Server 2010/2013功能差异
- [iOS] Create TableView & customize UITableViewCell
1. First artical, notice the last thing - Connecting the DataSource and Delegate: http://www.appcoda ...
- APP制作过程
直播App开发的过程 第一步:分解直播App的功能,我们以X客为例 视频直播功能,这是一款直播App最主要的功能,要能支持视频直播RTMP推流,使画面传输流畅.清晰(美颜后的清晰,你懂的聊天功能,用户 ...
- CSS3 之 box-shadow
1. css3 box-shadow CSS3的box-shadow属性可以让我们轻松实现图层阴影效果 box-shadow: inset(可选 默认没有) x-offset y-offset ...