Laravel is a web application framework with expressive, elegant syntax. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as authentication, routing, sessions, and caching.
A system with CentOS Stream 9 installed and running.
rootaccess to the system.
- LAMP Stack installed and running, for this, you can refer to one of our guides on installing the LAMP Stack (Apache, MariaDB and PHP).
Once you're all set, we'll proceed with Laravel installation and configuration.
Next, let us disable SELinux. We are going to set SELinux to permissive. Edit this file:
Then update, Edit this line to permissive:
First, Install PHP Composer as follows:
curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer chmod +x /usr/local/bin/composer
Let's create a Laravel application using the composer package manager:
cd /var/www composer create-project laravel/laravel CrownCloud-Laravel-App
This will download the laravel and its dependencies on your CentOS Stream 9.
Now, Let's create an encryption key:
cd /var/www/CrownCloud-Laravel-App php artisan key:generate
Create a new apache configuration file
laravel.conf for Laravel with the following command:
Add the following codes:
<VirtualHost *:80> ServerName dev.domainhere.info DocumentRoot /var/www/CrownCloud-Laravel-App/public <Directory /var/www/CrownCloud-Laravel-App> AllowOverride All </Directory> </VirtualHost>
Change dev.domainhere.info with
Your Domain Name. If you are using with IP, Please remove the entire server_name line.
Now, press the
Esc key, and type in
:wq! and press the
Enter key to save and exit the file.
Set directory and file permissions:
chown -R apache.apache /var/www/CrownCloud-Laravel-App chmod -R 755 /var/www/CrownCloud-Laravel-App chmod -R 755 /var/www/CrownCloud-Laravel-App/storage chcon -R -t httpd_sys_rw_content_t /var/www/CrownCloud-Laravel-App/storage
Now, open the domain from your browser, this will redirect you to the Laravel landing page on your server.
dev.domainhere.infowith the actual IP or domain configured on the server.
Now you have successfully installed Laravel with LAMP on your server.