Checklist: Installation of Laravel 6 on Centos 7

December 17, 2019

Checklist of the steps needed for a new installation of Laravel 6 on Centos 7 / Apache

 

1. Installation


Open a terminal window to your Centos server, and change the current directory to the web server root folder:


            cd /var/www
            

Install composer.

Follow the instructions indicated on the url https://getcomposer.org/download/.

Move the composer file to the /usr/local/bin folder.


            mv composer.phar /usr/local/bin/composer
            

Install the Laravel package.


            composer global require laravel/installer
            

Install Laravel.


            ~/.composer/vendor/bin/laravel new
            

Note

If your server doesn't have the minimum required version of php, you will get a message error like this:

This package requires php ^7.2 but your PHP version (7.1.23) does not satisfy that requirement.

Remove the html folder. We are going to replace it.


            rmdir html
            

Replace the html folder with a link to Laravel's public folder.


            ln -s public html
            

Make the storage folder and its subfolders writable.


            chmod -R 777 storage
            

Make the bootstrap/cache folder writable.


            chmod 777 bootstrap/cache
            

Set the timezone and locale values on the config/app.php file.


'timezone' => 'UTC',

'locale' => 'en',
            

 

2. At this point, your site is up and working.

However, it doesn't have the Login and Sign Up functionality. If you want to install it, proceed with the next steps:

Enter your database credentials on the .env file.


DB_PORT=
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=
            

Run the migration process, to create the users table.


            php artisan migrate
            


            composer require laravel/ui --dev
            


            php artisan ui vue --auth
            

Output:
Vue scaffolding installed successfully.
Please run "npm install && npm run dev" to compile your fresh scaffolding.
Authentication scaffolding generated successfully.

Install NVM.


            curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bash
            

Close and re-open terminal, and change the current directory to the web server root folder again:


            cd /var/www
            

Install Node.


            nvm install node
            

Compile Vue scaffolding.


            npm install
            npm run dev
            

 

3. Now your site is up and working, with the Login and Sign Up functionality.

If you don't need the Registration (Sign Up) functionality you can remove it:

Edit the routes/web.php file

Replace the line:


            Auth::routes();
            

With the following:


            Auth::routes(['register' => false]);
            

Additionally you can also remove the RegisterController.php file. (optional)

 

Related Posts