sudo apt install apache2 -y<\/pre>\nOnce installed, start and enable the service.<\/p>\n
sudo systemctl enable apache2 && sudo systemctl start apache2<\/pre>\nCheck if the service is up and running:<\/p>\n
sudo systemctl status apache2<\/pre>\nYou should receive the following output:<\/p>\n
root@host:~# sudo systemctl status apache2\r\n\u25cf apache2.service - The Apache HTTP Server\r\n Loaded: loaded (\/lib\/systemd\/system\/apache2.service; enabled; vendor preset: enabled)\r\n Active: active (running) since Thu 2022-11-03 15:27:44 CDT; 25min ago\r\n Docs: https:\/\/httpd.apache.org\/docs\/2.4\/\r\n Main PID: 450 (apache2)\r\n Tasks: 55 (limit: 4678)\r\n Memory: 16.2M\r\n CPU: 556ms\r\n CGroup: \/system.slice\/apache2.service\r\n \u251c\u2500450 \/usr\/sbin\/apache2 -k start\r\n \u251c\u2500471 \/usr\/sbin\/apache2 -k start\r\n \u2514\u2500472 \/usr\/sbin\/apache2 -k start\r\n\r\nNov 03 15:27:43 host.test.vps systemd[1]: Starting The Apache HTTP Server...\r\nNov 03 15:27:44 host.test.vps systemd[1]: Started The Apache HTTP Server.\r\n<\/pre>\n<\/span>Step 3. Install PHP8.1 with dependencies<\/span><\/h2>\nBefore we continue with PHP installation, we need to install some dependencies:<\/p>\n
sudo apt install software-properties-common ca-certificates lsb-release apt-transport-https -y<\/pre>\nNext, we need to add the PHP repository and key since they are not added in Debian 11 repository by default:<\/p>\n
sudo sh -c 'echo \"deb https:\/\/packages.sury.org\/php\/ $(lsb_release -sc) main\" > \/etc\/apt\/sources.list.d\/php.list' \r\n\r\nwget -qO - https:\/\/packages.sury.org\/php\/apt.gpg | sudo apt-key add -<\/pre>\nOnce these are added, we need to update the repository again.<\/p>\n
sudo apt update -y<\/pre>\nTo install the PHP8.1 along with extensions, execute the following command:<\/p>\n
sudo apt-get install php8.1 php8.1-cli php8.1-common php8.1-imap php8.1-redis php8.1-snmp php8.1-xml php8.1-zip php8.1-mbstring php8.1-curl libapache2-mod-php php8.1-intl php8.1-gd php8.1-mysql -y\r\n<\/pre>\n<\/span>Step 4. Install the MariaDB database server<\/span><\/h2>\nTo install the MariaDB database server, execute the command below.<\/p>\n
sudo apt install mariadb-server -y<\/pre>\nStart and enable the mariadb.service with the following commands:<\/p>\n
sudo systemctl start mariadb && sudo systemctl enable mariadb<\/pre>\nCheck the status of the mariadb.service<\/p>\n
sudo systemctl status mariadb<\/pre>\nYou should receive the following output:<\/p>\n
root@host:~# sudo systemctl status mariadb\r\n\u25cf mariadb.service - MariaDB 10.5.15 database server\r\n Loaded: loaded (\/lib\/systemd\/system\/mariadb.service; enabled; vendor preset: enabled)\r\n Active: active (running) since Thu 2022-11-03 16:06:19 CDT; 24s ago\r\n Docs: man:mariadbd(8)\r\n https:\/\/mariadb.com\/kb\/en\/library\/systemd\/\r\n Main PID: 14068 (mariadbd)\r\n Status: \"Taking your SQL requests now...\"\r\n Tasks: 19 (limit: 4678)\r\n Memory: 72.8M\r\n CPU: 670ms\r\n CGroup: \/system.slice\/mariadb.service\r\n \u2514\u250014068 \/usr\/sbin\/mariadbd\r\n<\/pre>\n<\/span>Step 5. Create Database and Database User<\/span><\/h2>\nNow, when the LAMP stack is installed, we are going to create an empty database for Dolibarr and the database user with permission to that database.<\/p>\n
Login to the MySQL console and execute the following commands:<\/p>\n
CREATE DATABASE dolibarr;\r\nCREATE USER 'dolibarr'@'localhost' IDENTIFIED BY 'YourStrongPasswordHere';\r\nGRANT ALL PRIVILEGES ON dolibarr.* TO 'dolibarr'@'localhost';\r\nFLUSH PRIVILEGES;\r\nEXIT;<\/pre>\n