zoukankan      html  css  js  c++  java
  • linux安装教程

    1.需求

    搭建mysql+php+nginx环境

    2流程

    分为6步,磁盘分区,安装vsftpd,安装nginx,安装php-fpm,安装mysql,防火墙配置

    3.磁盘分区

    http://www.cnblogs.com/dudu/archive/2012/12/07/aliyun-linux-fdisk.html

    4.安装 vsftpd

    yum install vsftpd
    
    a.关闭selinux,http://www.cnblogs.com/norm/p/6269338.html
    b、useradd -d /webserver -s /sbin/nologin webftp 新建用户
    c、passwd webftp 修改密码 sdafadsf54542016
    d、chown -R webftp.webftp /webserver 修改指定目录的权限
    e、vi /etc/vsftpd/vsftpd.conf 编辑vsftp配置文件
    
    
    将配置文件中”anonymous_enable=YES “改为 “anonymous_enable=NO”
    取消如下配置前的注释符号:
    local_enable=YES
    write_enable=YES
    chroot_local_user=YES
    f、 xferlog_std_format=YES
    xferlog_file=/webserver/logs/vsftpd/ftp.log
    xferlog_enable=YES
    
    (!!上传所有日志文件)
    设置开机启动 chkconfig
    --level 345 vsftpd on

    5.安装nginx

    a、上传nginx-1.8.0.tar.gz
    b、tar zxvf nginx-1.8.0.tar.gz
    c、安装 yum install -y zlib zlib-devel
    d、安装 yum install -y openssl openssl-devel
    e、安装 yum install -y pcre pcre-devel
       安装 yum install -y gd
        yum install gd-devel
            yum install libatomic_ops-devel
    
    f、进入nginx-1.8.0目录 
    g、./configure --prefix=/webserver/software/nginx/ --with-http_ssl_module --with-http_spdy_module --with-http_realip_module --with-http_image_filter_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-pcre --with-libatomic
    h、make
       make install
    
    i、nginx服务控制
        ./nginx 启动
        ./nginx -s reload 重启
             nginx -t -c /usr/local/nginx/conf/nginx.conf 判断nginx.conf是否正确
        停止    
        ps -ef | grep nginx
        kill -QUIT 主进程号     :从容停止Nginx
        kill -TERM 主进程号     :快速停止Nginx
        pkill -9 nginx          :强制停止Nginx

       cp /webserver/software/nginx/sbin/nginx /etc/init.d/

        chmod +x /etc/init.d/nginx 给执行权限
    
        chkconfig --level 345 nginx on 设为开机启动
    
    j、配置nginx站点 详见示例nginx.conf

     6.安装php-fpm

    3、安装php-fpmd(必须在mysql之前安装,否则会mysqlclient之类的问题会报错)
    
    a、上传php-5.3.28.tar.gz
    b、解压 tar zxvf php-5.3.28.tar.gz
    c、安装必要的组件
        
        yum install -y php-mcrypt
        yum install -y php-mysql
        yum install -y php-gd
        yum install -y php-imap
        yum install -y php-ldap 
        yum install -y php-odbc
        yum install -y php-pear
        yum install -y php-xml
        yum install -y php-xmlrpc
        yum install -y php-mbstring
        yum install -y libmemcached
        yum install -y libmemcached-devel
        yum install -y php-pecl-memcached
        yum install -y memcached-devel
        yum install -y memcached 
        yum install -y libxml2
        yum install -y libxml2-devel
        yum install  -y libcurl
        yum install -y libcurl-devel
        yum install -y openldap
        yum install -y openldap-devel
        yum install -y libmcrypt
        yum install -y libmcrypt-devel
        yum install -y mysql-devel
    
    
      上传libiconv-1.14.tar.gz 并解压 tar zxvf libiconv-1.14.tar.gz
    (要先进入到解压后的目录里面)
        ./configure --prefix=/webserver/software/libiconv
        make
        make install 与安装
    
    
      d、进入cd /webserver/software_package/php-5.3.28
      e、cp -frp /usr/lib64/libldap* /usr/lib/
      f、export MYSQL_LIB_DIR=/usr/lib64/mysql 环境变量改为lib64位路径(安装mysql之前就要弄的)
      e、./configure --prefix=/webserver/software/php-fpm --with-config-file-path=/webserver/software/php-fpm/etc --with-mysql --with-mysqli --with-iconv-dir=/webserver/software/libiconv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap --without-pear --with-zlib --enable-pdo --with-pdo-mysql --with-iconv-dir=/webserver/software/libiconv --with-libmcrypt --enable-ftp --with-freetype-dir --with-memcached
        make
        make install 
      f、 拷贝 cp /webserver/software_package/php-5.3.28/php.ini-production /webserver/software/php-fpm/etc/php.ini
           cp /webserver/software/php-fpm/etc/php-fpm.conf.default /webserver/software/php-fpm/etc/php-fpm.conf
      g、  
        启动 /webserver/software/php-fpm/sbin/php-fpm -c /webserver/software/php-fpm/etc/php.ini -y /webserver/software/php-fpm/etc/php-fpm.conf 
    执行权限:chmod 777 /webserver/software/php-fpm
      h、  配置PHP支持ZendGuardLoader 
           上传 ZendGuardLoader.so
    cp webserver/software_package/ZendGuardLoader.so /webserver/software/php-fpm/lib/
          
    
        (去 /webserver/software/php-fpm/etc/php.ini)
     配置php.ini 追加
           zend_extension=/webserver/software/php-fpm/lib/ZendGuardLoader.so
           zend_loader.enable=1
        zend_loader.disable_licensing=0
        zend_loader.obfuscation_level_support=3
        
        如果开支持memcached扩展添加以下
        extension=/usr/lib64/php/modules/memcached.so 
    
        重启php-fpd
    
        制作服务启动
        
    
         cp /webserver/software/php-fpm/sbin/php-fpm /etc/init.d/
    
        chmod +x /etc/init.d/php-fpm 给执行权限
    
        chkconfig --level 345 php-fpm on(一直失败)
    
        

     7.安装mysql

    4、安装mysql mysql-5.5.47.tar.gz(安装mysql之前要检查webserver的权限问题)
    
    a、上传 mysql-5.5.47.tar.gz
    b、 解压 tar zxvf mysql-5.5.47.tar.gz
    
        yum install -y cmake
        yum install -y ncurses-devel
        
        useradd -M -s /sbin/nologin mysql  这条命令中的-M参数,该参数的意思是在创建用户时不为该用户创建其对应的家目录,-s /sbin/nologin表示该用户不能登陆到系统。
        grep mysql /etc/passwd
        cat /etc/passwd |grep mysql
        grep mysql /etc/group
    
        cd /webserver/software_package/mysql-5.5.47
      
         yum install gcc
    
    
         yum install gcc-c++

    cmake
    -DCMAKE_INSTALL_PREFIX=/webserver/software/mysql
      
       备注:会出现的问题http://blog.chinaunix.net/uid-13954789-id-3432115.html,
    http://blog.csdn.net/1099564863/article/details/51622709
    make make install chown mysql:mysql
    -R /webserver/software/mysql/ 修改安装目录的用户归属 进入安装目录 cd /webserver/software/mysql 执行初始化 ./scripts/mysql_install_db --user=mysql --basedir=/webserver/software/mysql --datadir=/webserver/software/mysql/data cp support-files/my-medium.cnf /etc/my.cnf 拷贝一份my.cnf出来 mysql在启动时没有指定配置文件时会使用/etc/my.cnf配置文件 cp support-files/mysql.server /etc/init.d/mysqld 拷贝成一份服务 chmod a+x /etc/init.d/mysqld 给执行权限 /etc/init.d/mysqld start 启动 ps aux |grep mysqld 检查 netstat -tunlp |grep 3306 检查 进入bin目录 cd /webserver/software/mysql/bin mysqladmin -u root password storecodebb2016 创建root 测试链入 mysql -u root -p 进入mysql控制台。 chkconfig --level 345 mysqld on 开机启动

    8.防火墙配置

    先关了,防止服务不启动

    serverice iptables stop
  • 相关阅读:
    一个基础的CURL类
    设计自适应网页方法
    JQ点击列表显示隐藏
    获取当前页面的完整URL
    配置时间生成下拉菜单
    Contains Duplicate II
    Rectangle Area
    面试题47:不用加减乘除做加法
    面试题48:用C++设计一个不能被继承的类
    Reverse Linked List
  • 原文地址:https://www.cnblogs.com/norm/p/6273087.html
Copyright © 2011-2022 走看看