Install And Setup Laravel Development Environment On Fedora

Exported on 28-Sep-2021 12:33:08

Install Laravel Development Environment On Fedora Server With AttuneOps

This Blueprint Installs LEMP Stack Components On A Fedora Server

Laravel is a free, open-source PHP web framework, created by Taylor Otwell and intended for the development of web applications following the model–view–controller architectural pattern and based on Symfony.

Laravel makes it easy to develop production ready websites and backend APIs with its power packed development utilities. Using Laravel saves a lot of time and cost as it brings along the basic requirements of any backend service such as Authentication, Notifications, Models, Views, Controllers, Middle-wares, etc.

Pre-Blueprint Attune setup
  1. On the Inputs tab, create a Linux node for the host you wish to install the stack on.
  2. On the Inputs tab, create Linux credentials to connect to the host you wish to install the stack on.
Steps Involved
  • Install and configure PHP
  • Install composer - PHP package management system
  • Clone Laravel project
  • Install MySQL 8 database.
  • Configure and launch Laravel development server

Parameters

Name Type Script Reference Default Value Comment
Linux Node Linux / Unix Server linuxNode
Linux User Linux OS Credential linuxUser

1 - Install PHP7.4 and Composer

Installs PHP and required plugins

The connection details have changed from the last step.

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Installs php7.4
sudo dnf -y install php-cli

# Install composer
sudo dnf -y install phpunit composer

# Install php-mysql plugin
sudo dnf -y install php-mysqli

2 - Install and configure MySQL Server

Installs MariaDB package for MySQL Database Server

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Install mysql/mariadb server
sudo yum -y install mariadb-server

# Start mysql 
sudo service mariadb start

# Configure password and auth plugin
sudo mysql -e "SET PASSWORD FOR 'root'@'localhost' = PASSWORD('rootpass');flush privileges;"

# Restart mysql 
sudo service mariadb restart

3 - Install Laravel Project

Installs and configures a Laravel Project

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Install git and zip
sudo yum -y install git zip

# Clone laravel scaffold proejct
git clone https://github.com/laravel/laravel.git

# Install composer dependencies
cd laravel 
COMPOSER_MEMORY_LIMIT=-1 composer install

# Configure laravel project
cp .env.example .env
php artisan key:generate

#Set MySQL password
sed -i 's/DB_PASSWORD=/DB_PASSWORD=rootpass/g' .env

4 - Launch Laravel Development Server

Installs screen and starts Laravel development server in background

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Install screen
sudo yum -y install screen

# Configure screen 
sudo echo "zombie xy" >> ~/.screenrc

# Change working directory
cd ~/laravel

# Start Laravel artisan server in backaground
screen -d -m php artisan serve --host 0.0.0.0