64位CentOS6.0下怎么搭建LAMP环境


本文小编为大家详细介绍“64位CentOS6.0下怎么搭建LAMP环境”,内容详细,步骤清晰,细节处理妥当,希望这篇“64位CentOS6.0下怎么搭建LAMP环境”文章能帮助大家解决疑惑,下面跟着小编的思路慢慢深入,一起来学习新知识吧。1、确认搭建lamp所需要的环境是否已经安装[root@centos6 ~]# rpm -q make gcc gcc-c++zlib-devellibaio备注:安装libpng时候需要zlib-devel安装mysql时候需要libaio2、如果没安装则yum安装[root@centos6 ~]# yum install make gcc gcc-c++zlib-devel libaio -y3、由于要使用编译安装,所以查看httpd、mysql、php是否安装,如果安装则卸载[root@centos6 ~]# rpm -q httpd mysql php4、编译安装libxml2注:libxml2是一个xml的c语言版的解析器,不仅支持c语言,还支持c++、php、pascal、ruby、tcl等语言的绑定[root@centos6 lamp]# pwd/tmp/lamp[root@centos6 lamp]# tar -zxvf libxml2-2.7.8.tar.gz[root@centos6 lamp]# cd ./libxml2-2.7.8[root@centos6 libxml2-2.7.8]# ./configure –prefix=/usr/local/libxml2/[root@centos6 libxml2-2.7.8]# make;make install5、编译安装libmcrypt注:libmcrypt是加密算法扩展库。支持des, 3des, rijndael, twofish, idea, gost, cast-256, arcfour, serpent, safer+等算法。[root@centos6 lamp]# pwd/tmp/lamp[root@centos6 lamp]# tar -zxvf libmcrypt-2.5.8.tar.gz[root@centos6 lamp]# cd ./libmcrypt-2.5.8[root@centos6 libmcrypt-2.5.8]# ./configure –prefix=/usr/local/libmcrypt/[root@centos6 libmcrypt-2.5.8]# make;make install6、编译安装zlib注:zlib是提供数据压缩用的函式库[root@centos6 lamp]# pwd/tmp/lamp[root@centos6 lamp]# tar -zxvf zlib-1.2.5.tar.gz[root@centos6 lamp]# cd ./zlib-1.2.5[r免费云主机域名oot@centos6 zlib-1.2.5]# ./configure –prefix=/usr/local/zlib/[root@centos6 zlib-1.2.5]# make ; make install7、编译安装libpng[root@centos6 lamp]# pwd/tmp/lamp[root@centos6 lamp]# tar -zxvf libpng-1.5.4.tar.gz[root@centos6 lamp]# cd ./libpng-1.5.4[root@centos6 libpng-1.5.4]#./configure –prefix=/usr/local/libpng/ –enable-shared[root@centos6 libpng-1.5.4]# make ; make install8、编译安装jpeg[root@centos6 lamp]# pwd/tmp/lamp[root@centos6 lamp]# tar -zxvf jpegsrc.v8c.tar.gz[root@centos6 lamp]# cd ./jpeg-8c/[root@centos6 jpeg-8c]# mkdir /usr/local/jpeg/(创建jpeg软件的安装目录)[root@centos6 jpeg-8c]# mkdir /usr/local/jpeg/bin/(创建存放命令的目录)[root@centos6 jpeg-8c]# mkdir /usr/local/jpeg/lib/(创建jpeg库文件所在目录)[root@centos6 jpeg-8c]# mkdir /usr/local/jpeg/include/(创建存放头文件目录)[root@centos6 jpeg-8c]# mkdir -p /usr/local/jpeg/man/man1(建立存放手册的目录)[root@centos6 jpeg-8c]#./configure –prefix=/usr/local/jpeg/ –enable-shared –enable-static建立共享库使用的gnu的libtool和静态库使用的gnu的libtool)[root@centos6 jpeg-8c]# make ; make install9、编译安装freetype[root@centos6 lamp]# pwd/tmp/lamp[root@centos6 lamp]# tar -zxvf freetype-2.4.6.tar.gz[root@centos6 lamp]# cd ./freetype-2.4.6[root@centos6 freetype-2.4.6]#./configure –prefix=/usr/local/freetype/ –enable-shared[root@centos6 freetype-2.4.6]# make ;make install10、编译安装autoconf[root@centos6 lamp]# pwd/tmp/lamp[root@centos6 lamp]# tar -zxvf autoconf-2.68.tar.gz[root@centos6 lamp]# cd ./autoconf-2.68[root@centos6 autoconf-2.68]# ./configure[root@centos6 autoconf-2.68]# make ; make install11、编译安装gd[root@centos6 lamp]# pwd/tmp/lamp[root@centos6 lamp]# tar -zxvf gd-2.0.35.tar.gz[root@centos6 lamp]# cd ./gd-2.0.35[root@centos6 gd-2.0.35]#./configure –prefix=/usr/local/gd/ –with-zlib=/usr/local/zlib/ –with-jpeg=/usr/local/jpeg/ –with-png=/usr/local/libpng/ –with-freetype=/usr/local/freetype/[root@centos6 gd-2.0.35]# make ; make install12、安装apache[root@centos6 lamp]# pwd/tmp/lamp[root@centos6 lamp]# tar -zxvf httpd-2.2.19.tar.gz[root@centos6 lamp]# cd ./httpd-2.2.19[root@centos6 httpd-2.2.19]#./configure –prefix=/usr/local/apache/ –enable-so –enable-rewrite[root@centos6 httpd-2.2.19]# make ; make install[root@centos6 lamp]# /usr/local/apache/bin/apachectl start[root@centos6 lamp]#cp /usr/local/apache/bin/apachectl /etc/init.d/httpd[root@centos6 lamp]# chmod +x /etc/init.d/httpd[root@centos6 ~]# chkconfig –add httpd注意:如果提示servicehttpddoes not support chkconfig错误解决办法:编辑/etc/rc.d/init.d/httpd在文件第二行加入 #chkconfig:234510 90 #description:activates/deactivates apache web server[root@centos6 ~]# chkconfig –level 2345 httpd on[root@centos6 lamp]# service httpd restart开机自动启动apache的另一种方法:修改/etc/rc.local文件# vim /etc/rc.local在文件中添加/usr/local/apache/bin/apachectl start13、编译安装mysql[root@centos6 lamp]# pwd/tmp/lamp[root@centos6 lamp]# tar -zxvf mysql-5.5.15-linux2.6-x86_64.tar.gz[root@centos6 lamp]# cd ./mysql-5.5.15-linux2.6-x86_64[root@centos6 mysql-5.5.15-linux2.6-x86_64]# groupadd mysql[root@centos6 mysql-5.5.15-linux2.6-x86_64]# useradd -r -g mysql mysql(创建mysql用户,并将用户指定至mysql组)[root@centos6 mysql-5.5.15-linux2.6-x86_64]# cd /usr/local/[root@centos6 local]# ln -s /tmp/lamp/mysql-5.5.15-linux2.6-x86_64 mysql[root@centos6 local]# cd ./mysql/[root@centos6 mysql]# chown -r mysql .(将该目录的用户权限全部更改为mysql用户)[root@centos6 mysql]# chgrp -r mysql .(将该目录的用户组全部改为mysql用户组)[root@centos6 mysql]# ./scripts/mysql_install_db –user=mysql(将mysql目录的数据库使用权限指定为mysql)[root@centos6 mysql]# chown -r root .[root@centos6 mysql]# chown -r mysql data[root@centos6 mysql]# cp support-files/my-medium.cnf /etc/my.cnf(将当前目录下的配置文件拷贝到系统配置文件下,并更名为my.cnf)[root@centos6 mysql]# cp support-files/mysql.server /etc/init.d/mysqld[root@centos6 mysql]# chmod +x /etc/init.d/mysqld[root@centos6 mysql]# chkconfig –add mysqld[root@centos6 mysql]# chkconfig –level 345 mysqld on[root@centos6 mysql]# servicemysqld restart[root@centos6 mysql]#/usr/local/mysql/bin/mysqladmin -u root password ‘123456’(设置root用户登录mysql的密码)[root@centos6 mysql]# /usr/local/mysql/bin/mysql -u root –p(进入并访问mysql数据)enter password:welcome to the mysql monitor.commands end with ; or g.your mysql connection id is 2server version: 5.5.15-log mysql community server (gpl)copyright (c) 2000, 2010, oracle and/or its affiliates. all rights reserved.oracle is a registered trademark of oracle corporation and/or itsaffiliates. other names may be trademarks of their respectiveowners.type ‘help;’ or ‘h’ for help. type ‘c’ to clear the current input statement.mysql>(成功登录mysql)14、编译安装php[root@centos6 lamp]# pwd/tmp/lamp[root@centos6 lamp]# tar -zxvf php-5.3.7.tar.gz[root@centos6 lamp]# cd ./php-5.3.7[root@centos6 php-5.3.7]#./configure –prefix=/usr/local/php/ –with-apxs2=/usr/local/apache/bin/apxs –with-libxml-dir=/usr/local/libxml2/ –with-jpeg-dir=/usr/local/jpeg/ –with-freetype-dir=/usr/local/freetype/–with-gd-dir=/usr/local/gd/–with-zlib-dir=/usr/local/zlib/–with-mcrypt=/usr/local/libmcrypt/–with-mysqli=/usr/local/mysql/bin/mysql_config –enable-soap –enable-mbstring=all –enable-sockets[root@centos6 php-5.3.7]# make ; make install[root@centos6 php-5.3.7]#cp php.ini-development /usr/local/php/lib/php.ini#vim/usr/local/php/lib/php.ini//这里需要将register_globals=off更改on模式,还有时间格式改为本地15、更改apache的配置文件,达到解析php文件的目的[root@centos6 ~]# vim /usr/local/apache/conf/httpd.confaddtype application/x-compress .zaddtype application/x-gzip .gz .tgzaddtype application/x-httpd-php .php .phtml addtype application/x-httpd-php-source .phps添加上面绿色内容,表示apache服务中可以解析php格式文件接下来要检查apache目录下生成的php动态连接库文件,在目录/usr/local/apache/modules,找到是否存在libphp5.so文件16、验证[root@centos6 ~]# vim /usr/local/apache/htdocs/index.php 添加内容为

echo phpinfo();?>读到这里,这篇“64位CentOS6.0下怎么搭建LAMP环境”文章已经介绍完毕,想要掌握这篇文章的知识点还需要大家自己动手实践使用过才能领会,如果想了解更多相关内容的文章,欢迎关注百云主机行业资讯频道。

相关推荐: 怎么把Oracle数据库从RAC集群迁移到单机环境

这篇文章主要介绍了怎么把Oracle数据库从RAC集群迁移到单机环境的相关知识,内容详细易懂,操作简单快捷,具有一定借鉴价值,免费云主机域名相信大家阅读完这篇怎么把Oracle数据库从RAC集群迁移到单机环境文章都会有所收获,下面我们一起来看看吧。1、源数据库…

免责声明:本站发布的图片视频文字,以转载和分享为主,文章观点不代表本站立场,本站不承担相关法律责任;如果涉及侵权请联系邮箱:360163164@qq.com举报,并提供相关证据,经查实将立刻删除涉嫌侵权内容。

(0)
打赏 微信扫一扫 微信扫一扫
上一篇 04/11 22:36
下一篇 04/11 22:36

相关推荐