在liunx下面安装nginx + php +mysql

来源:互联网 发布:谐波测量数据唯一么 编辑:程序博客网 时间:2024/06/16 00:37

mkdir /data
mkdir /data/soft #安装路径
mkdir /data/soft/src #存放源包路径

  1. 创建nginx用户组和用户
    groupadd nginx
    useradd -g nginx -M nginx
    groupadd php
    useradd -g php -M php-fpm
    wget http://nginx.org/download/nginx-1.6.2.tar.gz #下载
    tar xzvf nginx-1.6.2.tar.gz #解压
    ./configure --help查看编译配置参数
    yum install pcre-devel.x86_64
    yum install openssl-devel.x86_64
    ./configure --prefix=/data/soft/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_stub_status_module #编译参数
    make #编译
    make install #安装
    cd /etc/init.d/里面编译自动启动脚本
    vi nginx #下面是nginx 里的内容
    chmod +x nginx
    chkconfig --level 3456 nginx on #自启级别
    service nginx start

  2. 创建php用户组和用户
    wget http://cn2.php.net/get/php-5.6.2.tar.gz/from/this/mirror
    mv mirror php-5.6.2.tar.gz
    tar xzvf php-5.6.2.tar.gz #解压
    yum install libxml2-devel
    yum install libcurl-devel.x86_64
    yum install libpng-devel.x86_64
    yum install libicu-devel
    ./configure --prefix=/data/soft/php\
    --enable-fpm\
    --with-fpm-user=php-fpm\
    --with-fpm-group=php\
    --enable-phpdbg\
    --enable-calendar\
    --enable-bcmath\
    --enable-exif\
    --enable-ftp\
    --enable-intl\
    --enable-opcache\
    --enable-pcntl\
    --enable-mysqlnd\
    --enable-zip\
    --with-mysql=mysqlnd\
    --with-mysqli=mysqlnd\
    --with-pdo-mysql=mysqlnd\
    --with-gd\
    --with-openssl\
    --with-zlib\
    --with-curl
    make
    make install
    ls |grep php.ini
    cp php.ini-development /data/soft/php/lib/php.ini
    /data/soft/src/php-5.6.2/sapi/fpm
    cp init.d.php-fpm /etc/init.d/php-fpm
    cp php-fpm.conf /data/soft/php/etc/
    cd /etc/init.d
    chmod +x php-fpm
    chkconfig --level 3456 php-fpm on
    service php-fpm start

  3. 创建mysql用户组和用户
    wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.21-linux-glibc2.5-x86_64.tar.gz
    mv mysql-5.6.21-linux-glibc2.5-x86_64.tar.gz mysql.tar.gz
    tar xzvf mysql.tar.gz
    cp -r mysql/ /data/soft/mysql/
    chown -R mysql:mysql /data/soft/mysql
    mkdir /data/data/mysql
    chown -R root:mysql /data/data/mysql
    cd /data/soft/mysql/scripts/
    ./mysql_install_db --basedir=/data/soft/mysql --datadir=/data/data/mysql --user=mysql
    cp /data/soft/mysql/support-files/mysql.server /etc/init.d/mysqld
    vim /etc/init.d/mysqld
    basedir=/data/soft/mysql
    datadir=/data/data/mysql
    conf=/etc/my.cnf 是配制文件
    ls /data/soft/mysql
    vim my.cnf
    在[mysqld]下面增加以前
    vim /data/soft/mysql/my.cnf
    pid-file = /data/data/mysql/mysql.pid
    socket = /data/data/mysql/mysql.sock
    log-error = /data/data/mysql/error.log
    character-set-server = utf8
    [mysql]
    default-character-set=utf8
    [client]
    default-character-set=utf8
    /etc/init.d/mysqld 修改权限
    chmod +x /etc/init.d/mysqld
    chkconfig --level 3456 mysqld on
    service mysqld start
    ln -s /data/data/mysql/mysql.sock /tmp/mysql.sock 做个软连接
    tar -zcvf /tmp/etc.tar.gz /etc

0 0
原创粉丝点击