美文网首页
Wordpress环境搭建(LAMP)

Wordpress环境搭建(LAMP)

作者: jan29 | 来源:发表于2020-12-29 10:05 被阅读0次

    1、环境准备

    test1 192.168.100.23

    2、软件安装

    [root@test1 ~]# yum -y install php php-mysql mariadb-server httpd
    

    php:提供php运行环境
    php-mysql:连接php和mysql的工具
    mariadb-server:数据库,存放PHP环境运行时的数据
    httpd:为用户提供web界面

    3、配置wordpress

    [root@test1 ~]# tar -zxvf wordpress-4.6.13.tar.gz
    [root@test1 ~]# cp wordpress/* /var/www/html/
    [root@test1 ~]# cd /var/www/html/
    [root@test1 html]# mv wp-config-sample.php wp-config.php
    [root@test1 html]# vim wp-config.php
    define('DB_NAME', 'wordpress');
    define('DB_USER', 'wordpress');
    define('DB_PASSWORD', 'wordpresspwd');
    define('DB_HOST', 'localhost');
    

    4、配置mysql

    [root@test1 ~]# systemctl start mariadb
    [root@test1 ~]# mysql_secure_installation 
    
    NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
          SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
    
    In order to log into MariaDB to secure it, we'll need the current
    password for the root user.  If you've just installed MariaDB, and
    you haven't set the root password yet, the password will be blank,
    so you should just press enter here.
    
    Enter current password for root (enter for none): 
    OK, successfully used password, moving on...
    
    Setting the root password ensures that nobody can log into the MariaDB
    root user without the proper authorisation.
    
    Set root password? [Y/n] y
    New password: 
    Re-enter new password: 
    Password updated successfully!
    Reloading privilege tables..
     ... Success!
    
    
    By default, a MariaDB installation has an anonymous user, allowing anyone
    to log into MariaDB without having to have a user account created for
    them.  This is intended only for testing, and to make the installation
    go a bit smoother.  You should remove them before moving into a
    production environment.
    
    Remove anonymous users? [Y/n] y
     ... Success!
    
    Normally, root should only be allowed to connect from 'localhost'.  This
    ensures that someone cannot guess at the root password from the network.
    
    Disallow root login remotely? [Y/n] n
     ... skipping.
    
    By default, MariaDB comes with a database named 'test' that anyone can
    access.  This is also intended only for testing, and should be removed
    before moving into a production environment.
    
    Remove test database and access to it? [Y/n] y
     - Dropping test database...
     ... Success!
     - Removing privileges on test database...
     ... Success!
    
    Reloading the privilege tables will ensure that all changes made so far
    will take effect immediately.
    
    Reload privilege tables now? [Y/n] y
     ... Success!
    
    Cleaning up...
    
    All done!  If you've completed all of the above steps, your MariaDB
    installation should now be secure.
    
    Thanks for using MariaDB!
    
    [root@test1 ~]# mysql -uroot -p000000
    MariaDB [(none)]> create database wordpress;
    Query OK, 1 row affected (0.00 sec)
    
    MariaDB [(none)]> create user wordpress@'%' identified by 'wordpresspwd';
    Query OK, 0 rows affected (0.00 sec)
    
    MariaDB [(none)]> grant all on wordpress.* to wordpress@'%' identified by 'wordpresspwd';
    Query OK, 0 rows affected (0.00 sec)
    

    5、启动httpd并验证

    [root@test1 ~]# systemctl start httpd
    

    登陆http://192.168.100.23/wp-admin/

    相关文章

      网友评论

          本文标题:Wordpress环境搭建(LAMP)

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