20201013在fedora 32裝httpd與php 及MYSQL

出自金門農工維基III
跳至導覽 跳至搜尋

20201013在fedora 32裝httpd與php 及MYSQL

(1)
# dnf install httpd php php-common

(2)
# dnf install php-pecl-apcu php-cli php-pear php-pdo php-mysqlnd php-pgsql php-pecl-mongodb php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml

(3)
# systemctl enable httpd.service

(4) vi  /var/www/html/test.php

# cat  /var/www/html/test.php
<?php
phpinfo();
?>

(5)# systemctl start httpd.service

(6)
# ps ax|grep httpd
2548760 ?        Ss     0:00 /usr/sbin/httpd -DFOREGROUND
2548762 ?        S      0:00 /usr/sbin/httpd -DFOREGROUND
2548763 ?        Sl     0:00 /usr/sbin/httpd -DFOREGROUND
2548764 ?        Sl     0:00 /usr/sbin/httpd -DFOREGROUND
2548765 ?        Sl     0:00 /usr/sbin/httpd -DFOREGROUND

(7) # systemctl status firewalld
??firewalld.service - firewalld - dynamic firewall daemon
     Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2020-10-13 01:34:51 EDT; 50min ago


(8)# systemctl stop firewalld

(9) OK
http://163.25.20.15/test.php

(10) sudo dnf -y install https://repo.mysql.com//mysql80-community-release-fc31-1.noarch.rpm

sudo dnf -y install https://dev.mysql.com/get/mysql80-community-release-fc32-1.noarch.rpm


(11)sudo dnf config-manager --disable mysql80-community

(12)
sudo dnf config-manager --enable mysql57-community


(13a) # sudo dnf install mysql-community-server
MySQL Connectors Community                       31 kB/s | 2.5 kB     00:00
MySQL Tools Community                            11 kB/s | 2.5 kB     00:00
No match for argument: mysql-community-server
Error: Unable to find a match: mysql-community-server

(13b) OK
# sudo dnf install mysql-server
:
完成!

# stat /usr/bin/mysql
  檔案:/usr/bin/mysql
  大小:4159288         區塊:8128       IO 區塊:4096   一般檔案
裝置:fd00h/64768d      Inode:17074913    實際連結 (hardlink) :1
權限:(0755/-rwxr-xr-x)    Uid:(    0/    root)  Gid:(    0/    root)
上下文:system_u:object_r:bin_t:s0
最近存取:2020-10-13 23:05:48.143455838 -0400
最近變更:2020-09-03 19:21:27.000000000 -0400
最近變更:2020-10-13 23:02:28.783651281 -0400
建立時間:-
[root@localhost html]# date
西元2020年10月13日 (週二) 23時06分05秒 EDT

(14)
# systemctl start mariadb.service

# systemctl enable mariadb.service
Created symlink /etc/systemd/system/mysql.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/mysqld.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /usr/lib/systemd/system/mariadb.service.

(15) # /usr/bin/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
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] 
Enabled successfully!
Reloading privilege tables..
 ... Success!


You already have your root account protected, so you can safely answer 'n'.

Change the 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] 
 ... 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] 
 ... Success!

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] 
 - 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] 
 ... 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!

(16)# mysql -p -uroot
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 18
Server version: 10.4.14-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.000 sec)

MariaDB [(none)]> SELECT VERSION();
+-----------------+
| VERSION()       |
+-----------------+
| 10.4.14-MariaDB |
+-----------------+
1 row in set (0.000 sec)

MariaDB [(none)]> CREATE DATABASE test_db;
Query OK, 1 row affected (0.000 sec)

MariaDB [(none)]> CREATE USER 'test_user'@'localhost' IDENTIFIED BY "Strong34S;#";
Query OK, 0 rows affected (0.002 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON test_db.* TO 'test_user'@'localhost';
Query OK, 0 rows affected (0.002 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.000 sec)


MariaDB [(none)]>  DROP DATABASE test_db;
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> DROP USER 'test_user'@'localhost';
Query OK, 0 rows affected (0.002 sec)

MariaDB [(none)]> quit
Bye
# 

(17)
#  firewall-cmd --add-service=mysql --permanent
FirewallD is not running

# firewall-cmd --reload
FirewallD is not running