zoukankan      html  css  js  c++  java
  • Linux系统环境下,lnmp环境的搭建

    在安装最可以先升级一下

    yum clean all
    yum makecache
    yum update

    1、nginx安装参看nginx篇

    常用的linux语句的使用:

    a、systemctl status nginx   => 查看nginx的运行状态;

    b、systemctl start nginx => 启动nginx

    c、systemctl reload nginx => 重载nginx系统   可以使用 nginx -s reload -c /etc/nginx/nginx.conf替代

    d、systemctl restart nginx => 重启nginx;

    e、systemctl stop nginx => 停止nginx;

    f、 systemctl enable nginx => 设置开机启动

    g、pstree | grep nginx  => nginx的进程管理 也可以使用 ps -ef | grep nginx| grep -v grep

    h、netstat -tunpl | grep nginx => 查看端口

     2、mysql 的安装与调试

    查询系统中是否有与mysql有关的软件 rpm -qa|grep mysql | rpm -ql mysql   或者  yum list installed | grep mysql

    a、在线下载mysql仓库文件地址(前往):选择对应的版本这里以linux7为例

    下载完后上传到linux系统,或者进入download后如下左图,点击对应的地方

     

     存下对应的地址,在linux系统直接下载

    wget https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm

    b、下载完成后,安装rpm包

    rpm -ivh mysql80-community-release-el7-3.noarch.rpm --force --nodeps

    c、安装mysql-community-server

    yum install mysql-community-server

    弹出对话框确认y,最终Complete!

    d、启动mysqld服务并加入开机自启动

    systemctl start mysqld       //启动mysql
    systemctl enable mysqld      //mysql加入开机启动

    e、如果没有获取到mysql的密码,那么就在/etc目录下找到my.cnf (相当windows下的my.ini) 这个文件加入如下语句

    skip-grant-tables

    以上语法是跳过验证

    f、登陆到mysql进行密码的修改用如下语法:

    use mysql;    --第一步:起用mysql数据库
    update user set authentication_string='' where user='root'; --第二步:把root的密码设置为空
    --注意:在mysql8.0以上的版本 update mysql.user set password='newpassword' where user='root'; 语句和  update mysql.user set password=PASSWORD('newpassword') where User='root'; 已经失效了;
    alter user 'root'@'localhost' identified by 'newpassword';  --第三步:设置自己的密码
    flush privileges; --第四步: 刷新权限

    注意:如果在修改密码的时候提示  ERROR 1819 (HY000): Your password does not satisfy the current policy requirements,那么输入:

    输入语句 “ SHOW VARIABLES LIKE 'validate_password%'; ” 进行查看

    关于 mysql 密码策略相关参数;
    1)validate_password_length  固定密码的总长度;
    2)validate_password_dictionary_file 指定密码验证的文件路径;
    3)validate_password_mixed_case_count  整个密码中至少要包含大/小写字母的总个数;
    4)validate_password_number_count  整个密码中至少要包含阿拉伯数字的个数;
    5)validate_password_policy 指定密码的强度验证等级,默认为 MEDIUM;
    关于 validate_password_policy 的取值:
    0/LOW:只验证长度;
    1/MEDIUM:验证长度、数字、大小写、特殊字符;
    2/STRONG:验证长度、数字、大小写、特殊字符、字典文件;
    6)validate_password_special_char_count 整个密码中至少要包含特殊字符的个数;

    g、进入etc/my.cnf文件,删除掉临时的配置,重启mysql服务即可;

     3、php程序的安装

     1、首先安装 EPEL 源:

    yum install epel-release

     2、安装 REMI 源

    yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm  

    3、安装 Yum 源管理工具:

    yum install yum-utils

    4、安装php7.3

    yum install -y php73-php-fpm php73-php-cli php73-php-bcmath php73-php-gd php73-php-json php73-php-mbstring php73-php-mcrypt php73-php-mysqlnd php73-php-opcache php73-php-pdo php73-php-pecl-crypto php73-php-pecl-mcrypt php73-php-pecl-geoip php73-php-recode php73-php-snmp php73-php-soap php73-php-xmll
    systemctl enable php73-php-fpm      //开机启动
    systemctl start php73-php-fpm         //启动php

    5、设置php查找安装包

    [root@xxx etc]# rpm -qa | grep 'php'
    php73-php-cli-7.3.6-1.el7.remi.x86_64
    php73-php-mbstring-7.3.6-1.el7.remi.x86_64
    php73-php-pecl-mcrypt-1.0.2-1.el7.remi.x86_64
    php73-runtime-2.0-1.el7.remi.x86_64
    php73-php-pdo-7.3.6-1.el7.remi.x86_64
    php73-php-bcmath-7.3.6-1.el7.remi.x86_64
    php73-php-fpm-7.3.6-1.el7.remi.x86_64
    php73-php-mysqlnd-7.3.6-1.el7.remi.x86_64
    php73-php-snmp-7.3.6-1.el7.remi.x86_64
    php73-php-gd-7.3.6-1.el7.remi.x86_64
    php73-php-json-7.3.6-1.el7.remi.x86_64
    php73-php-soap-7.3.6-1.el7.remi.x86_64
    php73-php-recode-7.3.6-1.el7.remi.x86_64
    php73-php-pecl-crypto-0.3.1-5.el7.remi.x86_64
    php73-php-common-7.3.6-1.el7.remi.x86_64
    php73-php-opcache-7.3.6-1.el7.remi.x86_64
    php73-php-pecl-geoip-1.1.1-6.el7.remi.x86_64

    找到:php73-php-fpm-7.3.6-1.el7.remi.x86_64安装位置

    [root@xxx etc]# rpm -ql php73-php-fpm-7.3.6-1.el7.remi.x86_64
    /etc/logrotate.d/php73-php-fpm
    /etc/opt/remi/php73/php-fpm.conf
    /etc/opt/remi/php73/php-fpm.d
    /etc/opt/remi/php73/php-fpm.d/www.conf
    /etc/opt/remi/php73/sysconfig/php-fpm
    /etc/systemd/system/php73-php-fpm.service.d
    /opt/remi/php73/root/usr/sbin/php-fpm
    /opt/remi/php73/root/usr/share/doc/php73-php-fpm-7.3.6
    /opt/remi/php73/root/usr/share/doc/php73-php-fpm-7.3.6/php-fpm.conf.default
    /opt/remi/php73/root/usr/share/doc/php73-php-fpm-7.3.6/www.conf.default
    /opt/remi/php73/root/usr/share/fpm
    /opt/remi/php73/root/usr/share/fpm/status.html
    /opt/remi/php73/root/usr/share/licenses/php73-php-fpm-7.3.6
    /opt/remi/php73/root/usr/share/licenses/php73-php-fpm-7.3.6/fpm_LICENSE
    /opt/remi/php73/root/usr/share/man/man8/php-fpm.8.gz
    /usr/lib/systemd/system/php73-php-fpm.service
    /var/opt/remi/php73/lib/php/opcache
    /var/opt/remi/php73/lib/php/session
    /var/opt/remi/php73/lib/php/wsdlcache
    /var/opt/remi/php73/log/php-fpm
    /var/opt/remi/php73/run/php-fpm

    查找php.ini位置:

    [root@xxx etc]# find /etc/opt/remi/php73 -name php.ini
    /etc/opt/remi/php73/php.ini

    编辑/etc/opt/remi/php73/php.ini替换换 ;cgi.fix_pathinfo=1 为 cgi.fix_pathinfo=0 快捷命令:

    ed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/' /etc/opt/remi/php73/php.ini

    重启php73-php-fpm

    systemctl restart php73-php-fpm

    查看是否安装成功

    root@mf88.biz-service:~# php73 -v
    PHP 7.3.0-1+(cli) (built: Dec  6 2018 20:24:55) ( NTS )
    Copyright (c) 1997-2018 The PHP Group
    Zend Engine v3.3.0-dev, Copyright (c) 1998-2018 Zend Technologies
        with Zend OPcache v7.3.0-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

    安装更多组件
    上面的一条命令安装 PHP 只是安装了部分 PHP 拓展,更多的软件可见

    # yum search php73
    Updating Subscription Management repositories.
    Last metadata expiration check: 0:27:54 ago on Wed 15 May 2019 10:39:52 AM EDT.
    ============================================================================================= Name Exactly Matched: php73 ==============================================================================================
    php73.x86_64 : Package that installs PHP 7.3
    php73.x86_64 : Package that installs PHP 7.3
    ============================================================================================ Name & Summary Matched: php73 =============================================================================================
    php73-syspaths.x86_64 : System-wide wrappers for the php73 package
    php73-syspaths.x86_64 : System-wide wrappers for the php73 package
    php73-scldevel.x86_64 : Package shipping development files for php73
    php73-scldevel.x86_64 : Package shipping development files for php73
    php73-php-zstd-devel.x86_64 : php73-php-zstd developer files (header)
    php73-runtime.x86_64 : Package that handles php73 Software Collection.
    php73-runtime.x86_64 : Package that handles php73 Software Collection.
    php73-runtime.x86_64 : Package that handles php73 Software Collection.
    php73-php-pecl-psr-devel.x86_64 : php73-php-pecl-psr developer files (header)
    php73-php-pecl-psr-devel.x86_64 : php73-php-pecl-psr developer files (header)
    php73-php-pecl-raphf-devel.x86_64 : php73-php-pecl-raphf developer files (header)
    php73-php-pecl-raphf-devel.x86_64 : php73-php-pecl-raphf developer files (header)
    php73-php-pecl-propro-devel.x86_64 : php73-php-pecl-propro developer files (header)
    php73-php-pecl-yaconf-devel.x86_64 : php73-php-pecl-yaconf developer files (header)
    php73-php-pecl-propro-devel.x86_64 : php73-php-pecl-propro developer files (header)
    php73-php-pecl-yaconf-devel.x86_64 : php73-php-pecl-yaconf developer files (header)
    php73-php-pecl-xmldiff-devel.x86_64 : php73-php-pecl-xmldiff developer files (header)
    php73-php-pecl-swoole4-devel.x86_64 : php73-php-pecl-swoole4 developer files (header)
    php73-php-pecl-xmldiff-devel.x86_64 : php73-php-pecl-xmldiff developer files (header)
    php73-php-zephir-parser-devel.x86_64 : php73-php-zephir-parser developer files (headers)
    php73-php-zephir-parser-devel.x86_64 : php73-php-zephir-parser developer files (headers)
    php73-php-pecl-handlebars-devel.x86_64 : php73-php-pecl-handlebars developer files (header)
    ================================================================================================= Name Matched: php73 ==================================================================================================
    php73-php.x86_64 : PHP scripting language for creating dynamic web sites
    php73-php.x86_64 : PHP scripting language for creating dynamic web sites
    php73-build.x86_64 : Package shipping basic build configuration
    ……
  • 相关阅读:
    BZOJ2821 作诗(Poetize) 【分块】
    BZOJ2724 蒲公英 【分块】
    Codeforces 17E Palisection 【Manacher】
    BZOJ2565 最长双回文串 【Manacher】
    Codeforces 25E Test 【Hash】
    CODEVS3013 单词背诵 【Hash】【MAP】
    HDU2825 Wireless Password 【AC自动机】【状压DP】
    HDU2896 病毒侵袭 【AC自动机】
    HDU3065 病毒侵袭持续中【AC自动机】
    HDU2222 Keywords Search 【AC自动机】
  • 原文地址:https://www.cnblogs.com/rickyctbu/p/12500910.html
Copyright © 2011-2022 走看看