Before starting, ensure you have:
-
Terminal access to your Linux server (via SSH or direct login).
-
Sufficient permissions to access Laravel project files and MySQL
database.
- Basic understanding of Linux commands.
cd /path/to/your/infix-project
Example:
cd
/var/www/html/infixedu
Option 1: Create a `.zip` archive
zip -r infix_project_backup_$(date +%F).zip . -x "vendor/*" "node_modules/*"
Option 2: Create a `.tar.gz` archive
tar --exclude='vendor' --exclude='node_modules' -czvf infix_project_backup_$(date +%F).tar.gz .
💡 Excluding `vendor/` and `node_modules/` can reduce backup size. You can reinstall them later using `composer install` and `npm install`.
mysqldump -u DB_USERNAME -p DB_NAME > db_backup_$(date +%F).sql
Replace:
- DB_USERNAME → Your
database username
- DB_NAME → Your Laravel project’s
database name
Example:
mysqldump -u root -p infix_db > db_backup_$(date +%F).sql
After running the command, you’ll be prompted to enter the database password.
You now have:
- infix_project_backup_YYYY-MM-DD.tar.gz or .zip
-
db_backup_YYYY-MM-DD.sql
mkdir -p ~/backups/my-infix-app
mv infix_project_backup_*.tar.gz db_backup_*.sql
~/backups/my-infix-app/
scp
user@your-server:/path/to/backup/*.tar.gz /local/path/
scp
user@your-server:/path/to/backup/*.sql /local/path/
To ensure the integrity of your backup:
- Extract the project archive: `tar -xvzf filename.tar.gz`
- Open the `.sql` file in a text editor to verify it contains SQL data.
- Consider automating this
process using a shell script or cron job for regular backups.
-
Always store backups in a secure location.
- Double-check file
permissions if any issues arise during compression or transfer.