lamp 搭建分离(apache2.2.31+mysql5.5.32+php5.3)
在服务器 192.168.37.128 上搭建 lamp(apache2.2.1+mysql5.5.32+php5.3)(mysql 只到 make install)
1)安装 apache2.2.31(在默认站点目录 htdocs)
[root@localhost ~]# mkdir /apache
rz 上传 apache 包
[root@localhost ~]# cd /apache/
[root@localhost apache]# ls
httpd-2.2.31.tar.gz
[root@localhost apache]# yum -y install gcc gcc-c++ #安装编译工具
[root@localhost apache]# yum -y install zlib zlib-devel #安装依赖包,否则报下面错误:
checking for zlib location... not found
checking whether to enable mod_deflate... configure: error: mod_deflate has been requested but can not
be built due to prerequisite failures
[root@localhost apache]#useradd apache -s /sbin/nologin -M
[root@localhost apache]# tar -zxf httpd-2.2.31.tar.gz #安装 apache
[root@localhost apache]# ls
httpd-2.2.31 httpd-2.2.31.tar.gz
[root@localhost apache]# cd httpd-2.2.31
[root@localhost httpd-2.2.31]# ls
ABOUT_APACHE BuildBin.dsp configure.in httpd.mak LAYOUT Makefile.in os server
acinclude.m4 buildconf docs httpd.spec libhttpd.dep Makefile.win README srclib
Apache.dsw CHANGES emacs-style include libhttpd.dsp modules README.platforms support
build config.layout httpd.dep INSTALL libhttpd.mak NOTICE README-win32.txt test
BuildAll.dsp configure httpd.dsp InstallBin.dsp LICENSE NWGNUmakefile ROADMAP VERSIONING
[root@localhost httpd-2.2.31]#./configure --prefix=/usr/local/apache \
--enable-deflate \
--enable-expires \
--enable-headers \
--enable-modules=most \
--enable-so \
--with-mpm=worker \
--enable-rewrite
回车
[root@localhost httpd-2.2.31]# make && make install
[root@localhost httpd-2.2.31]# ls /usr/local/apache/
bin build cgi-bin conf error htdocs icons include lib logs man manual modules
[root@localhost httpd-2.2.31]# /usr/local/apache/bin/apachectl start
httpd: Could not reliably determine the server's fully qualified domain name, using
localhost.localdomain for ServerName
[root@localhost httpd-2.2.31]# cat /usr/local/apache/conf/httpd.conf
User apache #修改成 apache 用户
Group apache #修改成 apahce 组
<Directory "/usr/local/apache/htdocs">
Options -Indexes FollowSymLinks //修改,前面加-,优化措施
……
Include conf/extra/httpd-vhosts.conf //注释不要打开,如果打开,就需要在后面文件中配置虚拟主机
[root@localhost httpd-2.2.31]# chown -R apache.apache /usr/local/apache/htdocs/
[root@localhost httpd-2.2.31]# /usr/local/apache/bin/apachectl graceful
httpd: Could not reliably determine the server's fully qualified domain name, using
localhost.localdomain for ServerName
[root@localhost httpd-2.2.31]# netstat -anptu |grep httpd
tcp 0 0 :::80 :::* LISTEN 57131/httpd
2)安装 mysql5.5.32
[root@localhost httpd-2.2.31]# cd
[root@localhost ~]# mkdir /mysql
上传 mysql 包
[root@localhost ~]# cd /mysql/
[root@localhost mysql]# ls
cmake-2.8.8.tar.gz mysql-5.5.32.tar.gz
[root@localhost mysql]# useradd mysql -M -s /sbin/nologin
a)先安装 cmake,并安装最后提示运行 gmake 方式来安装 cmake 软件
[root@localhost mysql]# tar -zxf cmake-2.8.8.tar.gz
[root@localhost mysql]# ls
cmake-2.8.8 cmake-2.8.8.tar.gz mysql-5.5.32.tar.gz
[root@localhost mysql]# cd cmake-2.8.8
[root@localhost cmake-2.8.8]# ls
bootstrap CMakeLists.txt CTestConfig.cmake doxygen.config Tests
ChangeLog.manual CMakeLogo.gif CTestCustom.cmake.in Example Utilities
ChangeLog.txt cmake_uninstall.cmake.in CTestCustom.ctest.in Modules
CMakeCPack.cmake CompileFlags.cmake DartConfig.cmake Readme.txt
CMakeCPackOptions.cmake.in configure DartLocal.conf.in Source
CMakeGraphVizOptions.cmake Copyright.txt Docs Templates
[root@localhost cmake-2.8.8]# ./configure
……
CMake has bootstrapped. Now run gmake. #提示运行 gmake ,可能 make 也行,没试过
[root@localhost cmake-2.8.8]# gmake
[root@localhost cmake-2.8.8]# gmake install
[root@localhost cmake-2.8.8]# cd ..
[root@localhost mysql]# ls
cmake-2.8.8 cmake-2.8.8.tar.gz mysql-5.5.32.tar.gz
b)安装 mysql 依赖包:
[root@localhost mysql]# yum -y install ncurses-devel
c)用 cmake 软件包安装 mysql5.5:
[root@localhost mysql]# groupadd mysql
[root@localhost mysql]# useradd mysql -s /sbin/nologin -M -g mysql
[root@localhost mysql]# ls
cmake-2.8.8 cmake-2.8.8.tar.gz mysql-5.5.32.tar.gz
[root@localhost mysql]# tar -zxf mysql-5.5.32.tar.gz
[root@localhost mysql]# ls
cmake-2.8.8 cmake-2.8.8.tar.gz mysql-5.5.32 mysql-5.5.32.tar.gz