将WordPress服务器安装在Clear Linux上(第一部分)
想做的事情我想要将通过定点摄像机拍摄的影像作为一个美观的网页展示出来。既然已经准备好了ClearLinux,那就试试在ClearLinux上使用WordPress展示吧!(虽然已经在Ubuntu上完成了这个任务,但在ClearLinux上操作也有其意义!?)
所以这次内容会有点长,我将分成两部分进行。首先是第一部分,配置phpMyAdmin。
顺便提一下,目前的版本是
clear~ $ uname -a
Linux clear 5.16.5-1120.native #1 SMP Tue Feb 1 10:03:19 PST 2022 x86_64 GNU/Linux
作为LAMP服务器的启动
$ sudo swupd update
$ sudo systemctl enable httpd.service
$ sudo systemctl start httpd.service
$ sudo systemctl status httpd.service
$ sudo systemctl status httpd.service
パスワード:
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor pre>
Active: active (running) since Mon 2022-02-07 16:33:13 JST; 11min ago
Main PID: 4177 (httpd)
Status: "Processing requests..."
Tasks: 157 (limit: 9250)
Memory: 38.4M
CGroup: /system.slice/httpd.service
├─4177 /usr/sbin/httpd -DFOREGROUND -k start
├─4182 /usr/sbin/httpd -DFOREGROUND -k start
├─4183 /usr/sbin/httpd -DFOREGROUND -k start
└─4184 /usr/sbin/httpd -DFOREGROUND -k start
$ sudo swupd update
$ sudo systemctl enable httpd.service
$ sudo systemctl start httpd.service
$ sudo systemctl status httpd.service
$ sudo systemctl status httpd.service
パスワード:
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor pre>
Active: active (running) since Mon 2022-02-07 16:33:13 JST; 11min ago
Main PID: 4177 (httpd)
Status: "Processing requests..."
Tasks: 157 (limit: 9250)
Memory: 38.4M
CGroup: /system.slice/httpd.service
├─4177 /usr/sbin/httpd -DFOREGROUND -k start
├─4182 /usr/sbin/httpd -DFOREGROUND -k start
├─4183 /usr/sbin/httpd -DFOREGROUND -k start
└─4184 /usr/sbin/httpd -DFOREGROUND -k start
如果在 http://localhost 上显示为 “It works!”,就可以了。
在CL中,HTTPD的错误设置保存在”/usr/share/defaults/httpd.httpd.conf”中,但通常我们会将其配置保存在”/etc/httpd/conf.d/”这个位置。
$ cat httpd.conf
#
# Set a new location for DocumentRoot
#
DocumentRoot "/var/www/html"
#
# Relax access to content within /var/www/html
#
<Directory "/var/www/html">
AllowOverride none
Require all granted
</Directory>
然后,MariaDB
clear~ $ sudo swupd bundle-add database-basic
パスワード:
Loading required manifests...
Warning: Bundle "database-basic" is invalid, skipping it...
Failed to install 1 of 1 bundles
clear~ $ sudo swupd bundle-add database-basic
パスワード:
Loading required manifests...
Warning: Bundle "database-basic" is invalid, skipping it...
Failed to install 1 of 1 bundles
根据参考页面上的信息,应该有一个名为database-basic的捆绑包,但是却找不到。所以,
clear~ $ sudo swupd bundle-add mariadb
Loading required manifests...
Downloading packs (95.92 MB) for:
- mariadb
[100%]
Finishing packs extraction...
Validate downloaded files
[100%]
No extra files need to be downloaded
[100%]
Installing files...
[100%]
Calling post-update helper scripts
External command: pacrunner.service: restarted (the binary was updated)
External command: php-fpm.service: restarted (the binary was updated)
External command: httpd.service: restarted (the binary was updated)
Successfully installed 1 bundle
clear~ $ sudo systemctl status mariadb
○ mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor >
Active: inactive (dead)
clear~ $
clear~ $ sudo systemctl enable --now mariadb
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /usr/lib/systemd/system/mariadb.service.
clear~ $ sudo systemctl status mariadb
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor p>
Active: active (running) since Mon 2022-02-07 17:49:25 JST; 2s ago
Main PID: 6483 (mysqld)
Tasks: 17 (limit: 9250)
Memory: 65.4M
CGroup: /system.slice/mariadb.service
└─6483 /usr/bin/mysqld --pid-file=/run/mariadb/mariadb.pid
clear~ $
clear~ $ 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
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] n
... skipping.
You already have your root account protected, so you can safely answer 'n'.
Change the root password? [Y/n] n
... skipping.
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] 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...
... 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!
MariaDB版本10.6.5
PHP版本8.1.2
安装phpMyAdmin。首先,从https://www.phpmyadmin.net/downloads/下载phpMyAdmin文件。
本次下载的版本是v5.1.2。
解压ZIP文件,并将解压后的文件夹直接移动到命令行的文档根目录下。
sudo mv phpMyAdmin-5.1.2-all-languages /var/www/html/phpMyAdmin
・・・前出のスクリプトの切り出し・・・
You already have your root account protected, so you can safely answer 'n'.
Switch to unix_socket authentication [Y/n] n
... skipping.
我在这里遇到了麻烦,无法继续前进,于是上网搜索,发现在安装MariaDB时有人遇到了类似的问题,解决方法有很多种。最终,我通过将密码设置到SQL数据库的用户中解决了问题。
$ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 5
Server version: 10.6.5-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)]> SELECT user,password,plugin, authentication_string from mysql.user;
+-------------+----------+-----------------------+-----------------------+
| User | Password | plugin | authentication_string |
+-------------+----------+-----------------------+-----------------------+
| mariadb.sys | | mysql_native_password | |
| root | | mysql_native_password | |
| mysql | invalid | mysql_native_password | invalid |
+-------------+----------+-----------------------+-----------------------+
3 rows in set (0.011 sec)
MariaDB [(none)]> set password for root@localhost=password("YourPasswd");
Query OK, 0 rows affected (0.014 sec)
MariaDB [(none)]> SELECT user,password,plugin, authentication_string from mysql.user;
+-------------+-------------------------------------------+-----------------------+-------------------------------------------+
| User | Password | plugin | authentication_string |
+-------------+-------------------------------------------+-----------------------+-------------------------------------------+
| mariadb.sys | | mysql_native_password | |
| root | *5C5423970*********3362C1FCD5 | mysql_native_password | *5C5423970C9B************E13362C1FCD5 |
| mysql | invalid | mysql_native_password | invalid |
+-------------+-------------------------------------------+-----------------------+-------------------------------------------+
3 rows in set (0.001 sec)
MariaDB [(none)]> commit;
准备安装WordPress的下一步
我本来认为CL项目文件中的文章质量很高,但是随着接近中级版WordPress安装的部分,我越来越觉得有点不对劲。
参考链接:
https://docs.01.org/clearlinux/latest/tutorials/lamp-server.html
请查阅以下链接参考:
https://docs.01.org/clearlinux/latest/tutorials/lamp-server.html
sudo mv phpMyAdmin-5.1.2-all-languages /var/www/html/phpMyAdmin

