最近要搭个论坛,试了几个开源的论坛程序,这其中就有flarum,虽然最后我还是选择用discourse了,但flarum的安装步骤还是在这里记录下,留给需要的人。
安装nginx/mariadb/certbot:
apt -y update apt -y install nginx python3-certbot-nginx mariadb-server
添加sury的php存储库:
apt -y install curl apt-transport-https ca-certificates lsb-release curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list apt -y update
安装php8.2:
apt -y install php8.2-common php8.2-fpm php8.2-curl \ php8.2-dom php8.2-gd php8.2-mbstring \ php8.2-mysql php8.2-zip
设置开机自启:
systemctl enable nginx mariadb php8.2-fpm
安装composer:
curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer
初始化mariadb:
mysql_secure_installation
登录到数据库:
mysql -u root -p
创建数据库和用户:
CREATE DATABASE flarum CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; GRANT ALL PRIVILEGES ON flarum.* TO flarum@localhost IDENTIFIED BY 'password'; FLUSH PRIVILEGES; quit
创建并进入到flarum目录:
mkdir -p /var/www/flarum cd /var/www/flarum
获取flarum以及安装所需的依赖、扩展:
composer create-project flarum/flarum .
修改目录权限和所有者:
chmod -R 775 /var/www/flarum chown -R www-data:www-data /var/www/flarum
新建nginx配置文件:
nano /etc/nginx/sites-available/flarum
写入如下配置:
server { server_name bbs.example.com; root /var/www/flarum/public; index index.php; client_max_body_size 0; location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php8.2-fpm.sock; } include /var/www/flarum/.nginx.conf; }
启用新的nginx配置:
ln -s /etc/nginx/sites-available/flarum /etc/nginx/sites-enabled/flarum
签发ssl证书:
certbot --nginx
访问你的域名填写各类信息完成安装:
如果需要修改php以及fpm相关的设置,例如文件上传大小、进程数量等:
nano /etc/php/8.2/fpm/pool.d/www.conf nano /etc/php/8.2/fpm/php.ini
重启phpfpm:
systemctl restart php8.2-fpm
论坛地址呢?
另外,请教一下大佬,有研究过flarum搬家到discourse吗?我以前用的就是flarum,坚持了几年实在是不合适,现在决定改用discourse,搬家有点难啊!
搬不了,既然坚持这么多年了那就将就用吧,或者干脆建个新的。
硬搬的话原理上讲能搬,但试了一下官方的工具没成功只好放弃,最终确实是新建了。https://meta.discourse.org/t/flarum-to-discourse-migration-script/191510/7
https://meta.discourse.org/t/migrate-from-another-forum-to-discourse/16616
其实弄个电报群更实际一点