-
-
Notifications
You must be signed in to change notification settings - Fork 264
Installation (Ubuntu22 Apache PHP8.1 Typesense MongoDB)
Irfan edited this page Jun 21, 2022
·
1 revision
ℹ This installation guide is for Jikan REST API v4 only.
- PHP 8.1
- Composer 2
- Git
-
MongoDB*
- Does not require a self-managed installation, you can connect to a cloud-managed MongoDB instance as well
- Apache (optional)
- Typesense(https://typesense.org/docs/guide/install-typesense.html#%F0%9F%93%A5-download-install)
✅ Tested with Ubuntu 22 LTS
- Install Git and build-essentials for compiling the PHP MongoDB Driver
sudo apt install git build-essential
- Install PHP 8.1 and required dependencies
apt install php php-{xml,mbstring,common,curl,pear,dev}
- Note:
pear
will install PECL for you
- Install PHP MongoDB Driver
sudo pecl install mongodb
- Add
extension=mongodb.so
to yourphp.ini
(On Ubuntu 20 it will be in/etc/php/8.0/
)
-
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
You can use Apache to host the Jikan REST API (it's what I use personally too)
sudo apt install apache2
- Set
AllowOverride All
in/etc/apache2/apache2.conf
for<Directory /var/www/>
- 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)
- By default it's in
- Enable Mod Rewrite and Mod Deflate (for GZIP'd responses)
sudo a2enmod deflate && sudo a2enmod rewrite
- Restart the Apache server
sudo service apache2 restart
- 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
- If you haven't installed Composer 2 yet, now's the time
- Make sure you have appropriate write permissions for
/var/www/jikan-rest
- Install Jikan REST API v4 dependencies
-
composer install
(If you have Composer installed Globally. php path/to/composer.phar install
-
- Copy Environment variables
-
cp .env.dist .env
(Read: Configuring your Jikan REST API v4 Instance)
-
- Run Database Migrations with
php artisan migrate
- 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
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 purposes, you can use PHP's own built-in webserver
- Run the following in
/var/www/jikan-rest
:php artisan serve
(Read: Artisan Commands)
- Run the following in
- ℹ️ If you wish to configure it for Nginx or anything else, you'll have to port the rewrite rules located at
public/.htaccess
https://github.com/jikan-me/jikan-rest/wiki/Configuration
Please read the troubleshooting guide. For any additional help, join our Discord server.
Please read the commands guide. For any additional help, join our Discord server.
If you don't want to host your instance, there's a public API available.
See the list of wrappers here