马春杰杰 Exit Reader Mode

宝塔面板安装OLAINDEX 5.0教程

官网上的教程太旧了(2020年09月04日19:38:23),还是4.0的。有几个命令有错误,在这里写个修改版的备份一下:

安装要求:

宝塔linux6.0版本是基于centos7开发的,强烈建议使用centos7.x 系统
提示:Centos官方已宣布在2020年停止对Centos6的维护更新,各大软件开发商也逐渐停止对Centos6的兼容,新服务器不建议使用Centos6

以下主机商必看(开端口教程,不开不能用):

下面安装默认以达到以上要求。

宝塔安装

安装面板命令:

Centos安装命令:

yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh

Ubuntu/Deepin安装命令:

wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh

Debian安装命令:

wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && bash install.sh

Fedora安装命令:

wget -O install.sh http://download.bt.cn/install/install_6.0.sh && bash install.sh


Linux面板6.9.6升级命令:

curl http://download.bt.cn/install/update6.sh|bash

其他系统安装查看

安装完毕,根据返回信息登陆宝塔面板:

安装PHP环境

注意: PHP 环境选择 7.1 以上,这里选择 7.3(作者用的7.2)

开始安装等待环境安装完毕,我们开始安装扩展

安装PHP扩展

点击 设置 安装扩展

这里安装 fileinfo 扩展 并附带安装 opcache 扩展 以加速php运行,也可以安装 redis 和memcached 扩展。

修改 php.ini 文件

修改 PHP 配置,需要关闭几个禁用的函数

分别是 exec 、 shell_exec 、 proc_open 、proc_get_status 这四个函数。

修改 composer 源(国外服务器请忽略)

宝塔面板默认安装了 Composer 包管理器

进入命令行Console,执行以下命令更换为国内源

/www/server/php/73/bin/php /www/server/php/73/bin/composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ # 更换源为国内源,国外服务器可忽略此步骤

到此基本的PHP环境准备完毕

安装配置 OLAINDEX

建站

这里选择新建站点,填写域名后,保持默认配置。

站点的具体配置,我们到后面再配置。

初始化 OLAINDEX

首先打开宝塔ssh

按照以下步骤执行:

cd web目录 # 刚才新建站点的目录 这里是 /www/wwwroot/t_ningkai_wang
git clone https://github.com/WangNingkai/OLAINDEX.git tmp 
mv tmp/.git . 
rm -rf tmp 
git reset --hard 
cp database/database.sample.sqlite database/database.sqlite  
# 数据库文件,5.0缺少这个文件,可以从4.0下载一个,我这里备份了,下载地址见文末。

/www/server/php/73/bin/php /www/server/php/73/bin/composer install -vvv # 这里确保已经安装composer成功  # 如果报权限问题,建议先执行权限命令
chmod -R 755 storage/
chown -R www:www *
/www/server/php/73/bin/php /www/server/php/73/bin/composer run install-app

到此我们安装好了OLAINDEX

配置站点信息

首先站点目录

如图:勾选取消 防跨站攻击(open_basedir) 将站点的运行目录改为 public 别忘了保存

修改伪静态

选择 Laravel 5,保存

修改配置文件

注释选定内容,防止图片出现404

配置SSL

选择 Let’s Encrypt 申请,按要求填写申请

开启 SSL 后,选择强制 HTTPS

保存后,打开网站即可配置

配置Onedrive

别忘了开通SSL,然后把上面url改为:https://xxxx.xxxxx.xxx/callback,然后点击申请,

然后就可以了。

几个错误解决

1.  Script php artisan install handling the install-app event returned with error code 1

> php artisan install
   ____  __    ___    _____   ______  _______  __
  / __ \/ /   /   |  /  _/ | / / __ \/ ____/ |/ /
 / / / / /   / /| |  / //  |/ / / / / __/  |   /
/ /_/ / /___/ ___ |_/ // /|  / /_/ / /___ /   |
\____/_____/_/  |_/___/_/ |_/_____/_____//_/|_|

v5.0.0
- Designed by IMWNK | Powered by OLAINDEX

Database not found,Creating...
Env file not found,Creating...

 Already have [.env] ,overwrite? (yes/no) [yes]:
 > Configuration cache cleared!
Configuration cached successfully!

   Illuminate\Database\QueryException 

  SQLSTATE[HY000] [1044] Access denied for user ''@'localhost' to database 'forge' (SQL: select * from information_schema.tables where table_schema = forge and table_name = migrations and table_type = 'BASE TABLE')

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:671
    667|         // If an exception occurs when attempting to run a query, we'll format the error
    668|         // message to include the bindings with SQL, which will make this exception a
    669|         // lot more helpful to the developer instead of just the database's errors.
    670|         catch (Exception $e) {
  > 671|             throw new QueryException(
    672|                 $query, $this->prepareBindings($bindings), $e
    673|             );
    674|         }
    675|

      +33 vendor frames 
  34  app/Console/Commands/InstallCommand.php:92
      Illuminate\Console\Command::call("migrate", [])

      +14 vendor frames 
  49  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
Script php artisan install handling the install-app event returned with error code 1

据说是PHP版本的问题,问题出在composer.json中,找到其中的php版本,改为宝塔中使用的PHP版本,不过我不是用的这个方法,我是安装了一遍composer.json中的PHP版本,然后重新跑了一遍。

还有Script php artisan install handling the install-app event returned with error code 255这个错误。估计是同一个。

2 This package requires php ^7.2.5 but your PHP version (7.1.33) does not satisfy that requirement.

3 宝塔 OLAINDEX 各版本修改密码方法 | OLAINDEX 密码忘了怎么办?

 

本文最后更新于2021年8月2日,已超过 1 年没有更新,如果文章内容或图片资源失效,请留言反馈,我们会及时处理,谢谢!