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

2023年 4月 18日 41.5k 0

软件准备: 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 复制代码 代

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

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

php-5.3.0.tar.gzhttp://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.gzcd mysql-5.0.56cat 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.gzcd httpd-2.2.12vi 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=workermake                                    #编译make install                        #安装

三、安装PHP扩展LIB库

复制代码 代码如下:gd-2.0.35.tar.gzjpegsrc.v7.tar.gzlibpng-1.4.0beta73.tar.gzlibxml2-sources-2.7.3.tar.gzlibxslt-1.1.24.tar.gzzlib-1.2.3.tar.gz                            #直接./configure && make && make install 即可  默认lib目录安装都在 /usr/local/lib 下.

四、安装PHP

复制代码 代码如下:tar zxvf php-5.3.0.tar.gzcd php-5.3.0cat 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-xmlrpmakemake install

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

复制代码 代码如下:cp /usr/local/mysql5/share/mysql/mysql.server /etc/init.d/mysqldln -s /etc/init.d/mysqld /etc/rc3.d/Kmysqldln -s /etc/init.d/mysqld /etc/rc3.d/Smysqldservice mysqld start/usr/local/apache2/bin/apachectl start

相关文章

Oracle如何使用授予和撤销权限的语法和示例
Awesome Project: 探索 MatrixOrigin 云原生分布式数据库
下载丨66页PDF,云和恩墨技术通讯(2024年7月刊)
社区版oceanbase安装
Oracle 导出CSV工具-sqluldr2
ETL数据集成丨快速将MySQL数据迁移至Doris数据库

发布评论