DEV Community

Kuberdenis
Kuberdenis

Posted on

'1-click' install for Laravel + Voyager

Prerequisites

  • Apache2
  • MySQL/MariaDB
  • PHP
  • Git
  • Composer

Introduction

Hey, $user! Today I'll share with you how to install Laravel + Voyager with only "1-click". Well, you guessed it - it's a script. My script. There are many like it but this one is mine.

Anyway, for the ones who don't know what Voyager is - let me explain. Voyager is the ultimate admin panel for Laravel. I suggest you watch a quick video from DevDojo to get more understanding of why Voyager is a great ally to have on your side!

Only two things are required from you:

  1. Clone the script in directory of your choice (or wget it):
git clone https://github.com/47ontech/voyager_with_laravel.git
Enter fullscreen mode Exit fullscreen mode
  1. Run it.

Walk-through

I will not be doing a full walk-through for each line, yet I want to highlight some key points.

Variables

The Variables "section" is pretty straight forward. The only thing I want to pay attention here is the following:

DBPASSWORD="$(openssl rand -base64 12 | tr -d \"=/\")
Enter fullscreen mode Exit fullscreen mode

Sometimes when the password add the special characters '=; /; \;' the whole script crashes 🤷.

Voyager Install and Config

The word 'frustrated' would not be enough to express how I felt until I found where the problem is. I need you to remember the following line:

find /var/www/$SITE/laravel/config/app.php -type f -exec sed -i "168i TCG\\\\Voyager\\\\VoyagerServiceProvider::class," {} \;
Enter fullscreen mode Exit fullscreen mode

So what's the deal with it? Well, when you try to escape a character, usually you do one simple back-slash (\). However, when you want to escape a back-slash you have to enter 3 of these little guys. As a 'not-senior' guy, the debugging part was hell for me and I purged a lot of my time before I found the real problem. Anyway, when you want to escape \ , just turn it into \\\\ .

Permissions

If we don't setup the permissions of our Laravel project, it will throw exceptions at us and we don't want that. We setup permissions.

"That's all, Folks"

thatsallfolks

Yup, that's all. I hope you find this handy. Bye!

Top comments (1)

Collapse
 
bobbyiliev profile image
Bobby Iliev

Nice! Cool script! I will make sure to give it a try!