• centos7.6,nginx1.18,php-7.4.6,mysql-5.7.30 安装


    #1、下载,来自各官网
    
    nginx-1.18.0.tar.gz
    
    php-7.4.6.tar.gz
    
    mysql-5.7.30-linux-glibc2.12-x86_64.tar.gz
    
    #下载到本地再传到服务器,比直接wget快
    
     
    
    #2、准备工作
    
    yum install -y libxml2 libxml2-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurses curl gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel expat-devel xmlrpc-c xmlrpc-c-devel libicu-devel libmcrypt-devel libmemcached-devel
    
    yum install libsqlite3x-devel -y
    yum install oniguruma-devel -y
    yum install -y gcc gcc-c++ openssl-devel
    yum install pcre pcre-devel zlib zlib-devel -y
    
    groupadd www
    useradd -M -s /sbin/nologin www
    
    groupadd mysql
    useradd -M -s /sbin/nologin	mysql
    
    #openssl升级安装
    #参考
    https://www.cnblogs.com/itbsl/p/11275728.html
    
     
    
    #php7 编译需要高本版zlib,libzip >= 0.11
    #libzip-1.2.0.tar.gz
    #libzip-1.6X需要高版本cmake,我机器安装报错就没有用
    
    cd libzip-1.2.0
    ./configure
    make && make install
    
    #在网上找到的教程到了这一步就直接让你继续在PHP源码目录里面执行configure程序继续配置了,其实你虽然已经安装了libzip1.2,但是PHP的configure程序依然找不到,不知道你安装在哪,你得告诉PHP的configure程序,我安装了libzip 1.2,并且安装在何处。以前是用ldconfig来通告系统所需动态库文件的位置,现在用pkg-config。我刚刚提供的方法安装的libzip默认被安装到了 /usr/local/lib 在这个目录下你能看到libzip.so libzip.so.5 libzip.so.5.0.0 还有一个pkgconfig目录。所以,真正的解决方法来了,在你configure的会话窗口直接输入如下内容:
    export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/"
    
    #参考:https://www.cnblogs.com/equation/p/12352596.html
    
    
    #tools 解压目录
    #nginx 安装
    #参考 https://blog.csdn.net/nouswait/article/details/83105378
    #https://blog.csdn.net/qq_42303254/article/details/87886098
    
    cd /opt/nginx/tools/nginx-1.8.0
    ./configure --user=www --group=www --prefix=/opt/ngin
    make && make install
    
    #php 安装
    cd php
    ./configure --prefix=/opt/php --with-config-file-path=/etc --with-fpm-user=www --with-fpm-group=www --with-curl --with-freetype --enable-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml --with-mysqli --with-openssl --with-pdo-mysql --with-pdo-sqlite --with-pear --with-jpeg --with-zip --with-xmlrpc --with-xsl --with-zlib --with-bz2 --with-mhash --enable-fpm --enable-bcmath --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml --enable-fpm
    
    #php 安装参考
    https://hqidi.com/150.html
    https://www.cnblogs.com/liubaoqing/p/12176017.html
    
    #mysql 安装
    #参考https://www.cnblogs.com/haima/p/12276063.html
    
    ./mysqld –initialize --defaults-file=/etc/my.cnf --basedir=/opt/mysql --datadir=/opt/mysql/data --user=mysql
    #data 为数据文件夹
    chown -R mysql:mysql data
    
    #授权my.cnf
    chown 777 /etc/my.cnf
    
    #复制启动脚本到资源目录
    cp -a /opt/mysql/support-files/mysql.server /etc/init.d/mysqld
    
    #增加mysqld服务控制脚本执行权限
    chmod +x /etc/init.d/mysqld
    
    #将mysqld服务加入到系统服务
    chkconfig --add /etc/init.d/mysqld
    /opt/mysql/bin/mysqld_safe --user=mysql &
    
    #启动mysql服务
    /etc/init.d/mysqld restart
    
    #显示默认密码
    cat /root/.mysql_secret
    #登录并修改密码,省略
    
    #mysql 安装参考
    https://blog.csdn.net/ahangliu/article/details/106476385
    
    
    #linux系统下将php和mysql命令加入到环境变量中的方法
    
    PATH=$PATH:/opt/php/bin:/opt/mysql/bin
    export PATH
    
    #加入开机启动php
    
    [Unit]
    Description=The PHP FastCGI Process Manager
    After=syslog.target network.target
    
    [Service]
    Type=simple
    PIDFile=/run/php-fpm.pid
    ExecStart=/opt/php/sbin/php-fpm --nodaemonize --fpm-config /opt/php/etc/php-fpm.conf
    ExecReload=/bin/kill -USR2 $MAINPID
    ExecStop=/bin/kill -SIGINT $MAINPID
    
    [Install]
    WantedBy=multi-user.target
    
    #加入开机启动nginx
    
    [Unit]
    Description=nginx - high performance web server
    After=network.target remote-fs.target nss-lookup.target
    
    [Service]
    Type=forking
    ExecStart=/opt/nginx/sbin/nginx
    ExecReload=/opt/nginx/sbin/nginx -s reload
    ExecStop=/opt/nginx/sbin/nginx -s stop
    
    [Install]
    WantedBy=multi-user.target
    
    #加入开机启动mysql,我没有使用
    
    [Unit]
    Description=MySQL Server
    Documentation=man:mysqld(8)
    After=network.target
    After=syslog.target
    
    [Install]
    WantedBy=multi-user.target
    
    [Service]
    User=mysql
    Group=mysql
    ExecStart=/opt/mysql/bin/mysqld --defaults-file=/etc/my.cnf
    LimitNOFILE = 5000
    #Restart=on-failure
    #RestartPreventExitStatus=1
    #PrivateTmp=false
    
    
    #开机启动参考
    https://www.cnblogs.com/yingsi/p/8482639.html
    https://www.cnblogs.com/onephp/p/6093707.html
    https://www.cnblogs.com/shiqiangqiang/p/8398931.html
    
     
    
    #mysql 配置参考
    https://www.cnblogs.com/kanyun/p/8075414.html
    
    #Mysql5.5&Mysql5.6&Mysql5.7特性
    https://blog.csdn.net/zxz547388910/article/details/78671911
    
    #vim 中批量添加注释
    https://blog.csdn.net/yzs_110/article/details/90643327
    
     
    

      

  • 相关阅读:
    开发进度二
    开发进度一
    大道至简阅读笔记01
    用户模板和用户评价
    第九周总结
    第八周总结
    NABCD项目分析
    第七周总结
    第六周总结
    构建之法阅读笔记03
  • 原文地址:https://www.cnblogs.com/coolid/p/13050904.html
Copyright © 2020-2023  润新知