Skip to content

TIP

This installation guide is for laravel 7.x version, if you are installing another version of laravel, please find it's instructions in the left menu.

Laravel 7.x Installation

This Installation guide has been split into 3 parts

  • Pre-requisites
  • Installation
  • after setup

Pre-requisites

To use JOSH which is a developer-oriented product, you should have a basic idea of following tools and make sure they are installed in your system.

Windows Users

If you don't want to install all of them manually, please download laragon

Git

you can check if you have git by running git --version in terminal, if you don't have it...you can get it from git-scm.com

or on *nix system, you can install by running apt-get install git command

nodejs

you can check if you have nodejs installed or not by running nodejs -v in terminal, if you don't have it... you can get it from nodejs.org

for *nix system, find instructions here https://nodejs.org/en/download/package-manager/

yarn

you can check for yarn existence by running yarn -v in terminal, if you don't have it, you can get from their website https://yarnpkg.com and follow instructions mentioned there

composer

you can check for composer existence by running composer -v in terminal and if you don't have it, get it from getcomposer.org

Installation

The zip file contains all laravel files integrated with josh, however, you need to perform the following steps to get vendors etc.

.env file and setting your values

Since everyone can have their own database name, mail settings etc, laravel doesn't ship with .env but .env.example which we copy as .env and modify with our DB details etc.

bash
cp .env.example .env

For Windows Users

cmd
copy .env.example .env

now open .env and modify database etc. details with yours

you need to modify the following values

sh
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

you may need to change other fields as well, if necessary

Get Composer packages

We don't add all vendors files into zip, hence you need to get them manually, running below command can get you all composer vendor packages

sh
composer install

Permissions

TIP

Windows users don't need follow these steps

Laravel requires directories within the storage and the bootstrap/cache directories should be writable by your web server

You should use the minimum permissions available for writing, based on how you've got your web server configured.

sh
chmod -R 775 storage

chmod 775 bootstrap/cache

If you still run into a permissions error, you may need to increase the permissions to 777, or twiddle your user/group permissions on your server.

sh

chmod -R 777 storage

chmod 777 bootstrap/cache

You'll also want to make sure that your laravel directory and all files within are owned by something other than root. It's very common to create a user on your server (like www-data), add that user to the apache group, and then chown your files to be owned by www-data, chgrp to the apache group.

This ensures your files can be executed correctly and cache files can be written to without having to give files owned by root the permissions to write or execute.

Mails

If you want to send emails from your website, you need to configure MAIL_DRIVER etc details in your .env file, if you don't want to send emails (ex: in dev environment), you can set MAIL_DRIVER to log and it will write all your emails to log files.

Global 'from' address

You can specify from address from each email from mailables however if you wish to have a single global from address then please modify config/mail.php below section with your values

php
'from' => [
        'address' => env('MAIL_FROM_ADDRESS', '[email protected]'),
        'name' => env('MAIL_FROM_NAME', 'Example'),
    ],

WARNING

If you want to use other mail drivers like sparkpost, mailgun etc, then please refer to https://laravel.com/docs/mail

Generate Key

To secure user sessions and other encrypted data, we need to set application key.

sh
php artisan key:generate

Add tables to the database

Now that, we have set up database details in .env, its time to migrate tables into database.

To have default admin user, we need to seed data into DB, to do that run below command, which inserts two users into the database along with two roles admin and user.

User emailpasswordRole
[email protected]adminadmin
[email protected]useruser
sh
php artisan migrate --seed

along with users, it also inserts all countries data into countries table.

TIP

If you want to have some dummy data in datatables examples, please run

php artisan db:seed --class=DatatablesSeeder

Compiling assets

Now we need to get frontend assets and move them to the proper place, please run the following commands.

yarn install

npm run dev

if everything compiles successfully, by now you should have a working website

you can access your website at http://URL/public (if not using virtualhosts) or http://URL (if using virtualhosts) and you can access admin section by going to http://URL/public/admin or http://URL/admin respectively.

After setup

Still, we need to get some keys and set up things to make sure josh is working properly

Uploads folders permission

TIP

Windows users don't need to follow these steps

we need to provide write permission to the following folder

public/uploads/blog

public/uploads/crudfiles

public/uploads/files

public/uploads/news

public/uploads/users

CRUD folders permission

our GUI crud generator writes new files to many folders and if you are on *nix, you need to adjust permissions

please check GUI CRUD page for details

Recaptcha keys

Josh has Google ReCaptcha feature for signup, log in etc

follow this guide to set recaptcha

Analytics keys

Josh admin panel can display Google analytics data right in your josh dashboard without leaving the site, for which you need to get JSON file from google site and set analytics view

follow https://github.com/spatie/laravel-analytics#how-to-obtain-the-credentials-to-communicate-with-google-analytics for more details

Google map keys

you need to get google maps keys for maps pages to work, if you don't need these pages, you can ignore it.

Social Login

you can see facebook etc login options in signup and login pages, to make them work properly, please follow this guide