・・・前出のスクリプトの切り出し・・・
You already have your root account protected, so you can safely answer 'n'.
Switch to unix_socket authentication [Y/n] n
... skipping.
我在这里遇到了麻烦,无法继续前进,于是上网搜索,发现在安装MariaDB时有人遇到了类似的问题,解决方法有很多种。最终,我通过将密码设置到SQL数据库的用户中解决了问题。
$ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 5
Server version: 10.6.5-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)]> SELECT user,password,plugin, authentication_string from mysql.user;
+-------------+----------+-----------------------+-----------------------+
| User | Password | plugin | authentication_string |
+-------------+----------+-----------------------+-----------------------+
| mariadb.sys | | mysql_native_password | |
| root | | mysql_native_password | |
| mysql | invalid | mysql_native_password | invalid |
+-------------+----------+-----------------------+-----------------------+
3 rows in set (0.011 sec)
MariaDB [(none)]> set password for root@localhost=password("YourPasswd");
Query OK, 0 rows affected (0.014 sec)
MariaDB [(none)]> SELECT user,password,plugin, authentication_string from mysql.user;
+-------------+-------------------------------------------+-----------------------+-------------------------------------------+
| User | Password | plugin | authentication_string |
+-------------+-------------------------------------------+-----------------------+-------------------------------------------+
| mariadb.sys | | mysql_native_password | |
| root | *5C5423970*********3362C1FCD5 | mysql_native_password | *5C5423970C9B************E13362C1FCD5 |
| mysql | invalid | mysql_native_password | invalid |
+-------------+-------------------------------------------+-----------------------+-------------------------------------------+
3 rows in set (0.001 sec)
MariaDB [(none)]> commit;

准备安装WordPress的下一步
我本来认为CL项目文件中的文章质量很高,但是随着接近中级版WordPress安装的部分,我越来越觉得有点不对劲。
参考链接:
https://docs.01.org/clearlinux/latest/tutorials/lamp-server.html
请查阅以下链接参考:
https://docs.01.org/clearlinux/latest/tutorials/lamp-server.html


参考链接:
https://docs.01.org/clearlinux/latest/tutorials/lamp-server.html
请查阅以下链接参考:
https://docs.01.org/clearlinux/latest/tutorials/lamp-server.html