[Operation and Maintenance Engineer Learning Six] LAM Deployment and Building a Personal Discuz Forum

1. Uninstall Mariadb first and then install Mysql

systemctl stop mariadb
yum remove mariadb

2. MySQL official website rpm package download

https://dev.mysql.com/downloads/repo/yum/insert image description here

wget https://dev.mysql.com/get/你要下载的rpm包
wget https://dev.mysql.com/get/mysql80-community-release-el8-5.noarch.rpm

insert image description here

  • Find the download location
ls /etc/yum.repos.d
  • If it is not in the above position, it will be under the path just downloaded
ls 

insert image description here

3. Install the YUM Repo file under the rpm package path

yum localinstall mysql80-community-release-el8-5.noarch.rpm

insert image description here

4. Update the local database information of the software warehouse

yum makecache

insert image description here

yum list | grep mysql

insert image description here

mysql_upgrade -u root –p
  • Update the database (the password is your previous MariaDB root password). So far the DB installation is complete.

5. Start deployment - php installation

The apache installed by default does not support php.
There are also php binary packages in the system’s own software warehouse, but the binary packages about php in the software warehouse are compiled separately according to functional components, that is, the main program of php is compiled into a package, and other components such as gd library, mysql library, xml library, etc. etc. are compiled separately. If these libraries need to be used in the website code, they all need to be installed. The documentation of the general code will explain which libraries are needed for support. After reading the readme file of Discuz, except for the description of the database, there is no description of the others, so only two are installed this time. Use the following installation commands:

yum install -y php php-mysql

insert image description here

  • The reason for the error Error: Unable to find a match: php-mysql
    is that the name of the new version has changed. In order to avoid the change next time, use the next command to check the name before installing

6. Search for yum packages

yum search php-mysql
  • Start the installation after changing the name
yum install -y php php-mysqlnd

insert image description here

7. Start deployment - configure apache to support php

(1) Configuration enables apache to execute php scripts

After installing php and related components (libraries), you need to make relevant configurations in apache to enable apache to execute php scripts (codes). The configuration is as follows:
Edit httpd.conf (the path of the apache configuration file installed by yum is /etc/httpd/conf/httpd.conf) file
1, find AddType text/html .shtml, add under others AddType application/x-httpd-php .php
2, find DirectoryIndex index.html, and modify it toDirectoryIndex index.html index.php

insert image description here
insert image description here

(2) After modifying the configuration, restart apache to make the configuration take effect.

systemctl restart httpd

insert image description here

8. Start deployment - configure apache to support php

After configuring apache, you need to check whether apache supports php normally. The test method is to add a php file in the root directory of the website, the file name is arbitrary, such as phptest.php, and the file content is as follows:

<?php
phpinfo();
?>

insert image description here
This is the simplest php code because it has only one function phpinfo(). Since the function of this file is to detect whether the server supports PHP, this file is also called a probe. But this is the simplest probe file. There are many powerful php probe scripts on the Internet, which can be searched and downloaded to have a look.

Here I set phptest.php as the default startup page, which can be accessed directly through ip, of course, it can also be accessed through the path
insert image description here

insert image description here

9. Journalctl troubleshooting

If an error occurs during the configuration process and it cannot be started, you can use journalctl -xe to troubleshoot the error. For specific operations, please refer to the following example:
insert image description here

journalctl -xe
  • Go to the specified file and delete the content of line 311

insert image description here

10. Start deployment - create database

create database discuz;
show databases;

insert image description here

11. Create a separate account for discuz

CREATE USER 'dztest'@'localhost'IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON discuz.* TO 'dztest'@'localhost';

insert image description here

  • Upload the website code to apache specified DocumentRoot directory

insert image description here
Here, Xftp is used for uploading. After the upload is successful, please ensure that the owner of all files in the root directory of the website is the apache running user. The running user name of apache installed with yum is gee (here is changed to your user name), so after uploading the code file, I executed the permission modification command to ensure that the owner of all files on the website is gee. The command is as follows:

chown -R apache:gee /var/www/html

insert image description here

12. Website Installer

你的ip/upload/install/index.php

insert image description here
insert image description here

(1) Rely on supplements

  • Search for the full name of the missing dependency through yum, here is the missing json dependency as an example (search for what is missing):
yum search php-json  #search啥看你缺少啥,他会提示的,我这里缺少的是json
yum install php-json

insert image description here
insert image description here

  • The database is created as the discuz created earlier, of course, you can use the default one as long as you maintain it later and know that it is the Discuz forum database.

insert image description here
insert image description here
insert image description here
insert image description here

  • At this point, the installation is complete. The following shows Discuz's user management center, home page, and management background

insert image description here
insert image description here
insert image description here

Guess you like

Origin blog.csdn.net/weixin_43576565/article/details/131682885