This script automates the process of installing Drupal on a Linux server. It performs tasks such as updating the system, installing necessary packages, setting up the database, and configuring Apache and PHP.
The script performs the following steps:
-
System Update: The script starts by updating the system's package list and upgrading all installed packages.
-
Apache Installation: The script installs Apache2 and starts the service.
-
PHP Installation: The script adds the necessary repositories and installs PHP-8.3 along with necessary extensions.
-
MariaDB Installation: The script installs MariaDB, starts the service, and sets up a new database and user for Drupal.
-
Drupal Installation: The script downloads and extracts Drupal in the appropriate directory, sets the correct permissions, and configures Apache to serve the Drupal site.
-
Final Configuration: The script makes necessary changes in
php.ini
file, restarts Apache, and displays the database credentials.
To use this script, simply run it on your Linux server. The script will handle the rest :
wget -O - https://github.com/InstaZDLL/drupal-installer/releases/download/v1.1.1/drupal-install-composer-apache2.sh | sudo bash
If you want to use the manual installation without the composer, use this :
wget -O - https://github.com/InstaZDLL/drupal-install/releases/download/v1.0.1/drupal-install.sh | sudo bash
At the end of the script, a file named db_credentials.txt
will be created in the home directory of the current user. This file contains the database username and a randomly generated password.
Please handle the db_credentials.txt
file securely as it contains sensitive information.
If you encounter this error message The trusted_host_patterns parameter is not configured in settings.php
in drupal dashboard follow these steps :
First, edit the setting.php
sudo vi /var/www/html/drupal/sites/default/settings.php
find the line where you see this :
# $settings['trusted_host_patterns'] = [];
Uncomment and replace it with :
$settings['trusted_host_patterns'] = ['^YOUR PUBLIC HOST IP$', '^127\\.0\\.0\\.1\\$', '^localhost$',];
$settings['trusted_host_patterns'] = ['^119\\.151\\.218\\.9$', '^127\\.0\\.0\\.1\\$', '^localhost$',];
Save the file (if you're using vim use :wq!
) and the error should be fixed with a sudo systemctl restart apache2
.
- Supports multiple Linux distributions
- Upgrade option to update the old Drupal version to the latest one.
Contributions are welcome! Please feel free to submit a Pull Request.
Copyright (C) 2024 Ethan Besson
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.