This script automates the setup of a web server environment with Apache, MySQL (or MariaDB), and PHP. It also configures a MySQL database and installs necessary PHP extensions.
- A Unix-based operating system (e.g., Ubuntu)
- Root or sudo privileges
- Updates the package list and upgrades installed packages.
- Installs Apache, MySQL (or MariaDB), and PHP.
- Configures Apache to enable
mod_rewrite
. - Installs and secures MySQL server.
- Creates a MySQL database and user with specified credentials.
- Installs Composer and necessary PHP extensions.
- Installs Node.js and npm.
- Installs Certbot for SSL certificates.
- Installs Supervisor for process management.
- Installs Redis.
- Installs UFW firewall and configures it to allow SSH and Apache.
- Restarts Apache to apply changes.
Run this with root or sudo privileges:
sudo curl -sS https://raw.githubusercontent.com/tauseedzaman/ubuntu-laravel-setup/main/script.sh | bash
In interactive mode, the script will prompt you before installing each package and allow you to enter the database configuration details.
curl -sS https://raw.githubusercontent.com/tauseedzaman/ubuntu-laravel-setup/main/script.sh -o script.sh
sudo bash script.sh --interactive
The script includes default database configuration values:
DB_HOST="127.0.0.1"
DB_PORT="3306"
DB_NAME="laravel_db"
DB_USER="laravel_db_user"
DB_PASS="laravel_db_pass"
You can modify these values within the script to match your desired database configuration.
- Ensure the script is run in a secure environment, as it involves setting up and securing a database.
- Verify that the required PHP extensions (
php-xml
andphp-gd
) are available for your PHP version.