0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

TestLink を MariaDB で導入

Posted at

#前回からの経緯

前回、TestLinkをpostgresqlで導入をお試みたがうまくいかなかったので、今後はMariaDBに置き換えて引き続きTestLinkの導入を試みる。

MariaDBをインストール

sudo dnf install -y name=mariadb-server
sudo dnf install -y name=php81-php-mysqlnd

MariaDB を初期化

$ 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] 
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!
$ sudo systemctl start mariadb

またエラー

画面上は、エラーと表示されていないが、中途半端な出力に見える。
スクリーンショット 2023-10-23 21.10.13.png

# /var/opt/remi/php81/log/php-fpm/www-error.log
[22-Oct-2023 20:19:07 UTC] PHP Fatal error:  Uncaught TypeError: fwrite(): Argument #1 ($stream) must be of type resource, bool given in /var/www/html/testlink/install/installNewDB.php:636
Stack trace:
#0 /var/www/html/testlink/install/installNewDB.php(636): fwrite()
#1 /var/www/html/testlink/install/installNewDB.php(534): write_config_db()
#2 {main}
  thrown in /var/www/html/testlink/install/installNewDB.php on line 636

installNewDB.phpの636行目を元にソースコードを見てみる。
../config_db.inc.phpの書き込みができずにエラーになったのでは無いかと推測。installNewDB.phpの1つ上のディレクトリ階層に書き込みできるように設定指定みる。

    533 $cfg_file = "../config_db.inc.php";
    534 $yy = write_config_db($cfg_file,$data);
省略
    598 function write_config_db($filename, $data)
    599 {
    600   $ret = array('status'     => 'ok', 'cfg_string' => '');
省略
    630   if (@!$handle = fopen($filename, 'w'))
    631   {
    632     $ret['status'] = 'ko';
    633   }
    634 
    635   // Write $somecontent to our opened file.
    636   if (@fwrite($handle, $configString) === FALSE)
    637   {
    638     $ret['status'] = 'ko';
    639   }

selinuxの設定を行う

$ sudo /usr/sbin/semanage fcontext -a -t httpd_sys_rw_content_t /var/www/html/testlink
$ sudo /usr/sbin/restorecon -R /var/www/html/testlink

今度はうまく行ったようだ

スクリーンショット 2023-10-23 21.18.27.png
スクリーンショット 2023-10-23 21.18.38.png

トップページへアクセス

http://localhost/testlink
それっぽい画面が表示されるようになった。
スクリーンショット 2023-10-23 21.20.43.png
スクリーンショット 2023-10-23 21.21.36.png
スクリーンショット 2023-10-23 21.22.26.png

導入できた環境

  • CentOS Stream 9(5.14.0-319.el9.x86_64)
  • mariadb 10.5.16
  • php 8.1
  • testlink 2.0.0-20220827-PHP8.1
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?