0%

BookStack 填坑指南

安装 BookStack 过程中遇到的问题及解决方案

安装指南

  1. How to Install BookStack on Ubuntu 18.04 LTS
    • MariaDB
  2. Ubuntu 18.04 Installation Script
    • MySQL

采用 MySQL 管理数据

MySQL

执行如下命令失败:

mysql -u root --execute="CREATE DATABASE bookstack;"
mysql -u root --execute="CREATE USER 'bookstack'@'localhost' IDENTIFIED BY '$DB_PASS';"
mysql -u root --execute="GRANT ALL ON bookstack.* TO 'bookstack'@'localhost';FLUSH PRIVILEGES;"

MySQL fails on: mysql “ERROR 1524 (HY000): Plugin ‘auth_socket’ is not loaded”

  • I

      $ sudo /etc/init.d/mysql stop # stop mysql service
      $ sudo mysqld_safe --skip-grant-tables & # start mysql without password
      # enter -> go
      $ mysql -uroot # connect to mysql
  • Socket issue: ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’

      $ sudo mkdir -p /var/run/mysqld; sudo chown mysql /var/run/mysqld
      $ sudo mysqld_safe --skip-grant-tables &
  • run mysql commands => copy paste this to cli manually

      use mysql; # use mysql table
      update user set authentication_string=PASSWORD("") where User='root'; # update password to nothing
      update user set plugin="mysql_native_password" where User='root'; # set password resolving to default mechanism for root user
    
      flush privileges;
      quit;
  • F

      $ sudo /etc/init.d/mysql stop
      $ sudo /etc/init.d/mysql start # reset mysql
      # try login to database, just press enter at password prompt because your password is now blank
      $ mysql -u root -p

ERROR 1728 (HY000): Cannot load from mysql.user. The table is probably corrupted

$ mysql_upgrade -uroot -p --force

Column count of mysql.user is wrong. Expected 42, found 44. The table is probably corrupted

$ mysql -u root -p
mysql> use mysql;
mysql> alter table mysql.user drop column default_role;
mysql> alter table mysql.user drop column max_statement_time;
mysql> alter table mysql.user drop column password_expired;
mysql> quit;

手动执行上述三条语句,创建成功

composer

部分需要访问 github.com 导致安装失败

$ sudo composer config repo.packagist composer https://mirrors.aliyun.com/composer/
$ sudo composer install

Apache2

启动失败,原因是 80 端口被占用

$ sudo netstat -ltnp | grep ':80'
$ sudo lsof -i :80
$ sudo systemctl stop nginx.service

wkhtmltopdf

手动安装最新版本

$ wget https://downloads.wkhtmltopdf.org/0.12/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb
$ apt-get install fontconfig libxrender1 xfonts-75dpi xfonts-base
$ dpkg -i wkhtmltox_0.12.5-1.bionic_amd64.deb

测试

$ wkhtmltopdf http://www.baidu.com baidu.pdf

ProcessTimedOutException when exporting with wkhtmltopdf
BookStack 导出携带不存在图片文章时出错,修改 BookStack/config/snappy.php 中超时 timeout 为 3600