Disk /dev/sdc: 3.81 TiB, 4194304000000 bytes, 1024000000 sectors Disk model: SSD Units: sectors of 1 * 4096 = 4096 bytes Sector size (logical/physical): 4096 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disklabel type: dos Disk identifier: 0x00000000Device Boot Start End Sectors Size Id Type /dev/sdc1 4294967295 8589934589 4294967295 16T ff BBT /dev/sdc2 4294967295 8589934589 4294967295 16T ff BBT /dev/sdc3 4294967295 8589934589 4294967295 16T ff BBT /dev/sdc4 4294967295 5035196669 740229375 2.8T ff BBT
上は購入当初のUSBで fdisk -l を実行した時の状況であるが認識していない。
色々やってみた結果、windowsでexfatフォーマットした4TのUSBを
$ mount -t exfat-fuse /dev/sdc1 /mnt/usbでマウントできた。これを実施する前は
$ sudo mount /dev/sdc1 /mnt/usb mount: /mnt/usb: wrong fs type, bad option, bad superblock on /dev/sdc1, missing codepage or helper program, or other error.
以下のコマンドで、MariaDB の初期設定を実行します。 ・Enter current password for root (enter for none):カレントパスワードは空なので、何も押さずにエンターキー押下。・Switch to unix_socket authentication [Y/n]「unix_socket authentication」は無効化したいので、「n」を入力し、エンターキー押下。・You already have your root account protected, so you can safely answer ‘n’.rootパスワードを変更したいので、「Y」を入力し、エンターキー押下。 設定したいrootパスワードを入力し、エンターキー押下。 入力確認で、設定したいrootパスワードを再度入力し、エンターキー押下。・Remove anonymous users? [Y/n]アノニマスユーザーを削除したいので、「Y」を入力し、エンターキー押下。・Disallow root login remotely? [Y/n]ルートのリモートログインは許可したくないので、「Y」を入力し、エンターキー押下。・Remove test database and access to it? [Y/n]テストデータベースは削除したいので、「Y」を入力し、エンターキー押下。・Reload privilege tables now? [Y/n]権限テーブルをすぐに反映させたいので、「Y」を入力し、エンターキー押下。
Apache WebサーバからPHPを使用する際に必要になるphp-fpmのインストールを行います。 php-fpmは、FPM(FastCGI Process Manager)と言われるPHPのFastCGI実装のひとつです。
pi@raspberrypi:~ $ sudo apt install php7.4-fpm
パッケージリストを読み込んでいます... 完了
~(中略)~
Creating config file /etc/php/7.4/fpm/php.ini with new version
NOTICE: Not enabling PHP 7.4 FPM by default.
NOTICE: To enable PHP 7.4 FPM in Apache2 do:
NOTICE: a2enmod proxy_fcgi setenvif
NOTICE: a2enconf php7.4-fpm
NOTICE: You are seeing this message because you have apache2 package installed.
Created symlink /etc/systemd/system/multi-user.target.wants/php7.4-fpm.service → /lib/systemd/system/php7.4-fpm.service.
man-db (2.8.5-2) のトリガを処理しています ...
systemd (241-7~deb10u6+rpi1) のトリガを処理しています ...
php7.4-fpm (7.4.15-2+0~20210212.37+debian10~1.gbp5dee47) のトリガを処理しています ...
NOTICE: Not enabling PHP 7.4 FPM by default.
NOTICE: To enable PHP 7.4 FPM in Apache2 do:
NOTICE: a2enmod proxy_fcgi setenvif
NOTICE: a2enconf php7.4-fpm
NOTICE: You are seeing this message because you have apache2 package installed.
pi@raspberrypi:~ $
AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1. Set the ‘ServerName’ directive globally to suppress this message
pi@raspberrypi:~ $ sudo a2enmod rewrite
Enabling module rewrite.
To activate the new configuration, you need to run:
systemctl restart apache2
pi@raspberrypi:~ $
pi@raspberrypi:~ $ sudo mysql -u root -p
Enter password: <-- [Enter]を押します。
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 12
Server version: 10.3.27-MariaDB-0+deb10u1 Raspbian 10
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)]> quit
Bye
pi@raspberrypi:~ $
pi@raspberrypi:~ $ sudo 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): <== [Enter]を押します。
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 <== rootパスワード設定するため、[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 <== 匿名ユーザーを削除するため、[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] Y <== リモート接続を拒否するため、[Y]を入力します。
... 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] Y <== 不要なテストデータベースを削除するため
- Dropping test database... [Y]を入力します。
... 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! [Y]を入力します。
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
pi@raspberrypi:~ $
初期設定の変更
インストール直後の初期状態では、「mysql -u root -p」コマンドで接続することができませんが、「sudo mysql -u root -p」コマンドでは、接続できる状態になっています。
pi@raspberrypi:~ $ mysql -u root -p
Enter password:
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
pi@raspberrypi:~ $ sudo mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 59
Server version: 10.3.27-MariaDB-0+deb10u1 Raspbian 10
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)]> quit
Bye
pi@raspberrypi:~ $
pi@raspberrypi:~ $ sudo mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 64
Server version: 10.3.27-MariaDB-0+deb10u1 Raspbian 10
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)]> grant all privileges on *.* to root@localhost identified by 'password' with grant option;
Query OK, 0 rows affected (0.001 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.001 sec)
MariaDB [(none)]> quit
Bye
pi@raspberrypi:~ $
「mysql -u root -p」で接続できることを確認します。
pi@raspberrypi:~ $ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 66
Server version: 10.3.27-MariaDB-0+deb10u1 Raspbian 10
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)]> quit
Bye
pi@raspberrypi:~ $
pi@raspberrypi:~ $ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 13
Server version: 10.3.27-MariaDB-0+deb10u1 Raspbian 10
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)]> CREATE DATABASE db_wordpress;
Query OK, 1 row affected (0.001 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON db_wordpress.* TO "wp_user"@"localhost" IDENTIFIED BY "password";
Query OK, 0 rows affected (0.003 sec)
MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.001 sec)
MariaDB [(none)]> quit
Bye
pi@raspberrypi:~ $