- PHP (>= 8.1)
- Composer
- MySQL
- Git
- Node.js and NPM
-
Install Composer dependencies:
php ~/composer.phar install
-
Copy .env.example to .env:
cp .env.example .env
-
Generate a new application key:
php artisan key:generate
-
Edit the .env file:
nano .env
Update the database settings and other necessary configurations.
-
Install NPM dependencies and compile assets:
npm install npm run build
-
Clear the cache and optimize:
php artisan config:cache php artisan config:clear php artisan optimize:clear php artisan cache:clear php artisan config:cache php artisan optimize php artisan storage:link
-
Change ownership of the project files:
sudo chown -R www-data:www-data /path/to/your/project
-
Change permissions of the project files:
sudo chmod -R 775 /path/to/your/project/storage sudo chmod -R 775 /path/to/your/project/bootstrap/cache
-
Login to MySQL:
mysql -u your_username -p
-
Create a new database and user:
CREATE DATABASE biosetdb; CREATE USER 'bioset'@'localhost' IDENTIFIED BY 'bioset@2024'; GRANT ALL PRIVILEGES ON biosetdb.* TO 'bioset'@'localhost'; FLUSH PRIVILEGES; EXIT;
-
Migrate the database:
php artisan migrate
-
Seed the database:
php artisan db:seed
-
Clear the cache and optimize:
php artisan optimize:clear php artisan optimize
- Create a symbolic link from
public/
topublic_html
:ln -s /path/to/your/project/public /path/to/your/project/public_html
-
Set up scheduled tasks: Add the following to your crontab (
crontab -e
):* * * * * cd /path/to/your/project && php artisan schedule:run >> /dev/null 2>&1
-
Configure queue worker (if needed):
sudo nano /etc/supervisor/conf.d/laravel-worker.conf
Add the following configuration:
[program:laravel-worker] process_name=%(program_name)s_%(process_num)02d command=php /path/to/your/project/artisan queue:work autostart=true autorestart=true user=www-data numprocs=8 redirect_stderr=true stdout_logfile=/path/to/your/project/worker.log
Then run:
sudo supervisorctl reread sudo supervisorctl update sudo supervisorctl start laravel-worker:*
-
Set up SSL (optional but recommended): Use Let's Encrypt for free SSL certificates:
sudo apt install certbot python3-certbot-apache sudo certbot --apache -d yourdomain.com
-
Final checks:
- Ensure all services are running: PHP, MySQL
- Check Laravel logs for any errors:
tail -f /path/to/your/project/storage/logs/laravel.log
- Test the application in a web browser
Remember to replace /path/to/your/project
with the actual path to your project and yourdomain.com
with your actual domain or server IP address where appropriate.