Main Commands Ubuntu Shell

Restart Apache

    sudo /etc/init.d/apache2 restart

Reset Laravel Migrations

    php artisan migrate:fresh

Check Disk Space

    df -h --total

WebPack Sources - Development Mode

    npm run dev

WebPack Sources - Production Mode

    npm run prod

SSL

aulus.org

Infos: https://letsencrypt.org/de/getting-started

  • Plesk > Extensions > Let's Encrypt
  • Click aulus.org
  • Enter valid Email Address
  • Activate all Checkboxes
  • Click Next
  • Open KIS > Domainservices > DNS Entries Maintenance
  • Edit Domain aulus.org
  • Add Entry _acme-challenge (.aulus.org) / TXT / <Hash from Plesk for Let's Encrypt Certificate>
  • Click Create
  • Check if it available via https://dnschecker.org/#TXT/_acme-challenge.aulus.org
  • Click Search
  • If it is reachable via DNSChecker click Next in Plesk; After a while Certificate is installed
  • Remove TXT Entry ( _acme-challenge ) from KIS > Domainservices > DNS Entries Maintenance
  • Adopt Laravel .htaccess HTTPS Force - To /var/www/vhosts/aulus.org/httpdocs/aulus/public/.htaccess add
        # HTTPS Redirect
        RewriteCond %{HTTPS} !=on
        RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

teachy.aulus.org:

  • Infos: https://letsencrypt.org/de/getting-started
  • Plesk > Extensions > Let's Encrypt
  • Click teachy.aulus.org
  • Enter valid Email Address
  • Activate all Checkboxes
  • Click Next
  • Open KIS > Domainservices > DNS Entries Maintenance
  • Edit Domain aulus.org
  • Add Entry _acme-challenge.teachy (.aulus.org) / TXT / <Hash from Plesk for Let's Encrypt Certificate>
  • Click Create
  • Check if it available via https://dnschecker.org/#TXT/_acme-challenge.teachy.aulus.org
  • Click Search
  • If it is reachable via DNSChecker click Next in Plesk; After a while Certificate is installed
  • Remove TXT Entry ( _acme-challenge.teachy ) from KIS > Domainservices > DNS Entries Maintenance
  • Adopt Laravel .htaccess HTTPS Force - To /var/www/vhosts/aulus.org/teachy.aulus.org/teachy/public/.htaccess add
        # HTTPS Redirect
        RewriteCond %{HTTPS} !=on
        RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Without Plesk

