linux下apache、mysql、php安装配置详细笔记

软件准备:
mysql-5.0.56.tar.gz
http://dev.mysql.com/get/Downloads/


httpd-2.2.12.tar.gz
http://labs.xiaonei.com/apache-mirror/httpd/


php-5.3.0.tar.gz
http://cn.php.net/get/php-5.3.0.tar.gz/from/this/mirror


一、安装MYSQL


复制代码 代码如下:

groupadd mysql                               #添加一个MYSQL组
useradd -g mysql mysql                       #添加一个用户到MYSQL组中
tar zxvf mysql-5.0.56.tar.gz
cd mysql-5.0.56
cat README | less                            #查看使用文档
cat INSTALL-SOURCE | less                    #查看安装说明
./configure –help                           #查看配置帮助
./configure –prefix=/usr/local/mysql5 –enable-thread-safe-client –with-charset=utf8 
                                             #set:设置安装目录,客户端支持线程,设置字体为utf8
                                             #–enable-thread-safe-client 若不开启,编译PHP时会遇到问题
make                                         #编译
make install                                 #安装
cp support-files/my-medium.cnf /etc/my.cnf   #拷贝默认配置文件
scripts/mysql_install_db –user=mysql        #初始化:一定是解压编译后的目录中才有mysql_install_db文件.
cd /usr/local/mysql                          #进入安装目录
chown -R root  .                             #给mysql5目录赋予root权限.
chown -R mysql var                           #给var目录赋予mysql权限
chgrp -R mysql .                             #给mysql5目录赋予mysql组权限
bin/mysqld_safe –user=mysql &               #启动MYSQL服务.
bin/mysql                                    #进入MYSQL操作
mysql> grant all on *.* to root@’192.168.%’ identified by ‘password’;   #设置root可管理的网段及密码
mysql> flush privileges;                                                #刷新生效.
ps: 大家可以自行修改my.cnf文件来优化MYSQL


二、安装APACHE


复制代码 代码如下:

tar zxvf httpd-2.2.12.tar.gz
cd httpd-2.2.12
vi server/mpm/worker/worker.c                #修改源文件连接数
#define DEFAULT_SERVER_LIMIT 16              #默认子进程数
#define MAX_SERVER_LIMIT 20000               #最大子进程数
#define DEFAULT_THREAD_LIMIT 64              #默认链接线程数
#define MAX_THREAD_LIMIT 20000               #最大链接线程数
####以上配置可根据自己的服务器配置修改默认值的大小.
cat README | less                            #查看使用文档
cat INSTALL | less                           #查看安装说明
./configure –help                           #查看配置帮助
./configure /
–prefix=/usr/local/apache2 /
–enable-module=’most’                       #装一些默认常用的
–enable-mods-shared=”all”                   #全部共享.
–enable-file-cache                          #文件缓存.
–enable-cache                               #缓存
–enable-disk-cache                          #硬盘缓存
–enable-mem-cache                           #内存缓存
–enable-headers                             #http头控制模块
–enable-expires                             #过期头控制模块
–enable-proxy                               #apache代理模块
–enable-proxy-balancer                      #apache代理均衡模块
–enable-ssl                                 #HTTPS
–enable-rewrite                             #rewrite
–enable-so                                  #兼容性
–with-mpm=worker
make                                    #编译
make install                        #安装


三、安装PHP扩展LIB库


复制代码 代码如下:

gd-2.0.35.tar.gz
jpegsrc.v7.tar.gz
libpng-1.4.0beta73.tar.gz
libxml2-sources-2.7.3.tar.gz
libxslt-1.1.24.tar.gz
zlib-1.2.3.tar.gz                            #直接./configure && make && make install 即可  默认lib目录安装都在 /usr/local/lib 下.


四、安装PHP


复制代码 代码如下:

tar zxvf php-5.3.0.tar.gz
cd php-5.3.0
cat README | less                            #查看使用文档
cat INSTALL | less                           #查看安装说明
./configure –help                           #查看配置帮助
./configure /
–prefix=/usr/local/php5 /
–with-apxs2=/usr/local/apache2/bin/apxs /   #你的APACHE安装路径apxs是一个apache安装配置时生成的一个小小的perl脚本。它可以使象resin这种模块获得apache所有的配置路径。
–with-mysql=/usr/local/mysql5 /             #MYSQL安装路径
–enable-ftp /                               #开启FTP模块
–enable-debug /                             #开启DEBUG
–enable-mbstring /                          #打开mbstring
–enable-mbregex /                           #正则
–with-gd=/usr/local /                       #gd库
–with-png-dir=/usr/local/lib /              #png
–with-zlib-dir=/usr/local/lib /             #zlib
–with-jpeg-dir=/usr/local/lib /             #jpeg
–enable-libxml /
–with-libxml-dir=/usr/local/lib /           #libxml扩展
#–with-xsl=/usr/local/lib /                  #xslt扩展
–enable-pdo /
–with-pdo-sqlite /
–with-pdo-mysql=/usr/local/mysql5/bin/mysql_config /         #pdo
–enable-soap /                              #soap服务扩展
–enable-sockets /                           #sockets扩展
–with-xmlrpc                                #xmlrpc扩展
–with-config-file-path=/etc                 #设置PHP.INI存放位置
./configure –prefix=/usr/local/php5 –with-apxs2=/usr/local/apache2/bin/apxs –with-mysql=/usr/local/mysql5
–enable-ftp –enable-debug –enable-mbstring –enable-mbregex –with-gd=/usr/local
–with-png-dir=/usr/local/lib –with-zlib-dir=/usr/local/lib –with-jpeg-dir=/usr/local/lib
–enable-libxml –with-libxml-dir=/usr/local/lib –enable-pdo –with-pdo-sqlite
–with-pdo-mysql=/usr/local/mysql5/bin/mysql_config –enable-soap
–enable-sockets –with-xmlrp
make
make install


配置APACHE和PHP、MYSQL启动
自动启动MYSQL


复制代码 代码如下:

cp /usr/local/mysql5/share/mysql/mysql.server /etc/init.d/mysqld
ln -s /etc/init.d/mysqld /etc/rc3.d/Kmysqld
ln -s /etc/init.d/mysqld /etc/rc3.d/Smysqld
service mysqld start
/usr/local/apache2/bin/apachectl start

原创文章,作者:kepupublish,如若转载,请注明出处:https://blog.ytso.com/234383.html

(0)
上一篇 2022年1月23日
下一篇 2022年1月23日

相关推荐

发表回复

登录后才能评论