zoukankan      html  css  js  c++  java
  • LAMP安装

    LAMP安装

    @(linux学习笔记)
    CentOS-6.7最小化安装
    Mysql-5.6.28二进制免编译包

    [root@bogon opt]# wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.28-linux-glibc2.5-x86_64.tar.gz
    [root@bogon opt]# tar zxvf mysql-5.6.28-linux-glibc2.5-x86_64.tar.gz -C /usr/local/src/
    [root@bogon opt]# mv /usr/local/src/mysql-5.6.28-linux-glibc2.5-x86_64/ /usr/local/mysql
    

    Httpd-2.4.18源码包

    [root@bogon opt]# wget http://mirrors.sohu.com/apache/httpd-2.4.18.tar.bz2
    [root@bogon opt]# tar jxvf httpd-2.4.18.tar.bz2 -C /usr/local/src/
    

    Php-5.6.3源码包

    [root@bogon opt]# wget http://mirrors.sohu.com/php/php-5.6.3.tar.bz2
    [root@bogon opt]# tar jxvf php-5.6.3.tar.bz2 -C /usr/local/src/
    

    处理错误 安装如下包:
    1、yum install epel-release
    2、yum install -y libxml2-devel openssl openssl-devel bzip2 bzip2-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libmcrypt-devel

    安装Mysql-5.6.28

    [root@bogon opt]# cd /usr/local/mysql/
    [root@bogon mysql]# grep mysql < /etc/passwd
    [root@bogon mysql]# useradd -M -s /sbin/nologin mysql   
    [root@bogon mysql]# grep mysql < /etc/passwd
    mysql:x:500:500::/home/mysql:/sbin/nologin
    [root@bogon mysql]# chown -R mysql:mysql .
    [root@bogon mysql]# ll
    总用量 172
    drwxr-xr-x  2 mysql mysql   4096 12月 17 22:14 bin
    -rw-r--r--  1 mysql mysql  17987 11月 16 17:38 COPYING
    drwxr-xr-x  3 mysql mysql   4096 12月 17 22:14 data
    drwxr-xr-x  2 mysql mysql   4096 12月 17 22:14 docs
    drwxr-xr-x  3 mysql mysql   4096 12月 17 22:14 include
    -rw-r--r--  1 mysql mysql 105684 11月 16 18:45 INSTALL-BINARY
    drwxr-xr-x  3 mysql mysql   4096 12月 17 22:14 lib
    drwxr-xr-x  4 mysql mysql   4096 12月 17 22:14 man
    drwxr-xr-x 10 mysql mysql   4096 12月 17 22:14 mysql-test
    -rw-r--r--  1 mysql mysql   2496 11月 16 17:38 README
    drwxr-xr-x  2 mysql mysql   4096 12月 17 22:14 scripts
    drwxr-xr-x 28 mysql mysql   4096 12月 17 22:14 share
    drwxr-xr-x  4 mysql mysql   4096 12月 17 22:14 sql-bench
    drwxr-xr-x  2 mysql mysql   4096 12月 17 22:14 support-files
    [root@bogon mysql]# mkdir -p /data/mysql
    [root@bogon mysql]# chown -R mysql:mysql /data/mysql/
    [root@bogon mysql]# ll /data/
    总用量 4
    drwxr-xr-x 2 mysql mysql 4096 12月 17 22:20 mysql
    
    [root@bogon mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql/
    Installing MySQL system tables..../bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
    [root@bogon mysql]# yum install -y libaio*
    [root@bogon mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql/
    [root@bogon mysql]# cp my.cnf /etc/my.cnf
    [root@bogon mysql]# vim /etc/my.cnf
     basedir = /usr/local/mysql
     datadir = /data/mysql
     port = 3306
    # server_id = .....
     socket = /tmp/mysql.sock
    
    
    [root@bogon mysql]# cp support-files/mysql.server /etc/init.d/mysqld
    [root@bogon mysql]# vim /etc/init.d/mysqld
    basedir=/usr/local/mysql
    datadir=/data/mysql
    
    [root@bogon mysql]# chmod 755 !$
    chmod 755 /etc/init.d/mysqld
    [root@bogon mysql]# chkconfig --add !$
    chkconfig --add /etc/init.d/mysqld
    [root@bogon mysql]# chkconfig mysqld on
    
    [root@bogon mysql]# service mysqld start
    Starting MySQL.. SUCCESS!
    [root@bogon mysql]# netstat -nlp | grep mysqld
    tcp        0      0 :::3306                     :::*                        LISTEN      1949/mysqld        
    unix  2      [ ACC ]     STREAM     LISTENING     21948  1949/mysqld         /tmp/mysql.sock
    

    安装Httpd

    [root@bogon opt]# cd /usr/local/src/httpd-2.4.18/
    [root@bogon httpd-2.4.18]# ./configure --prefix=/usr/local/apache2/ --with-included-apr --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=share --with-pcre
    
    错误:

    *-----------------------------------
    1、configure: error: Bundled APR requested but not found at ./srclib/. Download and unpack the corresponding apr and apr-util packages to ./srclib/.

    [root@bogon opt]# wget http://apache.opencas.org//apr/apr-1.5.2.tar.bz2
    [root@bogon opt]# wget http://apache.opencas.org//apr/apr-util-1.5.4.tar.bz2
    [root@bogon opt]# tar jxvf apr-1.5.2.tar.bz2
    [root@bogon opt]# tar jxvf apr-util-1.5.4.tar.bz2
    [root@bogon opt]# cp -fr apr-1.5.2 /usr/local/src/httpd-2.4.18/srclib/apr
    [root@bogon opt]# cp -fr apr-util-1.5.4 /usr/local/src/httpd-2.4.18/srclib/apr-util/

    2、configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

    [root@bogon opt]# axel ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.bz2
    [root@bogon opt]# tar jxvf pcre-8.37.tar.bz2
    [root@bogon pcre-8.37]# ./configure && make && make install

    3、checking whether to enable mod_deflate… configure: error: mod_deflate has been requested but can not be built due to prerequisite failures

    [root@bogon httpd-2.4.18]# yum install zlib-devel -y
    -----------------------------------***

    [root@bogon httpd-2.4.18]# ./configure --prefix=/usr/local/apache2/ --with-included-apr --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=share --with-pcre
    [root@bogon httpd-2.4.18]# make
    [root@bogon httpd-2.4.18]# make install
    
    [root@bogon httpd-2.4.18]# /usr/local/apache2/bin/apachectl -t
    AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 221.192.153.43. Set the 'ServerName' directive globally to suppress this message
    Syntax OK
    
    [root@bogon httpd-2.4.18]# /usr/local/apache2/bin/apachectl start
    AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 221.192.153.43. Set the 'ServerName' directive globally to suppress this message
    
    [root@bogon httpd-2.4.18]# netstat -nlp | grep httpd
    tcp        0      0 :::80                       :::*                        LISTEN      62560/httpd        
    
    [root@bogon httpd-2.4.18]# ps aux|grep httpd
    root      62560  0.0  0.2  74408  2316 ?        Ss   23:04   0:00 /usr/local/apache2//bin/httpd -k start
    daemon    62561  0.2  0.4 418668  4200 ?        Sl   23:04   0:00 /usr/local/apache2//bin/httpd -k start
    daemon    62562  0.0  0.4 418668  4204 ?        Sl   23:04   0:00 /usr/local/apache2//bin/httpd -k start
    daemon    62563  0.0  0.4 418668  4208 ?        Sl   23:04   0:00 /usr/local/apache2//bin/httpd -k start
    root      62648  0.0  0.0 103316   896 pts/0    S+   23:04   0:00 grep httpd
    
    [root@bogon httpd-2.4.18]# curl localhost -I
    HTTP/1.1 200 OK
    Date: Thu, 17 Dec 2015 15:08:10 GMT
    Server: Apache/2.4.18 (Unix)
    Last-Modified: Mon, 11 Jun 2007 18:53:14 GMT
    ETag: "2d-432a5e4a73a80"
    Accept-Ranges: bytes
    Content-Length: 45
    Content-Type: text/html
    

    安装PHP

    [root@bogon opt]# cd /usr/local/src/php-5.6.3/
    [root@bogon php-5.6.3]# ./configure –prefix=/usr/local/php –with-apxs2=/usr/local/apache2/bin/apxs –with-config-file-path=/usr/local/php/etc –with-mysql=/usr/local/mysql –with-libxml-dir –with-gd –with-jpeg-dir –with-png-dir –with-freetype-dir –with-iconv-dir –with-zlib-dir –with-bz2 –with-openssl –with-mcrypt –enable-soap –enable-gd-native-ttf –enable-mbstring –enable-sockets –enable-exif –disable-ipv6
    [root@bogon php-5.6.3]# make && make install
    [root@bogon htdocs]# cp php.ini-production /usr/local/php/etc/php.in
    [root@bogon htdocs]# cd /usr/local/apache2/conf/httpd.conf

        AllowOverride none
        #Require all denied
        Order deny,allow
        Allow from all
    
    
    
        DirectoryIndex index.html index.htm index.php
    
    
      AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType application/x-httpd-php .php
    

    [root@bogon htdocs]# /usr/local/apache2/bin/apachectl -t
    Syntax OK
    [root@bogon htdocs]# /usr/local/apache2/bin/apachectl restart

    测试:安装Discuz论坛

    [root@bogon htdocs]# cd /usr/local/apache2/conf/httpd.conf
    # Virtual hosts
    Include conf/extra/httpd-vhosts.conf
    
    [root@bogon ~]# vim /usr/local/apache2/conf/extra/httpd-vhosts.conf
    
        DocumentRoot "/tmp/tmp/
        ServerName tmp.com
    
    
    
        DocumentRoot "/data/www/"
        ServerName www.test.com
    

    [root@bogon ~]# mkdir /data/www
    [root@bogon ~]# axel http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_UTF8.zip
    [root@bogon ~]# unzip Discuz_X3.2_SC_UTF8.zip
    [root@bogon ~]# mv upload/* /data/www/
    [root@bogon ~]# /usr/local/mysql/bin/mysql -u root
    mysql> create database discuz;
    mysql> grant all on discuz.* to ‘ljj’@’localhost’ identified by ‘qwe123’;
    mysql> quit

    修改客户机的hosts,增加 192.168.2.2 www.test.com
    浏览器访问www.test.com/install
    安装Discuz!!





  • 相关阅读:
    Codeforces 1491 D. Zookeeper and The Infinite Zoo (二进制处理)
    Codeforces 1479A. Searching Local Minimum(注意输入+二分)
    Codeforces 1480B. The Great Hero(阅读模拟题,注意数据范围和攻击顺序)
    Codeforces 1480A. Yet Another String Game (阅读理解题)
    windows 10 开启全盘瞬间索引功能
    JetBrains CLion C++ IDE连接wsl2(Ubuntu)时,报错"Unable to establish SSL connection"解决方案
    WorkFlowy 的 MarkDown 预览方案解决
    git 学习 完全学懂
    jeecgboot <j-popup
    面试之类加载器
  • 原文地址:https://www.cnblogs.com/lijunjiang2015/p/5137520.html
Copyright © 2011-2022 走看看