Skip to content

Installation (Ubuntu22 Apache PHP8.1 Typesense MongoDB)

Irfan edited this page Jun 21, 2022 · 1 revision

Manual Installation

This installation guide is for Jikan REST API v4 only.

✅ Tested with Ubuntu 22 LTS


Getting Started

Prerequisites

  1. Install Git and build-essentials for compiling the PHP MongoDB Driver
    • sudo apt install git build-essential
  2. Install PHP 8.1 and required dependencies
    • apt install php php-{xml,mbstring,common,curl,pear,dev}
    • Note: pear will install PECL for you
  3. Install PHP MongoDB Driver
    • sudo pecl install mongodb
    • Add extension=mongodb.so to your php.ini (On Ubuntu 20 it will be in /etc/php/8.0/)
  4. Download and Install the latest Typesense version
    • curl -O https://dl.typesense.org/releases/0.23.0/typesense-server-0.23.0-amd64.deb
    • apt install ./typesense-server-0.23.0-amd64.deb

Installing Apache

You can use Apache to host the Jikan REST API (it's what I use personally too)

  1. sudo apt install apache2
  2. Set AllowOverride All in /etc/apache2/apache2.conf for <Directory /var/www/>
  3. Edit your virtual host document root
    • By default it's in /etc/apache2/sites-available/000-default.conf: DocumentRoot /var/www/jikan-rest/public
    • If you have other sites, you can set up a different virtual host (Learn More)
  4. Enable Mod Rewrite and Mod Deflate (for GZIP'd responses)
    • sudo a2enmod deflate && sudo a2enmod rewrite
  5. Restart the Apache server
    • sudo service apache2 restart

Installing Jikan REST API v4

  1. Clone the repo in /var/www
    • git clone https://github.com/jikan-me/jikan-rest.git
    • Jikan REST API v4 will now be in /var/www/jikan-rest
    • Change Directory: cd jikan-rest
  2. If you haven't installed Composer 2 yet, now's the time
  3. Make sure you have appropriate write permissions for /var/www/jikan-rest
  4. Install Jikan REST API v4 dependencies
    • composer install (If you have Composer installed Globally.
    • php path/to/composer.phar install
  5. Copy Environment variables
    • cp .env.dist .env (Read: Configuring your Jikan REST API v4 Instance)
  6. Run Database Migrations with php artisan migrate
  7. Enable the scheduler by adding it to corntab -e
    • * * * * * cd /var/www/jikan-rest && php artisan schedule:run >> /dev/null 2>&1
    • You can modify the scheduler here

Ignition

Apache

Your very own Jikan REST API v4 is now good to go! - Tune into localhost/v4 to access the API if you're using Apache

For Development

  • For Development purposes, you can use PHP's own built-in webserver

Nginx/Other Web Servers

  • ℹ️ If you wish to configure it for Nginx or anything else, you'll have to port the rewrite rules located at public/.htaccess

Configuration

https://github.com/jikan-me/jikan-rest/wiki/Configuration


Troubleshooting

Please read the troubleshooting guide. For any additional help, join our Discord server.

Artisan Commands

Please read the commands guide. For any additional help, join our Discord server.

Information

If you don't want to host your instance, there's a public API available.

Wrappers

See the list of wrappers here