Order Virtual Server at Hosteurope

  • Order Server > Virtual Server > Starter ( 9.99€ / Month )

    • Properties: 2vCores, 2 GB RAM, 100 GB SSD
    • Ubuntu 18.04
    • Plesk Desk: No
  • Some hours later you get Hosteurope Mail with IP and User Name

    • IP: <Your-VPS-IP>
    • User Name: root
  • Get Initial Password

    • Open KIS > Virtual Server > General > General Informations
      • Initial Password: *********

    Open Remote Connection via VSCode:

    • Open Visual Studio Code
    • Install Extension Remote Development / Microsoft
    • Open down left SSH Icon > Remote-SSH: Open Configuration File > C:\Users<YourUser>.ssh\config
    • Enter your IP and User Name Host HostName User root
    • Save and close the File
    • Open down left SSH Icon > Remote-SSH: Connect to Host
    • Select your IP
    • Trust the Fingerprint
    • Enter your Initial Password
    • Click left Open Folder
    • /root/ is selected ( Home Directory of User root )
    • Click OK

    Open Terminal / Console / Shell in VSCode:

    • Press Ctrl+Ö to open the Terminal
    • Note: If a Command ends with Killed that means the Memory of your VPS ( Virtual Server ) is almost full. Fix it by Restarting the VPS via KIS > Virtual Server > Assignments > Start / Stop / Repair > Restart This will restart the Virtual Server and the Memory will be emptied. Now the Command should run fine without Killed.

    Install NPM:

    • curl -sL https://deb.nodesource.com/setup_13.x
    • sudo apt-get update
    • sudo apt-get install npm
    • npm -v

    Enable Module Rewrite:

    • sudo a2enmod rewrite
    • Check AllowOverride is set to All via code /etc/apache2/apache2.conf <Directory /var/www/> Options Indexes FollowSymLinks

      AllowOverride All <<< Require all granted

    • If not change and save /etc/apache2/apache2.conf
    • Restart Apache via sudo /etc/init.d/apache2 restart or systemctl restart apache2

    Laravel 6.x Installation:

      Installing PHP 7.2 with Apache:
      -------------------------------
      - sudo apt install php libapache2-mod-php
    
      Enable BCmath PHP Extension:
      ----------------------------
      - Check if BCmath is installed via `php -m`
      - If not install BCmath via `sudo apt install php-bcmath`
    
      Enable Ctype PHP Extension:
      ---------------------------
      - Check if Ctype is installed via `php -m`
      - If not install BCmath via `sudo apt install php-ctype`
    
      Enable Fileinfo PHP Extension:
      ---------------------------
      - Check if Fileinfo is installed via `php -m`
      - If not install BCmath via `sudo apt install php-fileinfo`
    
      Enable JSON PHP Extension:
      ---------------------------
      - Check if Fileinfo is installed via `php -m`
      - If not install BCmath via `sudo apt install php-json`
    
      Enable Mbstring PHP Extension:
      ---------------------------
      - Check if Fileinfo is installed via `php -m`
      - If not install BCmath via `sudo apt install php-mbstring`
    
      Enable OpenSSL PHP Extension:
      ---------------------------
      - Check if Fileinfo is installed via `php -m`
      - If not install BCmath via `sudo apt install php-openssl`
    
      Enable PDO PHP Extension:
      ---------------------------
      - Check if Fileinfo is installed via `php -m`
      - If not install BCmath via `sudo apt install php-pdo`
    
      Enable PDO MySQL PHP Extension:
      ---------------------------
      - Check if Fileinfo is installed via `php -m`
      - If not install BCmath via `sudo apt install php-pdo-mysql`
    
      Enable SQLite 3 PHP Extension:
      ---------------------------
      - Check if Fileinfo is installed via `php -m`
      - If not install BCmath via `sudo apt install php-sqlite3`
    
      Enable Tokenizer PHP Extension:
      ---------------------------
      - Check if Fileinfo is installed via `php -m`
      - If not install BCmath via `sudo apt install php-tokenizer`
    
      Enable XML PHP Extension:
      ---------------------------
      - Check if Fileinfo is installed via `php -m`
      - If not install BCmath via `sudo apt install php-xml`
    
      Enable ZIP PHP Extension:
      ---------------------------
      - Check if Ctype is installed via `php -m`
      - If not install BCmath via `sudo apt install php-zip`
    
      Installing composer:
      --------------------
      - Source: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-composer-on-ubuntu-18-04
      - Update Package manager Cache via `sudo apt update`
      - Installing Composers Dependencies via `sudo apt install curl php-cli php-mbstring git unzip`
      - Navigate to Home Directory via `cd ~`
      - Retrieve the Installer via Curl via `curl -sS https://getcomposer.org/installer -o composer-setup.php`
      - Install Composer globally via `sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer`
    
      Add Composer Vendor-bin Folder to $PATH:
      ----------------------------------------
      - Open `code /root/.profile`
      - Add:
          PATH="$PATH:$HOME/.composer/vendor/bin"
      Here:
      if [ "$BASH" ]; then
      if [ -f ~/.bashrc ]; then
      >>> <Add here> <<<
    
      Reload Profile File:
      --------------------
      - . ~/.profile
    
      Create new Laravel Application:
      -------------------------------
      - cd /var/www
      - composer create-project laravel/laravel teachy 6.x
      - cd /var/www/teachy
      - php artisan cache:clear
      - sudo chown -R $USER:www-data storage
      - sudo chown -R $USER:www-data bootstrap/cache
      - chmod -R 775 storage
      - chmod -R 775 bootstrap/cache
      - sudo /etc/init.d/apache2 restart
      - composer dump-autoload
      - npm install
      - npm run prod
    
      Add Laravel Folder to VSCode:
      -----------------------------
      - File > Add Folder to Workspace
      - Navigate to `/var/www/teachy/`
      - Click OK
    
      Save VSCode Workspace:
      ----------------------
      - File > Save Workspace As
      - Click Show Local
      - Save as `root.code-workspace`
    
      Open Workspace in VSCode:
      -------------------------
      - Close VSCode
      - Doubleclick root.code-workspace File and assign to VSCode
    

    Change Apache www Folder:

    • Open code /etc/apache2/sites-available/000-default.conf
    • Change DocumentRoot /var/www/html to DocumentRoot /var/www/teachy/public
    • Restart Apache via sudo /etc/init.d/apache2 restart

    Test Laravel Installation:

    • Open http://

    Run WebPack Watch:

    • Navigate to cd /var/www/teachy
    • npm run watch

    Install Bootstrap:

    • Navigate to cd /var/www/teachy
    • composer require laravel/ui:^1.0
    • php artisan ui bootstrap
    • php artisan ui bootstrap --auth
    • npm install && npm run prod

    Install Vue:

    • cd /var/www/teachy
    • php artisan ui vue
    • npm install && npm run prod

    Install Vuex:

    • cd /var/www/teachy
    • npm install vuex

    Setup Vuex with localStorage:

    • resources/js/app.js

      import Vuex from 'vuex' Vue.use(Vuex) import storeData from "./store/index" const store = new Vuex.Store( storeData )

      store.subscribe((mutation, state) => { console.log(mutation.type) localStorage.setItem('store', JSON.stringify(state)); }) ... const app = new Vue({ ... store, beforeCreate() { this.$store.commit('initialiseStore'); } ... });

    • resources/js/store/index.js export default { state: { }, mutations: { initialiseStore(state) { if(localStorage.getItem('store')) { this.replaceState( Object.assign(state, JSON.parse(localStorage.getItem('store'))) ); } } }, actions: { }, getters: { } }

    Administrate MySQL:

      Source: https://support.rackspace.com/how-to/install-mysql-server-on-the-ubuntu-operating-system
    
      Install MySQL:
      --------------
      - sudo apt-get update
      - sudo apt-get install mysql-server
      - sudo mysql_secure_installation utility
    
      Check MySQL Version:
      --------------------
      - mysql -V
    
      Enable MySQL Remote Access:
      ---------------------------
      - sudo apt-get install ufw
      - sudo ufw enable
      - sudo ufw allow mysql
    
      Start the MySQL Service:
      ------------------------
      - sudo systemctl start mysql
    
      Start MySQL Shell:
      ------------------
      - /usr/bin/mysql -u root
    
      Set the MySQL root Password:
      ----------------------------
      - UPDATE mysql.user SET authentication_string = PASSWORD('password') WHERE User = 'root';
      - FLUSH PRIVILEGES;
    
      Create Database:
      ----------------
      - CREATE DATABASE teachy;
    
      Create User:
      ------------
      - CREATE USER 'teachy'@'localhost' IDENTIFIED BY '***';
      - GRANT ALL PRIVILEGES ON *.* TO 'teachy'@'localhost';
      - FLUSH PRIVILEGES;
    
      View Users:
      -----------
      - SELECT User, Host, authentication_string FROM mysql.user;
    
      Close MySQL Shell:
      ------------------
      - exit
    

    Run Laravel Migrations:

    • cd /var/www/teachy
    • Setup teachy/.env DB_DATABASE=teachy DB_USERNAME=teachy DB_PASSWORD=***
    • php artisan migrate:fresh

    Install CKEditors CKFinder for Uploads:

    • Source: https://github.com/ckfinder/ckfinder-laravel-package
    • cd /var/www/teachy
    • composer require ckfinder/ckfinder-laravel-package
    • php artisan ckfinder:download
    • php artisan vendor:publish --tag=ckfinder
    • mkdir -m 777 public/userfiles

    Add Subdomain:

    • Open KIS > Domain Services > Domain-Administration > Nameserver- / DNS Entries > Add new CNAME Entry Hostname: teachy (.aulus.org) Shows to: A /
    • Click Create
    • In the new created Record change TTL to 5 Minutes and click Save
    • Open VSCode Remote Terminal ( Ctrl+Ö in VSCode )
    • Edit apache2.conf via code /etc/apache2/sites-available/000-default.conf and add <VirtualHost *:80> ServerName teachy.aulus.org DocumentRoot /var/www/teachy/public
    • Restart Apache via sudo /etc/init.d/apache2 restart

