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 username@domainname.com:~/directory/db_dump_08072023_1102am_latest.tar.gz ~/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 **

9.

sudo apt install php-fpm php-mysql

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

sudo apt install php8.1-cli php8.1-common php8.1-curl php8.1-gd php8.1-mbstring php8.1-mysql php8.1-opcache php8.1-readline php8.1-sqlite3 php8.1-xml php8.1-apcu php8.1-gd php8.1-intl php8.1-xsl php8.1-bcmath

** Install composer **

10.

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 **

12.

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