Apache Web server<\/b>.<\/p>\n\n\n\nsudo apt-get install apache2 -y<\/pre>\n\n\n\nOnce installed, start and enable the service.<\/p>\n\n\n\n
sudo systemctl enable apache2 && sudo systemctl start apache2<\/pre>\n\n\n\nCheck if the service is up and running:<\/p>\n\n\n\n
sudo systemctl status apache2<\/pre>\n\n\n\nYou should receive the following output:<\/p>\n\n\n\n
root@host:~# sudo systemctl status apache2\n\u25cf apache2.service - The Apache HTTP Server\n Loaded: loaded (\/lib\/systemd\/system\/apache2.service; enabled; vendor preset: enabled)\n Active: active (running) since Fri 2023-03-31 09:18:02 CDT; 1h 37min ago\n Docs: https:\/\/httpd.apache.org\/docs\/2.4\/\n Main PID: 498 (apache2)\n Tasks: 7 (limit: 4675)\n Memory: 22.9M\n CPU: 661ms\n CGroup: \/system.slice\/apache2.service\n<\/pre>\n\n\n\nFirst, add the GPG key and the repo because, in the default repository of Debian 11, they do not exist. To install the PHP<\/b> along with its extensions, execute the following command:<\/p>\n\n\n\napt -y install lsb-release apt-transport-https ca-certificates \n\nwget -O \/etc\/apt\/trusted.gpg.d\/php.gpg https:\/\/packages.sury.org\/php\/apt.gpg\n\necho \"deb https:\/\/packages.sury.org\/php\/ $(lsb_release -sc) main\" | tee \/etc\/apt\/sources.list.d\/php.list\n\nsudo apt-get update -y\n<\/pre>\n\n\n\nOnce the PHP key and repo are added, you can install the PHP with extensions using this long command:<\/p>\n\n\n\n
sudo apt-get install php8.1 php8.1-common php8.1-curl libapache2-mod-php php8.1-imap php8.1-redis php8.1-cli php8.1-snmp php8.1-xml php8.1-zip php8.1-mbstring php8.1-gd php8.1-xml php8.1-mysql php-mbstring -y<\/pre>\n\n\n\nsudo apt-get install php8.1 php8.1-cli php8.1-common php8.1-imap php8.1-redis php8.1-snmp php8.1-xml php8.1-zip php8.1-mbstring php8.1-curl<\/p>\n\n\n\n
After successful installation, check the PHP version:<\/p>\n\n\n\n
php -v<\/pre>\n\n\n\nYou should get the following output:<\/p>\n\n\n\n
root@host:~# php -v\nPHP 8.2.4 (cli) (built: Mar 16 2023 14:37:38) (NTS)\nCopyright (c) The PHP Group\nZend Engine v4.2.4, Copyright (c) Zend Technologies\n with Zend OPcache v8.2.4, Copyright (c), by Zend Technologies\n<\/pre>\n\n\n\np>The last of the LAMP stack is the MariaDB<\/b> database service:<\/p>\n\n\n\nsudo apt-get install mariadb-server -y<\/pre>\n\n\n\nStart and enable the mariadb.service with the following commands:<\/p>\n\n\n\n
sudo systemctl start mariadb && sudo systemctl enable mariadb<\/pre>\n\n\n\nCheck the status of the mariadb.service<\/p>\n\n\n\n
sudo systemctl status mariadb<\/pre>\n\n\n\nYou should receive the following output:<\/p>\n\n\n\n
root@host:~# sudo systemctl status mariadb\n\u25cf mariadb.service - MariaDB 10.5.18 database server\n Loaded: loaded (\/lib\/systemd\/system\/mariadb.service; enabled; vendor preset: enabled)\n Active: active (running) since Fri 2023-03-31 11:01:41 CDT; 15s ago\n Docs: man:mariadbd(8)\n https:\/\/mariadb.com\/kb\/en\/library\/systemd\/\n Main PID: 20668 (mariadbd)\n Status: \"Taking your SQL requests now...\"\n Tasks: 19 (limit: 4675)\n Memory: 67.6M\n CPU: 497ms\n CGroup: \/system.slice\/mariadb.service\n \u2514\u250020668 \/usr\/sbin\/mariadbd\n<\/pre>\n\n\n\n<\/span>Step 4. Install Composer<\/span><\/h2>\n\n\n\nWe need to install the Composer responsible for installing all the Laravel components.<\/p>\n\n\n\n
curl -sS https:\/\/getcomposer.org\/installer | php -- --install-dir=\/usr\/bin --filename=composer<\/pre>\n\n\n\nCheck the Composer installation:<\/p>\n\n\n\n
composer<\/pre>\n\n\n\nYou should receive the following output:<\/p>\n\n\n\n
root@host:~# composer\nDo not run Composer as root\/super user! See https:\/\/getcomposer.org\/root for details\nContinue as root\/super user [yes]? yes\n ______\n \/ ____\/___ ____ ___ ____ ____ ________ _____\n \/ \/ \/ __ \\\/ __ `__ \\\/ __ \\\/ __ \\\/ ___\/ _ \\\/ ___\/\n\/ \/___\/ \/_\/ \/ \/ \/ \/ \/ \/ \/_\/ \/ \/_\/ (__ ) __\/ \/\n\\____\/\\____\/_\/ \/_\/ \/_\/ .___\/\\____\/____\/\\___\/_\/\n \/_\/\nComposer version 2.5.5 2023-03-21 11:50:05\n\nUsage:\n command [options] [arguments]\n\nOptions:\n -h, --help Display help for the given command. When no command is given display help for the list command\n -q, --quiet Do not output any message\n -V, --version Display this application version\n --ansi|--no-ansi Force (or disable --no-ansi) ANSI output\n -n, --no-interaction Do not ask any interactive question\n --profile Display timing and memory usage information\n --no-plugins Whether to disable plugins.\n --no-scripts Skips the execution of all scripts defined in composer.json file.\n -d, --working-dir=WORKING-DIR If specified, use the given directory as working directory.\n --no-cache Prevent use of the cache\n -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug\n<\/pre>\n\n\n\n<\/span>Step 5. Install Laravel<\/span><\/h2>\n\n\n\nWe will install Laravel with the composer in the default apache2 document root location:<\/p>\n\n\n\n
cd \/var\/www\/html\/\n\ncomposer create-project laravel\/laravel \"ProjectName\"\n<\/pre>\n\n\n\nAfter successful installation, you should receive the following output:<\/p>\n\n\n\n
59 package suggestions were added by new dependencies, use `composer suggest` to see details.\nGenerating optimized autoload files\n> Illuminate\\Foundation\\ComposerScripts::postAutoloadDump\n> @php artisan package:discover --ansi\n\n INFO Discovering packages.\n\n laravel\/sail ................................................................................................................................ DONE\n laravel\/sanctum ............................................................................................................................. DONE\n laravel\/tinker .............................................................................................................................. DONE\n nesbot\/carbon ............................................................................................................................... DONE\n nunomaduro\/collision ........................................................................................................................ DONE\n nunomaduro\/termwind ......................................................................................................................... DONE\n spatie\/laravel-ignition ..................................................................................................................... DONE\n\n80 packages you are using are looking for funding.\nUse the `composer fund` command to find out more!\n> @php artisan vendor:publish --tag=laravel-assets --ansi --force\n\n INFO No publishable resources for tag [laravel-assets].\n\nNo security vulnerability advisories found\n> @php artisan key:generate --ansi\n\n INFO Application key set successfully\n<\/pre>\n\n\n\nSet the right permissions to Laravel’s document root<\/p>\n\n\n\n
cd \/var\/www\/html\/\"ProjectName\"\n\nchown -R www-data:www-data .\n\nchmod -R 775 storage\n<\/pre>\n\n\n\n