With Plesk:


Order Virtual Server at Hosteurope:
-----------------------------------
- Order Server > Virtual Server > Starter ( 9.99€ / Month )
    - Properties: 2vCores, 2 GB RAM, 100 GB SSD
    - Ubuntu 18.04
    - Plesk Desk: Yes
- Some hours later you get Hosteurope Mail with IP and User Name
    - IP: <Your-VPS-IP>
    - User Name: root
- Get Initial Password
    - Open KIS > Virtual Server > General > General Informations
        - Initial Password: *********

Open Remote Connection via VSCode:
----------------------------------
- Open Visual Studio Code
- Install Extension `Remote Development / Microsoft`
- Open down left SSH Icon > Remote-SSH: Open Configuration File > C:\Users\<YourUser>\.ssh\config
- Enter your IP and User Name
    Host <Your-VPS-IP>
        HostName <Your-VPS-IP>
        User root
- Save and close the File
- Open down left SSH Icon > Remote-SSH: Connect to Host
- Select your IP
- Trust the Fingerprint
- Enter your Initial Password
- Click left Open Folder
- `/root/` is selected ( Home Directory of User `root` )
- Click OK

Open Terminal / Console / Shell in VSCode:
------------------------------------------
- Press Ctrl+Ö to open the Terminal
- Note: If a Command ends with `Killed` that means the Memory of your VPS ( Virtual Server ) is almost full.
  Fix it by Restarting the VPS via KIS > Virtual Server > Assignments > Start / Stop / Repair > Restart
  This will restart the Virtual Server and the Memory will be emptied.
  Now the Command should run fine without `Killed`.

