lamp搭建(apache2.2.31+mysql5.1.72+php5.3)
如果对运维课程感兴趣,可以在b站上、csdn或微信视频号 上搜索我的账号: 运维实战课程,可以关注我,学习更多免费的运维实战技术视频
在服务器192.168.37.128上搭建lamp(apache2.2.1+mysql5.1.72+php5.3)
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.1.72
[root@localhost httpd-2.2.31]# cd
[root@localhost ~]# mkdir /mysql
上传mysql包
[root@localhost ~]# cd /mysql/
[root@localhost mysql]# ls
mysql-5.1.72.tar.gz
[root@localhost mysql]# useradd mysql -M -s /sbin/nologin
[root@localhost mysql]# yum -y install ncurses-devel #安装mysql依赖包,否则报下面错误
checking for termcap functions library... configure: error: No curses/termcap library found
[root@localhost mysql]# tar -zxf