Centos6.5 源码安装LAMP

z开始安装之前卸载预装的httpd、MySQL、php。

 root账户下执行rpm -qa|grep http    rpm -qa|grep mysql     rpm -qa|grep php,检查是否有预装的httpd、mysql、php。

执行rpm -e --nodeps 命令,卸载预装的软件。


准备工作:

  1. yum install wget gcc gcc-c++ make re2c curl curl-devel libxml2 libxml2-devel libjpeg libjpeg-devel libpng libpng-devel libmcrypt libmcrypt-devel zlib zlib-devel openssl openssl-devel freetype freetype-devel gd gd-devel perl perl-devel ncurses ncurses-devel bison bison-devel libtool gettext gettext-devel cmake bzip2 bzip2-devel pcre pcre-devel
    1. tar zxvf apr-1.5.2.tar.gz
    2. tar zxvf apr-util-1.5.4.tar.gz
    3. tar zxvf httpd-2.4.12.tar.gz

  2. 移动Apr、Apr-util到httpd的srclib文件夹下mv apr-1.5.2 httpd-2.4.12/srclib/apr mv apr-util-1.5.4 httpd-2.4.12/srclib/apr-util
  3. 进入httpd的目录
    1. cd httpd-2.4.7
      1. ./configure--prefix=/usr/local/apache--sysconfdir=/etc/httpd--with-z--with-included-apr--enable-so--enable-deflate=shared--enable-expires=shared--enable-rewrite=shared--enable-static-support--enable-authn-dbm=shared--enable-cache--enable-file-cache--enable-mem-cache--enable-disk-cache--enable-mods-shared=all--enable-ssl--enable-cgi
      2. make && make instal
5.           添加环境变量    
  1. PATH=/usr/local/apache/bin:$PATH
  2. export PATH
  3. source /etc/profile
6. 重启Apache
  1. service httpd start
  2. 添加开机启动 chkconfig httpd on
7. 安装MySQL
解压mysql-5.6.16.tar.gz,并进入mysql-t.6.16目录
执行cmake-DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DMYSQL_DATADIR=/data/mysql_data-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock-DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
编译并安装 make && make install
添加mysql用户
  1. useradd -s /sbin/nologin mysql
  2. 赋予权限
chown-R mysql:mysql/usr/local/mysql mysql的安装目录
chown-R mysql:mysql/usr/local/mysql/data 数据库目录
3.进入安装目录
  1. cd /usr/local/mysql/scripts/
  2. 数据库初始化:
    1. ./mysql_install_db--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data--user=mysql

4、放置已存在的my.cnf影响数据库的安装     
  1. mv /etc/my.cnf/etc/my.cnf.old
  2. cp /usr/local/mysql/my.cnf/etc/
5、赋值启动脚本
  1. cp /usr/local/mysql/support-files/mysql.server/etc/init.d/mysqld
6、环境变量
  1. PATH=/usr/local/mysql/bin:$PATH
  2. export PATH
7、mysql初始化
  1. mysql_secure_installation
8、安装php
  1. tar zxvf php-5.5.6.tar.gz
  2. cd php-5.5.6
    1. ./configure --prefix=/opt/php --with-config-file-path=/etc --enable-opcache --enable-fpm --with-fpm-user=kcsoft --with-fpm-group=kcsoft --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-curl --enable-mbstring=all --with-iconv --with-mhash --with-mcrypt --with-gd --with-openssl --enable-sockets --with-gettext --with-zlib --enable-zip --enable-soap --with-apxs2=/opt/apache/bin/apxs --with-libxml-dir --with-png-dir --with-jpeg-dir --with-freetype-dir --enable-ftp --with-xmlrpc
    2. make && make install
    3. 环境变量
      1. PATH=/opt/php/bin:$PATH
      2. export PATH
      3. cp php-5.5.6/php.ini-production/etc/php.ini
      4. vi etc/httpd/httpd.conf
      5. 找到
        1. AddType application/x-gzip.gz.tgz
        2. 添加AddType application/x-httpd-php.php
        3. DirectoryIndex index.html后面添加index.php

      6. 写phpinfo页面,进行测试。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值