Install Drupal Framework: Step-by-Step Guide
In this article
Yes, you can install the Drupal framework on your own server or local machine. Drupal is a free, open-source content management system (CMS) that powers millions of websites. This guide walks you through a standard installation using the recommended method: downloading Drupal, creating a database, and running the web installer. You'll need a web server (Apache or Nginx), PHP, and a database (MySQL or MariaDB) already set up. If you don't have those yet, the guide includes a quick check to confirm they're ready.
What You'll Need
- A web server (Apache or Nginx) with PHP 8.1 or higher (Drupal 10/11 requirement).
- A database server: MySQL 5.7+ or MariaDB 10.3+ (or PostgreSQL 12+).
- Composer (optional but recommended for managing Drupal modules and themes).
- FTP or SSH access to your server, or a local development environment like XAMPP, MAMP, or Laragon.
- A domain name or localhost URL.
Step-by-Step
- Check your server requirements. Log into your server or local environment and verify PHP version and extensions. Run
php -vin a terminal (or check phpinfo() in a browser). Drupal needs the following PHP extensions:pdo,mysql(orpgsql),gd,xml,curl, andmbstring. If any are missing, install them via your package manager (e.g.,sudo apt install php-mysql php-gd php-xml php-curl php-mbstringon Ubuntu). - Create a database and a database user. Using your database admin tool (phpMyAdmin, Adminer, or command line), create a new database. For example, in MySQL:
CREATE DATABASE drupal_db CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;Then create a user and grant privileges:CREATE USER 'drupal_user'@'localhost' IDENTIFIED BY 'your_password';andGRANT ALL PRIVILEGES ON drupal_db.* TO 'drupal_user'@'localhost';Then runFLUSH PRIVILEGES;. Note the database name, username, and password—you'll need them during installation. - Download Drupal. Go to the official Drupal download page (drupal.org/download) and get the latest stable release. You can also use Composer:
composer create-project drupal/recommended-project my_sitein your web root. If using a plain download, extract the archive into your web server's document root (or a subfolder). For example, on Linux with Apache, the root is often/var/www/html. - Set file permissions. Drupal needs write access to
sites/defaultand its subdirectories. If you're on a Linux server, run:chmod -R 755 sites/defaultand create asites/default/filesdirectory:mkdir sites/default/filesthenchmod 775 sites/default/files. On Windows (XAMPP), permissions are usually not an issue, but ensure the folder is writable. - Run the installer. Open your browser and go to your site's URL (e.g.,
http://localhost/my_siteor your domain). The Drupal installer will start automatically. Choose your language and click “Save and continue”. - Choose an installation profile. Select “Standard” for a typical site with common features, or “Minimal” for a bare-bones setup. Click “Save and continue”.
- Enter database details. Fill in the database type (MySQL, MariaDB, or PostgreSQL), database name, username, password, and host (usually
localhost). Leave the port blank unless your server uses a non-standard port. Click “Save and continue”. Drupal will test the connection and proceed. - Configure the site. Provide your site name, email address, and create the administrator account (username, password, email). Set the default country and timezone. Click “Save and continue”.
- Finish installation. Drupal will install modules and configuration. When done, you'll see a success page with a link to your new site. Click “Visit your new site” to see the front page.
- Remove the install file (optional but recommended). For security, delete the
INSTALL.txtfile from the Drupal root, and if you used the plain download, remove thesites/default/settings.phpbackup if you didn't rename it. The installer usually handles this, but check thatsites/default/settings.phpexists and is read-only after installation.
Common Mistakes
- Wrong PHP version. Drupal 10/11 requires PHP 8.1+. If your server has an older version, the installer will fail. Update PHP or use a local environment with a newer version.
- Missing PHP extensions. The installer will warn about missing extensions, but sometimes it fails silently. Double-check that all required extensions are enabled in your php.ini file.
- Database user lacks privileges. If the database user can't create tables or alter the database, installation fails. Grant ALL PRIVILEGES to the user.
- File permission errors. On Linux, if
sites/default/filesisn't writable, Drupal can't create configuration files. Usechmod -R 775orchownto the web server user. - Using the wrong database host. If your database is on a separate server, use the IP or hostname, not
localhost. For local setups,localhostis usually correct.
Tips
- Use Composer. Composer makes it easy to install Drupal and manage modules. It also ensures you get the correct file structure and dependencies.
- Back up your database. Before installing, export an empty database dump if you plan to test. After installation, make a backup of the database and the
sites/default/settings.phpfile. - Enable clean URLs. After installation, go to Configuration > Search and metadata > Clean URLs and enable it if your server supports mod_rewrite (Apache) or equivalent (Nginx). This makes URLs look like
/node/1instead of/?q=node/1. - Use a local development environment. If you're just learning, install XAMPP or Laragon on your computer—it's faster and safer than experimenting on a live server.
- Keep Drupal updated. After installation, check for updates regularly via the “Available updates” page in the admin area.
Troubleshooting
If the installation fails, follow these steps in order:
- Restart your web server and database. Sometimes services need a restart after installing PHP extensions or changing configuration. On Linux:
sudo systemctl restart apache2(or nginx) andsudo systemctl restart mysql. - Check the PHP error log. Look in the web server's error log (e.g.,
/var/log/apache2/error.log) or PHP's error log. This will show the exact error message. - Verify database connection. Test the database credentials using a command-line client or phpMyAdmin. Ensure the database name, username, and password are correct.
- Re-run the installer. If you see a “Drupal already installed” error, delete the
sites/default/settings.phpfile and thesites/default/filesdirectory (but back up any content first). Then refresh the installer page. - Check file permissions again. On Linux, if you get a “Configuration file is not writable” error, run
chmod 666 sites/default/settings.phpbefore installation, then set it to444after. - If all else fails, re-download Drupal. A corrupted download can cause weird errors. Delete the folder and extract a fresh copy, then repeat the installer.
Frequently Asked Questions
Can I install Drupal on shared hosting?
Yes, most shared hosting providers support Drupal. You'll need a control panel like cPanel to create a database and upload files via FTP. Check that your hosting plan meets the PHP version and extension requirements.
What's the difference between Drupal and WordPress?
Drupal is more flexible and developer-friendly, with robust content modeling and user permissions. WordPress is simpler for basic blogs and small sites. Drupal has a steeper learning curve but is more powerful for complex sites.
Do I need to know PHP to install Drupal?
No, the installer is graphical and doesn't require coding. However, knowing PHP helps with troubleshooting and customizing modules later.
Can I install Drupal locally on Windows?
Yes, use XAMPP or Laragon to create a local server with Apache, MySQL, and PHP. Then follow the same steps, just use http://localhost/your_folder as the URL.
How long does installation take?
Typically 5–10 minutes, depending on your server speed and internet connection. The installer runs automatically once you start it.
Is Drupal free?
Yes, Drupal is free and open-source under the GNU General Public License. You can download, use, and modify it without cost.