Install NPM:
------------
- curl -sL https://deb.nodesource.com/setup_13.x
- sudo apt-get update
- sudo apt-get install npm
- npm -v

Enable Module Rewrite:
----------------------
- sudo a2enmod rewrite
- Check `AllowOverride` is set to `All` via `code /etc/apache2/apache2.conf`
    <Directory /var/www/>
        Options Indexes FollowSymLinks
    >>> AllowOverride All <<<
        Require all granted
    </Directory>
- If not change and save `/etc/apache2/apache2.conf`
- Restart Apache via `sudo /etc/init.d/apache2 restart` or `systemctl restart apache2`

Laravel 6.x Installation:
-------------------------

    Installing PHP 7.2 with Apache:
    -------------------------------
    - sudo apt install php libapache2-mod-php

    Enable BCmath PHP Extension:
    ----------------------------
    - Check if BCmath is installed via `php -m`
    - If not install BCmath via `sudo apt install php-bcmath`

    Enable Ctype PHP Extension:
    ---------------------------
    - Check if Ctype is installed via `php -m`
    - If not install BCmath via `sudo apt install php-ctype`

    Enable Fileinfo PHP Extension:
    ---------------------------
    - Check if Fileinfo is installed via `php -m`
    - If not install BCmath via `sudo apt install php-fileinfo`

    Enable JSON PHP Extension:
    ---------------------------
    - Check if Fileinfo is installed via `php -m`
    - If not install BCmath via `sudo apt install php-json`

    Enable Mbstring PHP Extension:
    ---------------------------
    - Check if Fileinfo is installed via `php -m`
    - If not install BCmath via `sudo apt install php-mbstring`

    Enable OpenSSL PHP Extension:
    ---------------------------
    - Check if Fileinfo is installed via `php -m`
    - If not install BCmath via `sudo apt install php-openssl`

    Enable PDO PHP Extension:
    ---------------------------
    - Check if Fileinfo is installed via `php -m`
    - If not install BCmath via `sudo apt install php-pdo`

    Enable PDO MySQL PHP Extension:
    ---------------------------
    - Check if Fileinfo is installed via `php -m`
    - If not install BCmath via `sudo apt install php-pdo-mysql`

    Enable SQLite 3 PHP Extension:
    ---------------------------
    - Check if Fileinfo is installed via `php -m`
    - If not install BCmath via `sudo apt install php-sqlite3`

    Enable Tokenizer PHP Extension:
    ---------------------------
    - Check if Fileinfo is installed via `php -m`
    - If not install BCmath via `sudo apt install php-tokenizer`

    Enable XML PHP Extension:
    ---------------------------
    - Check if Fileinfo is installed via `php -m`
    - If not install BCmath via `sudo apt install php-xml`

    Enable ZIP PHP Extension:
    ---------------------------
    - Check if Ctype is installed via `php -m`
    - If not install BCmath via `sudo apt install php-zip`

    Installing composer:
    --------------------
    - Source: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-composer-on-ubuntu-18-04
    - Update Package manager Cache via `sudo apt update`
    - Installing Composers Dependencies via `sudo apt install curl php-cli php-mbstring git unzip`
    - Navigate to Home Directory via `cd ~`
    - Retrieve the Installer via Curl via `curl -sS https://getcomposer.org/installer -o composer-setup.php`
    - Install Composer globally via `sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer`

    Add Composer Vendor-bin Folder to $PATH:
    ----------------------------------------
    - Open `code /root/.profile`
    - Add:
        PATH="$PATH:$HOME/.composer/vendor/bin"
    Here:
    if [ "$BASH" ]; then
      if [ -f ~/.bashrc ]; then
    >>> <Add here> <<<

    Reload Profile File:
    --------------------
    - . ~/.profile

    Change Plesk Password:
    ---------------------
    - Open Plesk via `http://<Your-VPS-IP>:8443` with admin@<InitialPassword>
    - Opn top right Adminsitrator > Edit Profile
    - Change Password
    - Click OK

    Create aulus.org Domain in Plesk:
    ---------------------------------
    - Open Plesk via `http://<Your-VPS-IP>:8443`
    - Create a Domain `aulus.org` with Username and Password
    - Click OK

    Create new Laravel Application for aulus.org:
    ---------------------------------------------
    - cd /var/www/vhosts/aulus.org/httpdocs
    - composer create-project laravel/laravel aulus 6.x
    - cd /var/www/vhosts/aulus.org/httpdocs/aulus
    - php artisan cache:clear
    - sudo chown -R $USER:www-data storage
    - sudo chown -R $USER:www-data bootstrap/cache
    - chmod -R 777 storage
    - chmod -R 775 bootstrap/cache
    - sudo /etc/init.d/apache2 restart
    - composer dump-autoload
    - npm install
    - npm run prod

    Add Laravel Folder to VSCode:
    -----------------------------
    - File > Add Folder to Workspace
    - Navigate to `/var/www/vhosts/aulus.org/httpdocs/aulus`
    - Click OK

    Save VSCode Workspace:
    ----------------------
    - File > Save Workspace As
    - Click Show Local
    - Save as `root.code-workspace`

    Open Workspace in VSCode:
    -------------------------
    - Close VSCode
    - Doubleclick root.code-workspace File and assign to VSCode

    Change Plesk Folder for aulus.org Domain:
    -----------------------------------------
    - Open Plesk > Websites & Domains > aulus.org > Hosting Settings
    - Change Document root from `httpdocs` to `httpdocs/aulus/public`
    - Click OK

    Test Laravel Installation:
    --------------------------
    - Open http://aulus.org

    Install Bootstrap:
    ------------------
    - Navigate to `cd /var/www/vhosts/aulus.org/httpdocs/aulus`
    - composer require laravel/ui:^1.0
    - php artisan ui bootstrap
    - php artisan ui bootstrap --auth
    - npm install && npm run prod
    - Loading the WebPacked Scripts and Styles - To `resources/views/welcome.blade.php` add
        <head>
            ...
            <!-- Scripts -->
            <script src="https://aulus.org/js/app.js" defer></script>
            ...
            <!-- Styles -->
            <link href="https://aulus.org/css/app.css" rel="stylesheet">
            ...
        </head>

    Install Vue:
    ------------
    - cd /var/www/vhosts/aulus.org/httpdocs/aulus
    - php artisan ui vue
    - npm install && npm run prod
    - Adding Vue App Entry Point - To `resources/views/welcome.blade.php` add
        <body>
            <div id="app">
                ...
            </div>
        </body>

    Install Vuex:
    -------------
    - cd /var/www/vhosts/aulus.org/httpdocs/aulus
    - npm install vuex

    Setup Vuex with localStorage:
    -----------------------------
    - To `resources/js/app.js` add
        ...
        import Vuex from 'vuex'
        Vue.use(Vuex)
        import storeData from "./store/index"
        const store = new Vuex.Store( storeData )

        store.subscribe((mutation, state) => {
            console.log(mutation.type)
            localStorage.setItem('store', JSON.stringify(state));
        })
        ...
        const app = new Vue({
            ...
            store,
            beforeCreate() {
                this.$store.commit('initialiseStore');
            }
            ...
        });

    - Add new File `resources/js/store/index.js`
        export default {
            state: {
            },
            mutations: {
                initialiseStore(state) {
                    if(localStorage.getItem('store')) {
                        this.replaceState(
                            Object.assign(state, JSON.parse(localStorage.getItem('store')))
                        );
                    }
                }
            },
            actions: {
            },
            getters: {
            }
        }
    - npm run prod

    Add a DNS A-Record for teachy.aulus.org in KIS:
    -----------------------------------------------
    - Open Hosteurope KIS > Domainservices > Domain Administration > Nameserver- / DNS-Enty Maintenance
    - Add a new Entry
        Hostname: teachy (.aulus.org)
        Shows to: A / <Your-VPS-IP>
    - Click Create

    Create teachy.aulus.org Subdomain in Plesk:
    -------------------------------------------
    - Open Plesk via `http://<Your-VPS-IP>:8443`
    - Create a Subdomain `techy.aulus.org` with Document root `teachy.aulus.org`
    - Click OK

    Create new Laravel Application for teachy.aulus.org:
    ----------------------------------------------------
    - cd /var/www/vhosts/aulus.org/teachy.aulus.org
    - composer create-project laravel/laravel teachy 6.x
    - cd /var/www/vhosts/aulus.org/teachy.aulus.org/teachy
    - php artisan cache:clear
    - sudo chown -R $USER:www-data storage
    - sudo chown -R $USER:www-data bootstrap/cache
    - chmod -R 777 storage
    - chmod -R 775 bootstrap/cache
    - sudo /etc/init.d/apache2 restart
    - composer dump-autoload
    - npm install
    - npm run prod

    Add Laravel Folder to VSCode:
    -----------------------------
    - File > Add Folder to Workspace
    - Navigate to `/var/www/vhosts/aulus.org/teachy.aulus.org/teachy`
    - Click OK

    Save VSCode Workspace:
    ----------------------
    - File > Save Workspace As
    - Click Show Local
    - Save as `root.code-workspace`

    Open Workspace in VSCode:
    -------------------------
    - Close VSCode
    - Doubleclick root.code-workspace File and assign to VSCode

    Change Plesk Folder for teachy.aulus.org Subdomain:
    ---------------------------------------------------
    - Open Plesk > Websites & Domains > teachy.aulus.org > Hosting Settings
    - Change Document root from `teachy.aulus.org` to `teachy.aulus.org/teachy/public`
    - Click OK

    Test Laravel Installation:
    --------------------------
    - Open http://teachy.aulus.org

    Install Bootstrap:
    ------------------
    - Navigate to `cd /var/www/vhosts/aulus.org/teachy.aulus.org/teachy`
    - composer require laravel/ui:^1.0
    - php artisan ui bootstrap
    - php artisan ui bootstrap --auth
    - npm install && npm run prod
    - Loading the WebPacked Scripts and Styles - To `resources/views/welcome.blade.php` add
        <head>
            ...
            <!-- Scripts -->
            <script src="https://aulus.org/js/app.js" defer></script>
            ...
            <!-- Styles -->
            <link href="https://aulus.org/css/app.css" rel="stylesheet">
            ...
        </head>

    Install Vue:
    ------------
    - cd /var/www/vhosts/aulus.org/teachy.aulus.org/teachy
    - php artisan ui vue
    - npm install && npm run prod
    - Adding Vue App Entry Point - To `resources/views/welcome.blade.php` add
        <body>
            <div id="app">
                ...
            </div>
        </body>

    Install Vuex:
    -------------
    - cd /var/www/vhosts/aulus.org/teachy.aulus.org/teachy
    - npm install vuex

    Setup Vuex with localStorage:
    -----------------------------
    - To `resources/js/app.js` add
        ...
        import Vuex from 'vuex'
        Vue.use(Vuex)
        import storeData from "./store/index"
        const store = new Vuex.Store( storeData )

        store.subscribe((mutation, state) => {
            console.log(mutation.type)
            localStorage.setItem('store', JSON.stringify(state));
        })
        ...
        const app = new Vue({
            ...
            store,
            beforeCreate() {
                this.$store.commit('initialiseStore');
            }
            ...
        });

    - Add new File `resources/js/store/index.js`
        export default {
            state: {
            },
            mutations: {
                initialiseStore(state) {
                    if(localStorage.getItem('store')) {
                        this.replaceState(
                            Object.assign(state, JSON.parse(localStorage.getItem('store')))
                        );
                    }
                }
            },
            actions: {
            },
            getters: {
            }
        }
    - npm run prod

