Exported on 28-Sep-2021 12:28:57
Parameters
1 - Install PHP
Installs PHP 7.3 and following PHP extensions:
- MySQL client
- MbString
- XML
- ZIP
- BcMath
- MyCrypt
Login as user {Linux User} on node {Linux Node}
# Update apt repositories
sudo apt update
# Install PHP 7.4
sudo apt -y install php
sudo apt -y install php-mysql php-common php-mbstring php-xml php-zip php-bcmath zip unzip php-zip php-dev
# Install MyCrypt extension
sudo apt-get -y install libmcrypt-dev
echo "y" | sudo pecl install mcrypt
# Enable MyCrypt extension
sudo bash -c "echo extension=/usr/lib/php/20190902/mcrypt.so > /etc/php/7.4/cli/conf.d/mcrypt.ini"
2 - Install Composer
Installs composer for PHP dependency management.
Login as user {Linux User} on node {Linux Node}
# Download composer installer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
# Setup composer
php composer-setup.php
# Add to path
sudo mv composer.phar /usr/local/bin/composer
3 - Setup Laravel
Downloads Laravel project scaffold, configures laravel environment and installs composer dependencies.
Login as user {Linux user} on node {Linux node}
# Download composer
git clone https://github.com/laravel/laravel.git
# Install dependencies
cd laravel && composer i
#Create .env file
cp .env.example .env
#Set MySQL password
sed -i 's/DB_PASSWORD=/DB_PASSWORD=rootpass/g' .env
# Generate Laravel application key
php artisan key:generate
4 - Install MySQL8
Install MySQL database server and configures the UFW firewall.
4.1.1 - Enable UWF Firewall
Login as user {Linux user} on node {Linux node}
# Enable UFW and allow SSH & MySQL Ports
sudo apt install ufw -y
sudo ufw enable
sudo ufw allow 22
sudo ufw allow 3306
4.1.2 - Setup sql
Login as user {Linux user} on node {Linux node}
sudo apt update
# Install MySQL (MariaDB) Server in a Non-Interactive mode. Default root password will be "root"
export DEBIAN_FRONTEND=noninteractive
sudo debconf-set-selections <<< 'mariadb-server-5.5 mysql-server/root_password password rootpass'
sudo debconf-set-selections <<< 'mariadb-server-5.5 mysql-server/root_password_again password rootpass'
sudo apt-get install mysql-server -y
sudo service mysql restart
5 - Start Laravel Dev Server
Starts the Laravel development server in background.
Once this step is complete, open http://YOUR_IP:8000 to see the installation.
Note: the development server is running in a screen session inside the target machine in background, which can be accessed with the command "screen -x"
Login as user {Linux User} on node {Linux Node}
# Install screen
sudo apt -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
Install Laravel Development Environment On Ubuntu Server With AttuneOps
This Blueprint Installs LEMP Stack Components On A Ubuntu 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
Steps Involved