Debian 11 bullseye drupal local environment

Debian 11 bullseye drupal local environment

Clone the repository into ~/projects/drupal/projectname

** Dump database from production **

2. Dump database from prod drupal website using drush:

../vendor/drush/drush/drush sql-dump --gzip --result-file=../db_dump_08072023_1102am_latest.sql

3. Copy dump db from local using rsync

rsync --progress ~/projects/drupal/projectname

* Create mysql user

CREATE USER 'username'@'localhost' IDENTIFIED WITH authentication_plugin BY 'password';

* Grant all privileges to db

GRANT ALL PRIVILEGES ON database_name.* TO 'username'@'localhost';

** Nginx server **

4. Install nginx server:

sudo apt install nginx

5. Create directory in /var/www/projectname -> will be symlink to actual directory.
6. Create nginx server config in /etc/nginx/sites-available/projectname.
7. Symlink the nginx server config to enabled:

sudo ln -s /etc/nginx/sites-available/projectname /etc/nginx/sites-enabled/projectname

8. Run

sudo nginx -t && sudo systemctl restart nginx.service

** Install php **


sudo apt install php-fpm php-mysql

Install php extension for drupal 9; check your php version first before installing.

sudo apt install php8.2-cli php8.2-common php8.2-curl php8.2-gd php8.2-mbstring php8.2-mysql php8.2-opcache php8.2-readline php8.2-sqlite3 php8.2-xml php8.2-apcu

** Install composer **


sudo apt install composer

11. Once composer is installed, run this

sudo apt-get install libpcre2-8-0

to fix issue in debian

** Install database **


Sudo apt install mardiadb

** When error encountered:
ERROR 1273 (HY000) at line 25: Unknown collation: 'utf8mb4_0900_ai_ci'

Update the .sql using sed

sed -i 's/utf8mb4_0900_ai_ci/utf8_general_ci/g' backup.sql
sed -i 's/CHARSET=utf8mb4/CHARSET=utf8/g' backup.sql

** Copying large files in remote server will resume if time out**

while ( ! rsync -avzP --progress username@domain:~/file.tar.gz . ); do sleep 1; done

Add new comment