美文网首页
Linux-CentOS7下安装LNMP环境笔记

Linux-CentOS7下安装LNMP环境笔记

作者: 高多金 | 来源:发表于2020-10-15 14:58 被阅读0次

    1. 设置yum源

    
    rpm -Uvh https://dl.Fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
    
    rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
    
    rpm -Uvh  http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
    
    

    PHP源官方地址:  https://webtatic.com/

    mysql源官方地址: https://dev.mysql.com/downloads/repo/yum/

    2.安装nginx1.1 php7.1 mysql5.7

    安装之前先
    清除yum缓存: yum clean all
    生成yum缓存 : yum makecache

    yum -y install nginx
    
    yum -y install mysql-community-server
    
    yum -y install php71w-devel php71w php71w-cli php71w-common php71w-gd php71w-ldap php71w-mbstring php71w-mcrypt  php71w-pdo  php71w-mysqlnd  php71w-fpm php71w-opcache php71w-pecl-redis  php71w-bcmath
    
    

    3.启动软件

    systemctl start nginx
    
    systemctl start mysql  |  systemctl start mysqld
    
    systemctl start php-fpm
    
    

    具体的nginx,php-fpm的配置这里省略,下面只重点说一下mysql的配置

    • mysql5.7 初始密码获取

    启动mysql之后,通过命令 grep 'temporary password' /var/log/mysqld.log 可以拿到root用户的初始密码

    • 修改初始密码

    root用户首次登录mysql是需要修改初始密码才能进行后续的操作的

    初始密码必须包括数字、大小写字母且长度不能小于8位

    
    set password = password('ryUl1_33au_n0krQ')
    
    
    • 创建用户且授权
    
    grant all privileges on db_sb.* to "dbsb"@"%" identified by "ryUl1_33au_n0krQ"
    
    

    上面命令会自动创建dbsb用户且授权db_sb库的所有表的权限

    4.设置开机自动启

    systemctl enable mysqld
    
    systemctl enable nginx
    
    systemctl enable php-fpm
    
    

    Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.

    查看软件安装相关目录或者文件:   rpm nginx -ql

    以上都是在关闭了系统的防火墙和selinux下操作的
    参考:
    https://www.linuxidc.com/Linux/2018-01/150669.htm

    https://webtatic.com/packages/php71/

    相关文章

      网友评论

          本文标题:Linux-CentOS7下安装LNMP环境笔记

          本文链接:https://www.haomeiwen.com/subject/jfxopktx.html