Administrate Database in Plesk:
===============================
    
    Source: https://support.rackspace.com/how-to/install-mysql-server-on-the-ubuntu-operating-system

    Install MySQL:
    --------------
    - sudo apt-get update
    - sudo apt-get install mysql-server
    - sudo mysql_secure_installation utility

    Check MySQL Version:
    --------------------
    - mysql -V

    Enable MySQL Remote Access:
    ---------------------------
    - sudo apt-get install ufw
    - sudo ufw enable
    - sudo ufw allow mysql

    Start the MySQL Service:
    ------------------------
    - sudo systemctl start mysql

    Start MySQL Shell:
    ------------------
    - /usr/bin/mysql -u root

    Set the MySQL root Password:
    ----------------------------
    - UPDATE mysql.user SET authentication_string = PASSWORD('password') WHERE User = 'root';
    - FLUSH PRIVILEGES;

    Create Database:
    ----------------
    - CREATE DATABASE teachy;

    Create User:
    ------------
    - CREATE USER 'teachy'@'localhost' IDENTIFIED BY '***';
    - GRANT ALL PRIVILEGES ON *.* TO 'teachy'@'localhost';
    - FLUSH PRIVILEGES;

    View Users:
    -----------
    - SELECT User, Host, authentication_string FROM mysql.user;

    Close MySQL Shell:
    ------------------
    - exit

Run Laravel Migrations:
-----------------------
- cd /var/www/teachy
- Setup teachy/.env
    DB_DATABASE=teachy
    DB_USERNAME=teachy
    DB_PASSWORD=***
- php artisan migrate:fresh

Install CKEditors CKFinder for Uploads:
---------------------------------------
- Source: https://github.com/ckfinder/ckfinder-laravel-package
- cd /var/www/teachy
- composer require ckfinder/ckfinder-laravel-package
- php artisan ckfinder:download
- php artisan vendor:publish --tag=ckfinder
- mkdir -m 777 public/userfiles

Install Markdown in Laravel:

  • Source: https://github.com/GrahamCampbell/Laravel-Markdown
  • composer require graham-campbell/markdown
  • php artisan vendor:publish
  • 3: [3 ] Provider: GrahamCampbell\Markdown\MarkdownServiceProvider