Installing Laravel in Cloud with Debian 10
Contract Cloud One with Debian Buster 10
First of all, you must have a Cloud server, for example a Cloud One A1. The Cloud can be contracted from our web or, if you are already a SW Hosting client, from your account SW Panel
SSH connection
At the time of registering the server, both from the web and from the SW Panel, an email will be sent to your email account with the SSH access credentials (IP and port) to your Cloud server for the administrator user (Root).
With these credentials you can access your server and start the Laravel installation process.
Create a user
In SW Hosting, we recommend creating a user with elevated permissions and not using the root user for these purposes.
To create a user, you can do it using the following commands.
apt install sudo
adduser swtest
usermod -aG sudo swtest
su - swtest

Now we have a system user with sudo privileges and we should no longer use root directly
Minimum packages required
We start by adding the PHP 7.4 repositories:
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list

Once the repository has been added, we will proceed to update the list of packages and the Cloud.
sudo apt update
sudo apt upgrade

Once updated, we install the following essential packages:
sudo apt install lsb-release apt-transport-https ca-certificates git zip unzip

LAMP: Install Apache, MariaDB and PHP 7.4
To start, we installed the Apache service:
sudo apt install apache2

To verify the correct operation of the service, you can do it with the following command:
sudo service apache2 status

You can also check with the browser, using the IP of your Cloud.

Once the correct operation has been verified, we install the PHP 7.4 service and the mbstring and xml modules:
sudo apt install php7.4 php7.4-fpm php7.4-mbstring php7.4-xml

We can verify the correct operation of PHP by creating a small PHP script in /var/www/html, for this we will do the following:
cd /var/www/html
sudo nano info.php
The content of the file must be as follows:
<?php
// Show all information, by default INFO_ALL
phpinfo();
// Show only module information.
// phpinfo(8) does exactly the same.
phpinfo(INFO_MODULES);
?>
Official file: https://www.php.net/manual/es/function.phpinfo.php
Once the file is saved, we run it from the browser with the following URL:
http://ipdelservidor/info.php

You can also check that it works correctly with the following command:
service php7.4-fpm status

Once PHP 7.4 and its modules are installed, we will proceed to install the MariaDB database as a service (Server) and its PHP module:
sudo apt install mariadb-server php7.4-mysql

To perform the service check you can do it with the following commands:
service mariadb status

mariadb -p

Create Virtualhost in Apache
We will use manuals.sw as an example.
To start, let's create the configuration file. To do this, we must first access the path, and, once you are in the directory, create the configuration file manuals.conf.
cd /etc/apache2/sites-available
sudo nano manuales.conf
In the configuration file, we define the following configuration:
<VirtualHost *:80>
ServerName manuales.sw
DocumentRoot "/var/www/manuales/public"
</VirtualHost>
Once the configuration file has been created, we activate the site with the following commands:
sudo a2ensite manuales
sudo systemctl reload apache2
Creating VirtualHost configurations on your Apache server does not magically create DNS entries for those host names. You must have the DNS names, resolving to your IP address, or no one else will be able to see your website.
If your domain, in its DNS zone, is not pointing to the Cloud, to carry out the tests, you can edit the hosts file.
Remember that this configuration is only available on the computer where the hosts file has been modified, the others are not, unless the file is configured.
Modify our hosts file
You can follow the following manual to edit the hosts file:
Manual de hosts
In the hosts file, we will add a line:
IP-del-Cloud manuales.sw
Composer
Composer is a package management system for programming in PHP, which provides the standard formats necessary to manage dependencies and libraries of this.
To get started, we will install Composer:
sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
sudo php -r "if (hash_file('sha384', 'composer-setup.php') === 'e5325b19b381bfd88ce90a5ddb7823406b2a38cff6bb704b0acc289a09c8128d4a8ce2bbafcd1fcbdc38666422fe2806') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
sudo php composer-setup.php
sudo php -r "unlink('composer-setup.php');"
sudo mv composer.phar /usr/bin/composer
You can check more information in the Official Website of Composer.
To verify the correct operation of the Composer, we will execute the following command:
composer

Laravel
Once the requirements to run Laravel are installed, we proceed to the deployment of the Framework. To do this, we run the following commands:
First, we access the following directory:
cd /var/www
Once inside, we execute the deployment using the Composer.
With Composer you can display different Frameworks that you can find on the official website, in the "Browse Packages" section.
We are going to use the laravel/laravel package and we are going to define it with the name of manuals.
When executing the command, it will download different dependencies and will create the manuals folder in the current directory (in our case /var/www), where we will find the entire project.
composer create-project --prefer-dist laravel/laravel manuales

Folder privileges
Once the project is created, we will enter the manuals folder and then grant the necessary permissions for its execution:
cd manuales
sudo chown www-data:www-data storage/ -R
sudo chown www-data:www-data bootstrap/cache/ -R

For more information on the installation of Laravel, you can consult the Official Website of Laravel
We can verify the correct operation of Laravel with the browser http://manuales.sw

You can continue configuring the Laravel parameters: Connection to the database, cache, sessions, etc.