How to install Drupal


# configure the firewall
firewall-cmd --add-port 3306/tcp --permanent
firewall-cmd --add-port 80/tcp --permanent
firewall-cmd --reload

# Download and install PHP 8.1.1
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
dnf install -y https://rpms.remirepo.net/enterprise/remi-release-8.rpm
dnf -y module list php
dnf -y install httpd php81 php81-php-cli php81-php-common php81-php-gd php81-php-mbstring php81-php-mysqlnd
ln -s /bin/php81 /bin/php

# Install MySQL
dnf -y install mysql-server mysql mysql-devel

# start and enable mysql and apache
systemctl enable --now mysqld
systemctl enable --now httpd

# Setup MySQL
/usr/bin/mysql_secure_installation

# Create MySQL Database
mysql -u root -p
CREATE DATABASE mydrupaldb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER drupaluser@'%' IDENTIFIED BY 'Password';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES ON mydrupaldb.* TO 'drupaluser'@'%';
FLUSH PRIVILEGES;

# Test MySQL database
mysql -u drupaluser -p

# Fix permissions
chown -R apache:apache /var/www

# Install Composer
cd /var/www/html
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
mv composer.phar /usr/local/bin/composer

# Install Drupal (recommended)
composer create-project drupal/recommended-project mynotes

# Install Drupal 9.3 (old way)
cd /var/www/html
mkdir drupal
cd drupal
curl -sSL https://www.drupal.org/download-latest/tar.gz | tar -xz --strip-components=1


# change / add the following settings in httpd.conf then restart httpd
vi /etc/httpd/conf/httpd.conf

DocumentRoot "/var/www/html/mynotes/web"

<Directory "/var/www/html/mynotes/web">
    RewriteEngine on
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !=/favicon.ico
    RewriteRule ^ index.php [L]
    AllowOverride All
    Options Indexes FollowSymLinks
    Require all granted
</Directory>

# Fix permissions and restart apache
chown -R apache:apache /var/www
systemctl restart httpd

# browse to
http://192.168.1.103/mynotes/web/core/install.php

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer