侯体宗的博客
  • 首页
  • Hyperf版
  • beego仿版
  • 人生(杂谈)
  • 技术
  • 关于我
  • 更多分类
    • 文件下载
    • 文字修仙
    • 中国象棋ai
    • 群聊
    • 九宫格抽奖
    • 拼图
    • 消消乐
    • 相册

64位CentOS 6.0下搭建LAMP环境详细步骤

linux  /  管理员 发布于 7年前   160

1、确认搭建LAMP所需要的环境是否已经安装

[root@centos6 ~]# rpm -q make gcc gcc-c++ zlib-devel libaio备注:安装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[root@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注意:如果提示service httpd does not support chkconfig错误解决办法:编辑/etc/rc.d/init.d/httpd在文件第二行加入           #chkconfig:2345 10 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]# service mysqld 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 Cp(进入并访问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.conf AddType application/x-compress .Z AddType application/x-gzip .gz .tgz Addtype 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     添加内容为<?php    echo phpinfo();?>在客服端验证,出现下图说明php搭建成功


  • 上一条:
    linux服务器下LNMP安装与配置方法
    下一条:
    linux下实现web数据同步的四种方式(性能比较)
  • 昵称:

    邮箱:

    0条评论 (评论内容有缓存机制,请悉知!)
    最新最热
    • 分类目录
    • 人生(杂谈)
    • 技术
    • linux
    • Java
    • php
    • 框架(架构)
    • 前端
    • ThinkPHP
    • 数据库
    • 微信(小程序)
    • Laravel
    • Redis
    • Docker
    • Go
    • swoole
    • Windows
    • Python
    • 苹果(mac/ios)
    • 相关文章
    • 在Linux系统中使用Iptables实现流量转发功能流程步骤(0个评论)
    • vim学习笔记-入门级需要了解的一些快捷键(0个评论)
    • 在centos7系统中实现分区并格式化挂载一块硬盘到/data目录流程步骤(0个评论)
    • 在Linux系统种查看某一个进程所占用的内存命令(0个评论)
    • Linux中grep命令中的10种高级用法浅析(0个评论)
    • 近期文章
    • 智能合约Solidity学习CryptoZombie第三课:组建僵尸军队(高级Solidity理论)(0个评论)
    • 智能合约Solidity学习CryptoZombie第二课:让你的僵尸猎食(0个评论)
    • 智能合约Solidity学习CryptoZombie第一课:生成一只你的僵尸(0个评论)
    • 在go中实现一个常用的先进先出的缓存淘汰算法示例代码(0个评论)
    • 在go+gin中使用"github.com/skip2/go-qrcode"实现url转二维码功能(0个评论)
    • 在go语言中使用api.geonames.org接口实现根据国际邮政编码获取地址信息功能(1个评论)
    • 在go语言中使用github.com/signintech/gopdf实现生成pdf分页文件功能(0个评论)
    • gmail发邮件报错:534 5.7.9 Application-specific password required...解决方案(0个评论)
    • 欧盟关于强迫劳动的规定的官方举报渠道及官方举报网站(0个评论)
    • 在go语言中使用github.com/signintech/gopdf实现生成pdf文件功能(0个评论)
    • 近期评论
    • 122 在

      学历:一种延缓就业设计,生活需求下的权衡之选中评论 工作几年后,报名考研了,到现在还没认真学习备考,迷茫中。作为一名北漂互联网打工人..
    • 123 在

      Clash for Windows作者删库跑路了,github已404中评论 按理说只要你在国内,所有的流量进出都在监控范围内,不管你怎么隐藏也没用,想搞你分..
    • 原梓番博客 在

      在Laravel框架中使用模型Model分表最简单的方法中评论 好久好久都没看友情链接申请了,今天刚看,已经添加。..
    • 博主 在

      佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 @1111老铁这个不行了,可以看看近期评论的其他文章..
    • 1111 在

      佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 网站不能打开,博主百忙中能否发个APP下载链接,佛跳墙或极光..
    • 2016-11
    • 2017-07
    • 2017-10
    • 2017-11
    • 2018-01
    • 2018-02
    • 2020-03
    • 2020-04
    • 2020-05
    • 2020-06
    • 2021-02
    • 2021-03
    • 2021-04
    • 2021-06
    • 2021-07
    • 2021-08
    • 2021-09
    • 2021-10
    • 2021-11
    • 2021-12
    • 2022-01
    • 2022-03
    • 2022-04
    • 2022-08
    • 2022-11
    • 2022-12
    • 2023-01
    • 2023-02
    • 2023-03
    • 2023-06
    • 2023-07
    • 2023-10
    • 2023-12
    • 2024-01
    • 2024-04
    Top

    Copyright·© 2019 侯体宗版权所有· 粤ICP备20027696号 PHP交流群

    侯体宗的博客