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 ...
随机推荐
- 安装JDK+Tomcat,进行环境变量设置,和运行JSP
系统:windows 7 64-bit 安装前需要用到的软件 JDK7u21 Tomcat 8.0 下载64-bit Windows zip就好 安装JDK7u21 和平常安装软件一样,路径也不要动, ...
- Scala学习笔记--Actor和并发
感谢博主lyrebing 博文地址:http://blog.csdn.net/lyrebing/article/details/20446061 1. Actor用法 1.1 Actor的基本使用 ...
- iOS 的 APP 在系统中如何适配不同的屏幕的尺寸
iOS 的 APP 在系统中如何适配不同的屏幕的尺寸 标签: 2007年,初代iPhone发布,屏幕的宽高是 320 x 480 像素.下文也是按照宽度,高度的顺序排列.这个分辨率一直到iPhone ...
- pod应用--备用
一.概要 iOS开发时,项目中会引用许多第三方库,CocoaPods(https://github.com/CocoaPods/CocoaPods)可以用来方便的统一管理这些第三方库. 二.安装 由于 ...
- github恢复
一.查看修改日志信息 1)git log:显示最近到最远的提交日志 添加参数--pretty=oneline:查看简单的日志信息. 二.进行恢复到先前版本 1)在Git中,HEAD表示当前版本,上一个 ...
- Manacher马拉车
俗话说:摩托再好,不如骡拉啊(好像不是骡) Manacher就是O(N)计算最长回文子串的算法. 其中我们需要在0位置加入字符“$",然后原字符串中每两个字符加入一个"#" ...
- CCI_chapter 1
1.1Implement an algorithm to determine if a string has all unique characters What if you can not us ...
- AD 10 直接出 BOM 的漂亮效果
EDA 工具出BOM 需要什么格式,太多人费尽心思在代码级别做了很多工作,,,,,,,不提,,,,, 真正的BOM 需要东西呢?大家可以讨论讨论.-附件是G41 一个小板的 demo BOM,由AD1 ...
- poj 2773 利用欧拉函数求互质数
题意:找到与n互质的第 k个数 开始一看n是1e6 敲了个暴力结果tle了,后来发现k达到了 1e8 所以需要用到欧拉函数. 我们设小于n的 ,与n互质的数为 (a1,a2,a3.......a(p ...
- Codeforces Round #327 (Div. 1) D. Top Secret Task
D. Top Secret Task time limit per test 3 seconds memory limit per test 256 megabytes input standard ...