There are many ways to host Drupal websites.
Install Drupal at a webhost that uses CPanel and public_html as the root of the website.
Step 1: Log in to cPanel
- Open your web browser and go to yourwebsite.com/cpanel.
- Enter your cPanel username and password (provided by your web host).
- Click Log in.
Step 2: Create a MySQL Database
Drupal requires a database to store its content and settings.
- In cPanel, go to Databases > MySQL Databases.
- Under Create a New Database, enter a database name (e.g., drupal_db) and click Create Database.
- Scroll down to MySQL Users and create a user:
- Enter a username (e.g., drupal_user).
- Enter a strong password.
- Click Create User.
- Assign the user to the database:
- Under Add User to Database, select the user and database.
- Click Add and select All Privileges.
- Click Make Changes.
Step 3: Install Drupal
We'll do most of this in the terminal.
- Scroll down and find the Terminal button. Open a new terminal window.
- Type ls and press enter. Make sure you are in the root and can see the public_html folder listed.
- Enter the following commands:
composer create-project drupal/recommended-project:10.4.3 public_html --no-interaction --no-install (update the version of Drupal to the version you want).
cd public_html
mv composer.json ../
rm composer.lock
cd ..
- You'll need to edit the composer.json file. Click on the CPanel logo and go to the File Manager. Click on composer.json and edit the file. You'll need to change web/ to public_html/ (see the file attached). Save and head back to the terminal.
- Enter:
composer install
Head over to the URL of your site and complete the set up like any Drupal site. You'll need the database credentials you created earlier.
You're done!