LEMP stack<\/a> is the MariaDB database server. To install MariaDB execute the following command:<\/p>\n\n\n\nsudo apt install mariadb-server -y<\/pre>\n\n\n\nOnce the installation is complete, start and enable the MariaDB service:<\/p>\n\n\n\n
sudo systemctl start mariadb && sudo systemctl enable mariadb<\/pre>\n\n\n\nCheck the status of the mariadb.service<\/p>\n\n\n\n
sudo systemctl status mariadb<\/pre>\n\n\n\nYou should receive the following output:<\/p>\n\n\n\n
root@host:~# sudo systemctl status mariadb\n\u25cf mariadb.service - MariaDB 10.6.12 database server\n Loaded: loaded (\/lib\/systemd\/system\/mariadb.service; enabled; vendor preset: enabled)\n Active: active (running) since Tue 2023-08-08 13:43:09 CDT; 34s ago\n Docs: man:mariadbd(8)\n https:\/\/mariadb.com\/kb\/en\/library\/systemd\/\n Main PID: 120012 (mariadbd)\n Status: \"Taking your SQL requests now...\"\n Tasks: 15 (limit: 4557)\n Memory: 67.9M\n CPU: 824ms\n CGroup: \/system.slice\/mariadb.service\n \u2514\u2500120012 \/usr\/sbin\/mariadbd\n<\/pre>\n\n\n\n<\/span>Step 4. Install PHP8.1 with dependencies<\/span><\/h2>\n\n\n\nThe last of the LEMP stack will be PHP. PHP8.1 is by default enabled in the Debian 12 repository, so to install PHP8.1 with extensions, execute the following commands:<\/p>\n\n\n\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 php8.1-mysqli php8.1-intl php8.1-bcmath php8.1-gd libapache2-mod-php php8.1-fpm -y\n<\/pre>\n\n\n\nTo check the installed PHP version execute the php -v<\/strong> command:<\/p>\n\n\n\nTo check the installed PHP version, execute the following command:<\/p>\n\n\n\n
php -v<\/pre>\n\n\n\nYou should get the following output:<\/p>\n\n\n\n
root@host:~# php -v\nPHP 8.1.2-1ubuntu2.13 (cli) (built: Jun 28 2023 14:01:49) (NTS)\nCopyright (c) The PHP Group\nZend Engine v4.1.2, Copyright (c) Zend Technologies\n with Zend OPcache v8.1.2-1ubuntu2.13, Copyright (c), by Zend Technologies\n<\/pre>\n\n\n\n<\/span>Step 5. Create October CMS database and user<\/span><\/h2>\n\n\n\nNext, we need to create an October CMS database, the October CMS user, and grant the permissions for that user to the database.<\/p>\n\n\n\n
CREATE USER 'octobercms'@'localhost' IDENTIFIED BY 'YourStrongPasswordHere';\n CREATE DATABASE octobercms;\n GRANT ALL PRIVILEGES ON octobercms.* TO 'octobercms'@'localhost';\n FLUSH PRIVILEGES;\n EXIT;\n<\/pre>\n\n\n\n<\/span>Step 6. Download and install the October CMS<\/span><\/h2>\n\n\n\nBefore we install October CMS, we first need to download it in the default Nginx document root:<\/p>\n\n\n\n
cd \/var\/www\/html\n\nwget https:\/\/octobercms.com\/download -O october.zip\n\nunzip october.zip\n\nrm october.zip\n\nmv install-master\/ octobercms\/\n<\/pre>\n\n\n\nSet the right permissions to files and folders.<\/p>\n\n\n\n
chown -R www-data:www-data \/var\/www\/html\n\ncd \/var\/www\/html\n\nfind . -type d -exec chmod 755 {} \\;\n\nfind . -type f -exec chmod 644 {} \\;\n<\/pre>\n\n\n\n<\/span>Step 7. Create Nginx Configuration File<\/span><\/h2>\n\n\n\nGo into the Nginx directory and create a configuration file for the October CMS.<\/p>\n\n\n\n
cd \/etc\/nginx\/conf.d\n\ntouch octobercms.conf\n<\/pre>\n\n\n\nOpen the file, paste the following lines of code, save the file, and close it.<\/p>\n\n\n\n
server {\n listen 80;\n\n server_name YourDomainName;\n\n index index.php index.html;\n root \/var\/www\/html\/octobercms;\n\n location \/ {\n try_files $uri $uri\/ \/index.php?$query_string;\n }\n\n location ~ \\.php$ {\n include snippets\/fastcgi-php.conf;\n fastcgi_pass unix:\/var\/run\/php\/php8.1-fpm.sock;\n fastcgi_read_timeout 120s;\n }\n\n location ~ ^\/favicon\\.ico { try_files $uri \/index.php; }\n location ~ ^\/sitemap\\.xml { try_files $uri \/index.php; }\n location ~ ^\/robots\\.txt { try_files $uri \/index.php; }\n location ~ ^\/humans\\.txt { try_files $uri \/index.php; }\n location ~ ^\/storage\/app\/uploads\/public { try_files $uri 404; }\n location ~ ^\/storage\/app\/media { try_files $uri 404; }\n location ~ ^\/storage\/temp\/public { try_files $uri 404; }\n location ~ ^\/modules\/.*\/assets { try_files $uri 404; }\n location ~ ^\/modules\/.*\/resources { try_files $uri 404; }\n location ~ ^\/modules\/.*\/behaviors\/.*\/assets { try_files $uri 404; }\n location ~ ^\/modules\/.*\/behaviors\/.*\/resources { try_files $uri 404; }\n location ~ ^\/modules\/.*\/widgets\/.*\/assets { try_files $uri 404; }\n location ~ ^\/modules\/.*\/widgets\/.*\/resources { try_files $uri 404; }\n location ~ ^\/modules\/.*\/formwidgets\/.*\/assets { try_files $uri 404; }\n location ~ ^\/modules\/.*\/formwidgets\/.*\/resources { try_files $uri 404; }\n location ~ ^\/modules\/.*\/reportwidgets\/.*\/assets { try_files $uri 404; }\n location ~ ^\/modules\/.*\/reportwidgets\/.*\/resources { try_files $uri 404; }\n location ~ ^\/plugins\/.*\/.*\/assets { try_files $uri 404; }\n location ~ ^\/plugins\/.*\/.*\/resources { try_files $uri 404; }\n location ~ ^\/plugins\/.*\/.*\/behaviors\/.*\/assets { try_files $uri 404; }\n location ~ ^\/plugins\/.*\/.*\/behaviors\/.*\/resources { try_files $uri 404; }\n location ~ ^\/plugins\/.*\/.*\/reportwidgets\/.*\/assets { try_files $uri 404; }\n location ~ ^\/plugins\/.*\/.*\/reportwidgets\/.*\/resources { try_files $uri 404; }\n location ~ ^\/plugins\/.*\/.*\/formwidgets\/.*\/assets { try_files $uri 404; }\n location ~ ^\/plugins\/.*\/.*\/formwidgets\/.*\/resources { try_files $uri 404; }\n location ~ ^\/plugins\/.*\/.*\/widgets\/.*\/assets { try_files $uri 404; }\n location ~ ^\/plugins\/.*\/.*\/widgets\/.*\/resources { try_files $uri 404; }\n location ~ ^\/themes\/.*\/assets { try_files $uri 404; }\n location ~ ^\/themes\/.*\/resources { try_files $uri 404; }\n\n}\n<\/pre>\n\n\n\nCheck the syntax:<\/p>\n\n\n\n
nginx -t<\/pre>\n\n\n\nYou should receive the following output:<\/p>\n\n\n\n
root@host:\/etc\/nginx\/sites-enabled# nginx -t\nnginx: the configuration file \/etc\/nginx\/nginx.conf syntax is ok\nnginx: configuration file \/etc\/nginx\/nginx.conf test is successful\n<\/pre>\n\n\n\nIf the syntax is OK, restart the Nginx service.<\/p>\n\n\n\n
systemctl reload nginx\n<\/pre>\n\n\n\nOnce the Nginx service is restarted, you can finish the October CMS installation at http:\/\/yourdomain.com\/install.php<\/strong><\/p>\n\n\n\n