Laravel8 ubuntu20

It's a bit long because it also includes phpmyadmin. Maybe it will be a hassle to operate, so let's insert vim first

sudo apt-get isntall vim

Install PDO related drivers and other packages

sudo apt-get install php-intl
sudo apt-get install apache2 php php-gd mysql-server php-mysql php-fpm
sudo apt-get install php-zip php-mbstring php-xml php7.4-cli php-dev
sudo apt-get install php-mbstring php-xml php-json 


apache2 related settings

sudo apt-get install libapache2-mod-php
sudo apt-get install apache2
sudo systemctl enable apache2
sudo systemctl restart apache2

Put the PDO related driver (sqlite)

sudo apt-get install php7.4-sqlite3

mysql
※Notes
user 
pass
Please create by yourself

Path initialization

sudo mysql_secure_installation
Please decide the password at this time.

sudo mysql -u user -p

GRANT ALL ON user IDENTIFIED BY 'pass';

select User,Host from mysql.user;

CREATE USER 'user'@'localhost' IDENTIFIED BY 'pass';

GRANT SELECT ON *.* TO 'user'@'localhost' IDENTIFIED BY 'pass';

sudo mysql -u user -p

Authorization
↓
grant all on *.* to user @localhost;

phpmyadmin When it is troublesome to type commands and you use mysql.

sudo apt-get install phpmyadmin

You will be asked what kind of web server you have, so select "apache2".
dbconfig-Do you want to set it as common? Is asked, so select "yes". Then you will be asked for the password of the "phpmyadmin" user on the MySQL server, so enter it twice.


sudo vi /etc/apache2/conf-available/phpmyadmin.conf

Copy and paste the following
Edit the IP address of your server only for the following IPs

# phpMyAdmin configuration
Include /etc/phpmyadmin/apache.conf

<Directory /usr/share/phpmyadmin>
   Order deny,allow
   Deny from all
   Allow from IP
</Directory>
------------------------------
sudo a2enconf phpmyadmin.conf
sudo systemctl restart apache2

Various settings have been completed. It's about time to get into the main subject.

sudo apt-get  install curl

Let's put composer! !!

curl -sS https://getcomposer.org/installer
sudo apt-get install composer
which composer

Let's change the location of the path setting (mv)

sudo mv composer /usr/local/bin/composer
which composer

Let's change the ownership setting

sudo chmod 755 /usr/local/bin/composer
export PATH=/usr/local/bin:$PATH
which composer

Installation of Laravel itself, path, etc.

composer global require "laravel/installer"
export PATH="$PATH:/.config/composer/vendor/bin"
source ~/.bashrc

From installation to collective settings

composer create-project --prefer-dist laravel/laravel Laravelmixapp
cd Laravelmixapp
composer update
composer install 
composer require "laravelcollective/html"

I will check it here just in case.
php artisan --version

Install VUE and go to Laravel mix


sudo apt-get install npm
sudo npm install && npm run dev
php artisan serve

Fixed .env to use sqlite

vi .env

Contents of .env

APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack

DB_CONNECTION=sqlite
#DB_HOST=127.0.0.1
#DB_PORT=3306
#DB_DATABASE=homestead
#DB_USERNAME=homestead
#DB_PASSWORD=secret

BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

At the time of git clone vi .env is below after copying and pasting above

php artisan key:generate

sqlite settings

config/database.php
of'default' => env('DB_CONNECTION', 'DB')

touch database/database.sqlite

Below is another database setting config/database.php

<?php
use Illuminate\Support\Str;
return [
    /*
    |--------------------------------------------------------------------------
    | Default Database Connection Name
    |--------------------------------------------------------------------------
    |
    | Here you may specify which of the database connections below you wish
    | to use as your default connection for all database work. Of course
    | you may use many connections at once using the Database library.
    |
    */
    'default' => env('DB_CONNECTION', 'sqlite'),
    /*

By default


'default' => env('DB_CONNECTION', '')So
Change to sqlite

After the login screen command below, start the server.

composer require laravel/ui --dev
php artisan ui bootstrap --auth 
php artisan ui react-auth
npm install 
npm run dev 
npm install vue --save
npm run prod
php artisan serve

Finally set the time zone config/app.php

    'timezone' => 'Asia/Tokyo',

    /*
    |--------------------------------------------------------------------------
    | Application Locale Configuration
    |--------------------------------------------------------------------------
    |
    | The application locale determines the default locale that will be used
    | by the translation service provider. You are free to set this value
    | to any of the locales which will be supported by the application.
    |
    */

    'locale' => 'ja',

Controller development with the following command

php artisan make:controller doors

Recommended Posts

Laravel8 ubuntu20
Laravel environment construction (Ubuntu 18.04 LTS)
ubuntu ssh
Ubuntu squid
Environment construction with Docker (Ubuntu20.04) + Laravel + nginx
Docker + Laravel + Codeception
world press ubuntu
Ubuntu package search
ubuntu (AWS) LEMP
About github ubuntu
tmux on Ubuntu