Chinaunix首页 | 论坛 | 博客
  • 博客访问: 5851
  • 博文数量: 6
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 70
  • 用 户 组: 普通用户
  • 注册时间: 2016-11-21 16:50
文章分类

全部博文(6)

文章存档

2016年(6)

我的朋友
最近访客

分类: LINUX

2016-11-23 15:13:01

1)首先安装SQL
版本 5.095编译过的
sql下载地址:

tar -zxvf mysql-5.0.95-linux-x86_64-glibc23.tar.gz

解压下载的源文件


mv mysql-5.0.95-linux-x86_64-glibc23 /usr/local/mysql

移动文件夹到目标目录


cd /usr/local/mysql/

说明:移动到mysql文件夹下面


useradd -s /sbin/nologin  mysql

说明:创建一个mysql用户 –S 参数代表不让此用户登录系统


mkdir -p /data/mysql

创建数据库安装目录  -p参数说明创建目录及连目录


chown -R mysql:mysql /data/mysql

设置目录主和组


./scripts/mysql_install_db --user=mysql --datadir=/data/mysql

初始化SQL数据库 

 参数说明

--user=mysql            定义数据库的所属主

--datadir=/data/mysql    定义数据库安装到哪里,建议放到大空间的分区


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

拷贝配置文件  说明my-large.cnf 预设文件 


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
需要修改的地方有
“datadir=/data/mysql” (前面初始化数据库时定义的目录)


把启动脚本加入系统服务项,并设定开机启动,启动mysql

[root@localhost mysql]# chkconfig --add mysqld

[root@localhost mysql]# chkconfig mysqld on

[root@localhost mysql]# service mysqld start


检查mysql是否启动的命令为:

[root@localhost mysql]# ps aux |grep mysqld


如果启动不了,请到 /data/mysql/ 下查看错误日志


 2.)安装Apache

wget 下载Apache  版本2.4.23


解压

[root@test111 src]# tar -zxvf httpd-2.4.23.tar.gz

 

[root@localhost src]# cd httpd-2.4.23


配置编译参数

[root@test111 httpd-2.4.23]# ./configure --prefix=/usr/local/apache2 --with-included-apr --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared  --with-pcre

--prefix 指定安装到哪里, --enable-so表示启用DSO  --enable-deflate=shared表示共享的方式编译deflate


出现错误

checking for cc... no

checking for gcc... no

configure: error: in `/usr/local/src/php-7.0.9':

configure: error: no acceptable C compiler found in $PATH

See `config.log' for more details

gcc 编译软件未安装的原因

yum install –y gcc



这里出现了一个错误:

configure: error: Bundled APR requested but not found at ./srclib/. Download and unpack the corresponding apr and apr-util packages to ./srclib/.

解决办法:

下载

wget

wget

tar -zxvf apr-1.5.2.tar.gz && cp -fr apr-1.5.2 ./httpd-2.4.23/srclib/apr

解压并复制到目标目录

tar -zxvf apr-util-1.5.4.tar.gz && cp -fr apr-util-1.5.4 ./httpd-2.4.23/srclib/apr-util

解压并复制到目标目录

 
错误

configure: error: pcre-config for libpcre not found. PCRE is required and available from

解决办法

yum install -y pcre-devel

结束后
echo $?

检查下执行结果

make

结束后
echo $?

检查下执行结果 值为0代表上个命令成功

make install
结束后
echo $?

检查下执行结果 值为0代表上个命令成功


 安装PHP

 下载PHP: wget

tar –zxvf php-7.0.9.tar.gz

cd php-7.0.9   解压并进到目录

编译参数
./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


出现错误

checking for pkg-config... /usr/bin/pkg-config

configure: error: Cannot find OpenSSL's

安装

yum install -y openssl-devel


出现错误

checking for BZip2 in default path... not found

configure: error: Please reinstall the BZip2 distribution

安装

yum install -y bzip2-devel


出现错误

If configure fails try --with-webp-dir=


configure: error: jpeglib.h not found

安装

yum install -y libjpeg-turbo-devel


出现错误

checking for jpeg_read_header in -ljpeg... yes

configure: error: png.h not found.

安装

yum install -y libpng-devel


出现错误

If configure fails try --with-xpm-dir=
configure: error: freetype-config not found.
安装yum install -y freetype-devel

出现错误
checking for mcrypt support... yes
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
解决办法一
1、安装第三方yum
wget
sh ./atomic
2、使用yum命令安装
yum  install  php-mcrypt  libmcrypt  libmcrypt-devel 

出现错误
checking libxml2 install dir... no
checking for xml2-config path...
configure: error: xml2-config not found. Please check your libxml2 installation.
缺少libxml2-devel 库文件
yum install -y libxml2-devel

看到这里就表示第一步完成
+--------------------------------------------------------------------+
| License:                                                               
| This software is subject to the PHP License, available in this                    
| distribution in the file LICENSE.  By continuing this installation                 
| process, you are bound by the terms of this license agreement.                  
| If you do not agree with the terms of this license, you must abort              
| the installation process at this point.                                        
+--------------------------------------------------------------------+
Thank you for using PHP.
可以echo $?检测执行结果,值为0代表上条命令执行成功



编译:[root@test111 php-7.0.9]# make
安装:[root@test111 php-7.0.9]# make install

拷贝配置文件:

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



Apache主配置文件为:/usr/local/apache2/conf/httpd.conf
vim /usr/local/apache2/conf/httpd.conf
找到: AddType application/x-gzip .gz .tgz在该行下面添加:
AddType application/x-httpd-php .php

找到:
DirectoryIndex index.html
将该行改为:
  DirectoryIndex index.html index.htm index.php

找到:#ServerName
修改为:ServerName localhost:80


测试
LAMP是否成功
启动apache之前先检验配置文件是否正确:
/usr/local/apache2/bin/apachectl –t
如果有错误,请继续修改httpd.conf, 如果是正确的则显示为Syntax OK“

启动
apache的命令为:
/usr/local/apache2/bin/apachectl start
查看是否启动:
[root@localhost ~]# netstat -lnp |grep httpd
tcp        0      0 :::80                       :::*   LISTEN      7667/httpd如果有显示这行,则启动了。 也可以使用curl命令简单测试:

[root@localhost ~]# curl localhost
It works!
只有显示这样才正确。

测试是否正确解析php:vim /usr/local/apache2/htdocs/1.php
写入:
    echo "php解析正常";
?>保存后,继续测试:
curl localhost/1.php看是否能看到如下信息:
[root@localhost ~]# curl localhost/1.php
php解析正常[root@localhost ~]#

补充内容:
有时候我们编译php的时候会出现以下错误:
make ***[libphp5.la] Error 1
处理方法:
安装两个rpm包#yum -y install libtool.i386 libtool-ltdl-devel.i386

clean下     #make clean
            #make



阅读(207) | 评论(0) | 转发(0) |
0

上一篇:没有了

下一篇:yum 出错1

给主人留下些什么吧!~~