Setup Centos for Laravel production server

  • by

ssh root@remote_server_ip
dnf clean all
dnf update
dnf install vim wget
sudo dnf install httpd
sudo dnf install @mysql
sudo systemctl start mysqld.service
sudo systemctl status mysqld
sudo systemctl enable mysqld
mysqladmin -u root -p password
sudo mysql_secure_installation

ensure site is setup on symlinked:
sudo ln -s /etc/httpd/sites-available/aplication.com.conf /etc/httpd/sites-enabled/application.com.conf
sudo systemctl restart httpd

– ensure firewalld is disabled
sudo yum install epel-release
sudo yum -y install ufw
sudo ufw status
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow ssh
sudo ufw allow https
sudo ufw status numbered
sudo ufw enable

sudo dnf install php php-curl php-bcmath php-dom php-xml php-mbstring php-json
sudo dnf install epel-release -y
sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm -y
sudo dnf module list php
sudo dnf module enable php:remi-7.4
sudo dnf module reset php:remi-7.2
sudo dnf module enable php:remi-7.4
sudo dnf install php php-cli php-common
php -v
sudo systemctl start php-fpm
sudo systemctl enable php-fpm

ensure tar is installed on Centos OS:
sudo yum install tar

check on firewalled or ufw is setup correclty in case of difficulty to connect
– make sure firewalld is disabled so doesnt boot up on restart
– ensure ufw boots up on restart

cd /var/www/’application’
cp .env.example .env
php artisan key:generate

check files have the right permissions:
https://digitalcreative.tech/laravel-setup-permission-denied/

Using Deployer for deployment – issue with needing to install addtional php library:

install globally:
composer global require deployer/deployer

in appp directory:
dep init -t Laravel

additional package for error:
dnf install php-process

Issues with npm – requires v12, not v10 but doesnt say anything…:
https://stackoverflow.com/questions/61044879/npm-error-in-laravel-7-when-running-npm-run-dev
https://computingforgeeks.com/how-to-install-nodejs-on-centos-fedora/

Main ref:
https://linuxtips.us/install-laravel-centos-8/
https://tecadmin.net/centos-8-initial-server-setup/
https://tecadmin.net/install-laravel-on-centos-8/
https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-laravel-with-lemp-on-ubuntu-18-04

mysql on centos 8:
https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-centos-8
https://linuxize.com/post/how-to-create-mysql-user-accounts-and-grant-privileges/

no sudo groups:
https://unix.stackexchange.com/questions/591420/usermod-group-sudo-does-not-exist-in-centos

updates sudo user password:
https://webhostinggeeks.com/howto/how-to-reset-users-password-on-centosrhel/

update user to be part of sudo:
https://devconnected.com/how-to-add-a-user-to-sudoers-on-centos-8/

setup firewal UFW:
https://www.netweaver.uk/add-epel-repo-centos-7/
https://www.netweaver.uk/ufw-centos-7/

check ports in use.
https://linuxize.com/post/check-listening-ports-linux/

disable firewalld:
https://linoxide.com/firewall/stop-and-disable-firewall-on-centos/

ports to use:
https://www.digitalocean.com/community/tutorials/ufw-essentials-common-firewall-rules-and-commands

ssh setup:
https://www.ssh.com/ssh/copy-id

Install Lamp:
not using the firewall updates in this
keeping with mysql
https://www.tecmint.com/install-lamp-on-centos-8/
https://linuxize.com/post/how-to-install-mysql-on-centos-8/
issues with root password for mysql
https://stackoverflow.com/questions/8537531/access-denied-for-user-rootlocalhost-using-password-no

setup laravel:
https://tecadmin.net/install-laravel-on-centos-8/

Composer:
https://getcomposer.org/doc/00-intro.md
https://getcomposer.org/download/
https://duckduckgo.com/?t=ffab&q=install+composer+globally+centos&ia=web

ssl – esnure the domian is already set to the ip of server:
https://certbot.eff.org/lets-encrypt/centosrhel8-apache
https://snapcraft.io/docs/installing-snap-on-centos
https://www.tecmint.com/secure-apache-with-lets-encrypt-ssl-certificate-on-centos-8/

Deployer deployment:
https://deployer.org/docs/how-to-deploy-laravel.html
https://github.com/deployphp/deployer/issues/1201

Issues with PDO driver whilst using Laravel Jetstream:
https://stackoverflow.com/questions/54565062/sqlstatehy000-2002-permission-denied-laravel-pdo-driver-credentials-working

php 7.4
https://www.linuxtechi.com/install-php-on-centos-8-rhel-8/

Leave a Reply

Your email address will not be published. Required fields are marked *