1、解压tar.gz为后缀的压缩包软件
LAMP环境搭建所需要的每个软件的源代码文件,都是以.tar.gz提供给我们的打包压缩文件,所以我们必须将其解压再解包。
批量解压命令:for i in `ls ./`;do tar -xf $i;done
在linux系统中源代码包安装过程
进行解压后的目录,LAMP环境搭建所需要的软件都使用C语言开发的,所以安装源代码文件最少需要配置(configure)、编译(make)、安装(make install)三个步骤。
2、安装libtools
./configure
make && make install && echo OK
3、安装libxml2最新库文
./configure --prefix=/usr/local/libxml2
make && make install && echo OK
注:解析报错信息为:/bin/rm: cannot remove `libtoolT': No such file or directory
解决方法:这时直接打开 configure,把 $RM “$cfgfile” 那行删除掉,重新再运行 ./configure 就可以了。
8、安装freetype最新库文件
cd /usr/local/src/freetype-2.5.3/builds/unix
./configure --prefix=/usr/local/freetype
cd -
make && make install && echo OK
9、安装atuoconf最新的库文件
./configure --prefix=/usr/local/autoconf
make && make install && echo OK
10、安装最新的GD库文件
./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/jpeg8/ --with-png=/usr/local/libpng/ --with-freetype=/usr/local/freetype/ --with-zlib=/usr/local/zlib/
make && make install && echo OK
b. 安装apr 、apr-util
./configure --prefix=/usr/local/apr-httpd/ && make && make install
./configure --prefix=/usr/local/apr-util-httpd/ --with-apr=/usr/local/apr-httpd/ && make && make install
c、安装pcre
./configure --prefix=/usr/local/pcre
make && make install && echo OK
提示信息:
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message
解决方案:
vi /etc/httpd/httpd.conf
加上下面一行,重启apache
ServerName localhost:8
2、将程序二进制的所有权改为root用户,数据目录的所有权改为运行mysqld程序的mysql用户。如果现在位于安装目录(/usr/local/mysql)下,命令行如下:
[iyunv@localhost mysql]# chown -R root .(注意有点) //将文件的所有属性改为root用户
[iyunv@localhost mysql]# chown -R mysql var //将数据目录的所有属性改为mysql用户
[iyunv@localhost mysql]# chgrp -R mysql . //将组属性改为mysql组
[iyunv@localhost mysql]# ls -l
total 40
drwxr-xr-x. 2 root mysql 4096 Feb 7 20:50 bin
drwxr-xr-x. 3 root mysql 4096 Feb 7 20:50 include
drwxr-xr-x. 2 root mysql 4096 Feb 7 20:50 info
drwxr-xr-x. 3 root mysql 4096 Feb 7 20:50 lib
drwxr-xr-x. 2 root mysql 4096 Feb 7 20:50 libexec
drwxr-xr-x. 3 root mysql 4096 Feb 7 20:50 man
drwxr-xr-x. 7 root mysql 4096 Feb 7 20:50 mysql-test
drwxr-xr-x. 3 root mysql 4096 Feb 7 20:50 share
drwxr-xr-x. 5 root mysql 4096 Feb 7 20:50 sql-bench
drwx------. 4 mysql mysql 4096 Feb 7 20:53 var
3、在所需要的东西被安装完成后,应当使用下面的命令启动MySQL服务了,命令行如下:
[iyunv@localhost mysql]#/usr/local/mysql/bin/mysqld_safe --user=mysql &
报告信息(不理会):
[iyunv@localhost mysql]# /usr/local/mysql/bin/mysqld_safe --user=mysql &
[1] 4720
[iyunv@localhost mysql]# nohup: ignoring input and redirecting stderr to stdout
Starting mysqld daemon with databases from /usr/local/mysql/var
5、使用mysqladmin验证服务器在运行中。以下命令提供了简单的测试,可检查服务器是否已经开启并能响应连接。命令行如下:
[iyunv@localhost mysql]# bin/mysqladmin version
Enter password:
bin/mysqladmin Ver 8.41 Distrib 5.0.18, for pc-linux-gnu on i686
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license
Server version 5.0.18-log
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /tmp/mysql.sock
Uptime: 18 min 59 sec
Threads: 1 Questions: 3 Slow queries: 0 Opens: 0 Flush tables: 1 Open tables: 6 Queries per second avg: 0.003
[iyunv@localhost mysql]# bin/mysql -u root //没有密码可直接登录本机服务器
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5 to server version: 5.0.18-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
如果有匿名账户存在,它拥有全部的权限,因此删掉它可以提高安全,在mysql客户端执行SQL语如下:
mysql> delete from mysql.user where host='localhost' and user='';
Query OK, 1 row affected (0.01 sec)
[iyunv@localhost mysql]# bin/mysql -u root -h localhost -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6 to server version: 5.0.18-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
如果想关闭mysql服务器,在命令行使用mysql服务器的mysqladmin命令,通过-u参数给出mysql数据库管理员用户名root和通过-p参数给出密码,即可关闭mysql服务器。如下示:
[iyunv@localhost mysql]# bin/mysqladmin -u root -p shutdown
Enter password:
STOPPING server from pid file /usr/local/mysql/var/localhost.pid
130207 21:27:05 mysqld ended
[1]+ Done /usr/local/mysql/bin/mysqld_safe --user=mysql
注:报错信息:
If configure fails try --with-vpx-dir=<DIR> configure: error: jpeglib.h not found.
解决方法:
yum -y install libjpeg-devel
重新./configure
make(配置)
提示信息:
Build complete.
Don't forget to run 'make test'.
解决方案:
不要make test 直接make install
配置时可能会出现下面的错误:
checking for MySQL support... yes
checking for specified location of the MySQL UNIX socket... no
checking for MySQL UNIX socket location... no
configure: error: Cannot find libmysqlclient_r under /usr/local/mysql. Note that the MySQL client library is not bundled anymore!
我的GD安装在/usr/local/gd2目录下,所以是#vi vi /usr/local/gd/include/gd_io.h
libltdl.so.3: cannot open shared object file: No such file or directory
make: *** [ext/phar/phar.php] Error 127
可以看到libpng15.so.15
然后修改/etc/ld.so.conf 文件:vi /etc/ld.so.conf
在第一行下面追加/usr/local/libpng/lib这个路径。
然后重新编译安装即可。
提示信息:
=====================================================================
=====================================================================
WARNED TEST SUMMARY
---------------------------------------------------------------------
Bug #52062 (large timestamps with DateTime::getTimestamp and DateTime::setTimestamp) (32 bit) [ext/date/tests/bug52062.phpt] (warn: XFAIL section but test passes)
=====================================================================
You may have found a problem in PHP.
This report can be automatically sent to the PHP QA team at http://qa.php.net/reports and http://news.php.net/php.qa.reports
This gives us a better understanding of PHP's behavior.
If you don't want to send the report immediately you can choose
option "s" to save it. You can then email it to qa-reports@lists.php.net later.
Do you want to send this report now? [Yns]:
如下示:
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php .phtml