Install and Configure Drupal in the ServBay Environment
What is Drupal?
Drupal is a powerful open-source content management system (CMS) widely used to build various types of websites, from personal blogs to corporate portals. Drupal offers flexible content management, user permissions management, and extensible features, making it suitable for constructing complex and high-performance websites.
Steps to Install Drupal
In this article, we will introduce how to install and configure Drupal in the ServBay environment.
Step 1: Create a Project Directory
First, create a new project directory in the www
directory of ServBay:
cd /Applications/ServBay/www
mkdir servbay-drupal-app
cd servbay-drupal-app
2
3
Step 2: Create a Drupal Project Using Composer
ServBay already comes with Composer, so we can directly use Composer to create a Drupal project:
composer create-project drupal/recommended-project .
Step 3: Create a Database and User
Access the phpMyAdmin Database Management Tool Provided by ServBay
Open https://servbay.host/, click on "phpMyAdmin" to enter the phpMyAdmin database management tool.
Create a Database User
Access the User Accounts Page
- On the main page of phpMyAdmin, click on "User accounts" in the top menu.
Add a New User
- Click "Add user account".
- Fill in the following information:
- Username:
drupal_user
- Hostname:
localhost
- Password: Enter a secure password, such as
password123
- Re-enter: Enter the password again
- Username:
- In the "Database for user" section, select "Create database with same name and grant all privileges".
- Ensure that "Grant all privileges" is checked.
- Click the "Go" button.
Step 4: Configure the Web Server
Add a New Website
Open ServBay, click on the "Hosts" tab, and add a new website:
- Name:
My Drupal Site
- Domain:
servbay-drupal.local
- Site type:
PHP
- PHP version: Select the corresponding PHP version
- Root directory:
/Applications/ServBay/www/servbay-drupal-app/web
- Name:
Save Configuration
Save the configuration.
Step 5: Run the Drupal Installer
Access the Installation Page
Open a browser and visit
https://servbay-drupal.local/core/install.php
, you will see the Drupal installation page.Choose Language
Select the language you want to use, then click "Save and continue".
Select Installation Profile
Choose "Standard", then click "Save and continue".
Set Database Information
Follow the prompts to fill in the database connection information:
- Database type:
MySQL, MariaDB, Percona Server, or equivalent
- Database name:
drupal_user
(same as the username) - Database username:
drupal_user
- Database password:
password123
- Database host:
localhost
- Database type:
Fill in the Site Information
Follow the prompts to fill in the site information, including site name, site email address, admin username, and password, etc.
Complete Installation
Click the "Save and continue" button to complete the installation process.
Step 6: Install Modules and Themes
Install Modules
Log in to the Drupal admin dashboard, click "Extend", search for and install the modules you need.
Install Themes
Click "Appearance", select and install a theme you like.
Using Drupal to Build a Website
Now that you have successfully installed and configured Drupal in the ServBay environment, you can start using it to build your website. Here are some common operations:
Create Content Types and Content
Create Content Types
In the Drupal admin dashboard, click "Structure" -> "Content types", create a new content type, fill in the content type name and other settings, then click "Save content type".
Create Content
Click "Content" -> "Add content", select the content type you just created, fill in the content title and content, then click "Save and publish".
Configure Navigation Menu
Create Menu
In the Drupal admin dashboard, click "Structure" -> "Menus", create a new navigation menu, fill in the menu name and other settings, then click "Save".
Add Menu Items
Add content to the navigation menu, then click "Save menu".
Customize Blocks
Add Blocks
In the Drupal admin dashboard, click "Structure" -> "Block layout", drag the blocks you need into the specified area, then click "Save blocks".
Configure Blocks
Configure the block settings as needed, then click "Save block".
By following the above steps, you have successfully installed and configured Drupal in the ServBay environment and started using it to build your website. Drupal's powerful features and flexibility make it an ideal choice for building various types of websites.