Installing Flarum on CentOS 7

Installing Flarum on CentOS 7

7月 7, 2024 · 1 分钟阅读时长 · 182 字 · -阅读 -评论

Installing PHP 7.3

sudo yum install epel-release -y
sudo yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
sudo yum install yum-utils -y
sudo yum-config-manager --enable remi-php73
sudo yum install php php-cli php-fpm php-mysqlnd php-json php-opcache php-xml php-mbstring php-tokenizer php-curl php-zip php-gd -y

# Check version
php -v

MySQL8

yum localinstall -y https://dev.mysql.com/get/mysql80-community-release-el7-2.noarch.rpm
yum install -y mysql-community-server

rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2023


# Get temporary password
grep 'temporary password' /var/log/mysqld.log

# Initialize DB configuration

Installing the Forum

# flarum is the folder under the current directory
composer create-project flarum/flarum flarum

Caddy

Here I use Caddy

# Forum
forum.xxx.cn {
    root * /var/www/flarum/public
    php_fastcgi unix//var/run/php-fpm/php-fpm.sock
    header /assets/* {
        +Cache-Control "public, must-revalidate, proxy-revalidate"
        +Cache-Control "max-age=25000"
        Pragma "public"
    }
    file_server
}

Installing Flarum Plugins

# Chinese language pack
composer require flarum-lang/chinese-simplified

# Upload plugin
composer require fof/upload

# sitemap
composer require fof/sitemap

After installing plugins, you need to enable the corresponding plugins in the admin panel.

Data Backup

  1. Copy the vendor folder, composer.json, and composer.lock to the newly built flarum folder on the new server.
  2. Export the entire database and then import it into the new server.
Alan H
Authors
开发者,数码产品爱好者,喜欢折腾,喜欢分享,喜欢开源