{"id":1171,"date":"2026-11-25T13:00:00","date_gmt":"2026-11-25T13:00:00","guid":{"rendered":"https:\/\/vpslake.com\/blog\/?p=1171"},"modified":"2026-11-25T13:00:00","modified_gmt":"2026-11-25T13:00:00","slug":"install-lamp-stack-almalinux-10","status":"publish","type":"post","link":"https:\/\/vpslake.com\/blog\/2026\/11\/25\/install-lamp-stack-almalinux-10\/","title":{"rendered":"How to Install LAMP Stack on AlmaLinux 10 (Step-by-Step)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Install LAMP stack on AlmaLinux 10 with Apache, PHP 8.3, PHP-FPM, and MariaDB in about ten minutes. You will finish with a running web server, a local database user, firewalld rules for web traffic, and a safe PHP request test.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">AlmaLinux 10 uses DNF, firewalld, and SELinux, so the commands below follow the Enterprise Linux 10 layout instead of Ubuntu conventions. The PHP packages come from the AlmaLinux repositories, which keeps the initial stack simple to update.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n\n<li>A fresh 64-bit AlmaLinux 10 VPS with at least 2 GB of RAM and 10 GB of free disk space.<\/li>\n\n\n<li>SSH access as <code>root<\/code>, or a normal account with working <code>sudo<\/code> privileges.<\/li>\n\n\n<li>Outbound internet access for DNF repositories and a public IPv4 address for browser testing.<\/li>\n\n\n<li>A domain is optional for this base installation. You need one before putting a production site behind a trusted TLS certificate.<\/li>\n\n\n<li>A <a href=\"https:\/\/vpslake.com\/buy-vps\">VPSLake Linux VPS<\/a> if you need an AlmaLinux server with root access.<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The commands use <code>sudo<\/code> for a non-root SSH account. If you are already logged in as <code>root<\/code>, remove <code>sudo<\/code> from each command.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Confirm AlmaLinux 10 and update packages<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Checking the release first prevents you from applying Enterprise Linux instructions to the wrong system.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>grep -E '^(PRETTY_NAME|VERSION_ID|ID_LIKE)=' \/etc\/os-release\nuname -m\nsudo dnf upgrade -y<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The first command should identify AlmaLinux 10 and the architecture should normally be <code>x86_64<\/code>. The exact minor version changes as updates are published.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>PRETTY_NAME=\"AlmaLinux 10.x (Purple Lion)\"\nVERSION_ID=\"10.x\"\nID_LIKE=\"rhel centos fedora\"\nx86_64<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If the upgrade installs a new kernel, keep the current SSH session open until you have confirmed that the VPS can reboot and reconnect.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Install Apache and allow web traffic<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Apache serves the static files and hands PHP requests to PHP-FPM later, while firewalld controls which public services can reach the VPS.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf install -y httpd policycoreutils-python-utils\nsudo systemctl enable --now httpd\nsudo firewall-cmd --permanent --zone=public --add-service=http\nsudo firewall-cmd --permanent --zone=public --add-service=https\nsudo firewall-cmd --reload\nsudo systemctl is-active httpd\nsudo firewall-cmd --zone=public --list-services<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The service check should print <code>active<\/code>, and firewalld should report <code>http<\/code> and <code>https<\/code> among the enabled services. HTTPS is opened now so a later TLS setup does not require another firewall change.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl -I http:\/\/SERVER_IP<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Replace <code>SERVER_IP<\/code> with the VPS public IP. A healthy Apache installation returns an HTTP response such as <code>200 OK<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Install PHP 8.3 and PHP-FPM<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">AlmaLinux 10\u2019s base application stream provides PHP 8.3; PHP-FPM runs PHP outside Apache\u2019s worker process and is the supported web-server arrangement for this release.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf install -y php php-fpm php-mysqlnd php-gd php-mbstring php-opcache php-xml\nsudo systemctl enable --now php-fpm httpd\nphp -v\nsudo systemctl is-active php-fpm httpd<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The version will include a current 8.3 patch number, and both services should be active. For the PHP-FPM model and its configuration files, see the <a href=\"https:\/\/www.php.net\/manual\/en\/install.fpm.php\" target=\"_blank\" rel=\"noopener\">official PHP-FPM documentation<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Create a short-lived PHP endpoint to test execution rather than exposing <code>phpinfo()<\/code>, which can disclose server configuration. The endpoint is removed immediately after the request.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>printf '%s\\n' '&lt;?php echo \"PHP OK\\\\n\"; ?&gt;' | sudo tee \/var\/www\/html\/health.php &gt; \/dev\/null\ncurl -fsS http:\/\/127.0.0.1\/health.php\nsudo rm -f \/var\/www\/html\/health.php<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The curl command should print <code>PHP OK<\/code>. If it prints PHP source code or returns a 503 response, stop and use the troubleshooting section before deploying an application.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Install and secure MariaDB<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">MariaDB supplies the relational database layer, and the local-only application account below avoids exposing database traffic on the public network.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf install -y mariadb-server mariadb\nsudo systemctl enable --now mariadb\nsudo systemctl is-active mariadb\nsudo mariadb-secure-installation<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The hardening script may use slightly different prompts as MariaDB changes. Keep Unix-socket authentication for the administrative account, remove anonymous users, disallow remote root login, remove the test database, and reload the privilege tables. MariaDB documents these choices in its <a href=\"https:\/\/mariadb.com\/docs\/server\/clients-and-utilities\/deployment-tools\/mariadb-secure-installation\" target=\"_blank\" rel=\"noopener\"><code>mariadb-secure-installation<\/code> reference<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Create an application database and a separate local user. Replace <code>YOUR_DB_PASSWORD<\/code> with a long, unique password before running this block; it is a placeholder, not a password to keep.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mariadb &lt;&lt;'SQL'\nCREATE DATABASE appdb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;\nCREATE USER 'appuser'@'localhost' IDENTIFIED BY 'YOUR_DB_PASSWORD';\nGRANT ALL PRIVILEGES ON appdb.* TO 'appuser'@'localhost';\nFLUSH PRIVILEGES;\nSQL\nsudo mariadb -e \"SHOW DATABASES LIKE 'appdb';\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The last command should return one row named <code>appdb<\/code>. Keep the database name, username, and real password for the application installer; do not open TCP port 3306 for this local connection.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Verify the LAMP stack<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Run the checks below from SSH. Together they confirm that all three daemons start, Apache accepts its configuration, PHP modules for MariaDB are loaded, and the web server answers locally.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl is-active httpd php-fpm mariadb\nsudo systemctl is-enabled httpd php-fpm mariadb\nsudo apachectl configtest\nphp -m | grep -E 'mysqli|mysqlnd|PDO|mbstring|xml'\nsudo mariadb -e \"SELECT VERSION();\"\ncurl -fsSI http:\/\/127.0.0.1\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Expected output includes three <code>active<\/code> lines, three <code>enabled<\/code> lines, <code>Syntax OK<\/code>, the listed PHP modules, a MariaDB version, and an HTTP success response.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>active\nactive\nactive\nenabled\nenabled\nenabled\nSyntax OK\nHTTP\/1.1 200 OK<\/code><\/pre>\n\n\n\n<aside class=\"vl-element vl-cta-banner\" aria-label=\"Launch your LAMP server\">\n\t<div class=\"vl-cta-banner__content\">\n\t\t<p class=\"vl-cta-banner__eyebrow\">AlmaLinux VPS<\/p>\n\t\t<h3 class=\"vl-cta-banner__title\">Launch your LAMP server<\/h3>\n\t\t<p class=\"vl-cta-banner__text\">Get root access for an Apache, PHP, and MariaDB stack on AlmaLinux.<\/p>\n\t<\/div>\n\t<a class=\"vl-cta-banner__button\" href=\"\/buy-vps\" aria-label=\"View Linux VPS plans\">View Linux VPS plans<\/a>\n<\/aside>\n\n\n\n<h2 class=\"wp-block-heading\">Troubleshooting<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><code>No match for argument: php-fpm<\/code> or <code>php-mysqlnd<\/code><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">DNF may have stale metadata, disabled repositories, or the machine may not actually be AlmaLinux 10. Confirm the release and refresh metadata before adding any third-party PHP repository.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>grep -E '^(PRETTY_NAME|VERSION_ID)=' \/etc\/os-release\nsudo dnf clean all\nsudo dnf makecache\nsudo dnf repolist --enabled<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If the release is not AlmaLinux 10, stop and use instructions for the installed release. Do not mix EL9 and EL10 repositories.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Apache returns <code>503 Service Unavailable<\/code> for PHP<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">PHP-FPM is stopped, failed to start, or Apache has a syntax error in a drop-in configuration. Check the service log and configuration, then restart only after correcting the reported problem.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl status php-fpm --no-pager\nsudo journalctl -u php-fpm -n 40 --no-pager\nsudo apachectl configtest\nsudo systemctl restart php-fpm httpd<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><code>403 Forbidden<\/code> after changing files under <code>\/var\/www\/html<\/code><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A custom file may have the wrong owner, mode, or SELinux label. Restore the default web-content labels and ensure Apache can read the files; do not disable SELinux.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo restorecon -Rv \/var\/www\/html\nsudo find \/var\/www\/html -type d -exec chmod 0755 {} +\nsudo find \/var\/www\/html -type f -exec chmod 0644 {} +\nsudo systemctl reload httpd<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><code>Access denied for user 'appuser'@'localhost'<\/code><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The application password does not match the value used in <code>CREATE USER<\/code>, or the account was created for a different host. Test the credentials through the local socket and recreate the account only if you have confirmed the intended password.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mariadb -u appuser -p appdb -e \"SELECT 1;\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Enter the real value that replaced <code>YOUR_DB_PASSWORD<\/code>. A result containing <code>1<\/code> confirms that the account can reach its database without making MariaDB publicly accessible.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Hardening<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n\n<li>Keep port 3306 closed in firewalld. Applications on this VPS can use the local MariaDB socket or <code>localhost<\/code> without a public database listener.<\/li>\n\n\n<li>Remove temporary health-check files after testing, and never leave <code>phpinfo()<\/code> or database passwords in the web root.<\/li>\n\n\n<li>For a real domain, point DNS to the VPS, obtain a trusted TLS certificate, and redirect HTTP to HTTPS before accepting logins or other sensitive data.<\/li>\n\n\n<li>Apply regular AlmaLinux updates and back up both <code>\/var\/www\/html<\/code> and the MariaDB databases before changing PHP or Apache configuration.<\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">FAQ<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">What is included in a LAMP stack on AlmaLinux 10?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">LAMP means Linux, Apache, MariaDB, and PHP. In this guide, Apache is the <code>httpd<\/code> service, PHP runs through PHP-FPM, and MariaDB provides the SQL database service.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Do I need PHP 8.4 or PHP 8.5 for this installation?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">No. The AlmaLinux 10 base repositories provide PHP 8.3 for a stable starting point. If an application specifically requires another supported PHP stream, check that application\u2019s compatibility requirements and use a repository designed for AlmaLinux 10 rather than mixing package sources.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Should I open port 3306 for my website?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">No. A website running on the same VPS can connect to MariaDB through <code>localhost<\/code> or the Unix socket. Leave 3306 closed unless a separate host truly needs database access, and then restrict the source address and use encrypted database connections.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Can I install MySQL instead of MariaDB?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Yes, but the server package, service behavior, authentication defaults, and security commands differ. Use one database server for this stack and follow that product\u2019s AlmaLinux 10 documentation instead of installing both database implementations together.<\/p>\n\n\n\n<script type=\"application\/ld+json\">{\"@context\": \"https:\/\/schema.org\", \"@type\": \"FAQPage\", \"mainEntity\": [{\"@type\": \"Question\", \"name\": \"What is included in a LAMP stack on AlmaLinux 10?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"LAMP means Linux, Apache, MariaDB, and PHP. In this guide, Apache is the `httpd` service, PHP runs through PHP-FPM, and MariaDB provides the SQL database service.\"}}, {\"@type\": \"Question\", \"name\": \"Do I need PHP 8.4 or PHP 8.5 for this installation?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"No. The AlmaLinux 10 base repositories provide PHP 8.3 for a stable starting point. If an application specifically requires another supported PHP stream, check that application\u2019s compatibility requirements and use a repository designed for AlmaLinux 10 rather than mixing package sources.\"}}, {\"@type\": \"Question\", \"name\": \"Should I open port 3306 for my website?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"No. A website running on the same VPS can connect to MariaDB through `localhost` or the Unix socket. Leave 3306 closed unless a separate host truly needs database access, and then restrict the source address and use encrypted database connections.\"}}, {\"@type\": \"Question\", \"name\": \"Can I install MySQL instead of MariaDB?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Yes, but the server package, service behavior, authentication defaults, and security commands differ. Use one database server for this stack and follow that product\u2019s AlmaLinux 10 documentation instead of installing both database implementations together.\"}}]}<\/script>\n\n","protected":false},"excerpt":{"rendered":"Install LAMP stack on AlmaLinux 10 with Apache, PHP 8.3, MariaDB, firewalld, and a safe PHP test, then verify all services in about 10 minutes.","protected":false},"author":1,"featured_media":1172,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"csco_singular_sidebar":"","csco_page_header_type":"","csco_page_load_nextpost":"","footnotes":""},"categories":[5,9],"tags":[91,71,117,73,72],"class_list":["post-1171","post","type-post","status-publish","format-standard","has-post-thumbnail","category-guides","category-vps-hosting","tag-almalinux-10","tag-apache","tag-lamp-stack","tag-mariadb","tag-php","cs-entry"],"_links":{"self":[{"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/posts\/1171","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/comments?post=1171"}],"version-history":[{"count":1,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/posts\/1171\/revisions"}],"predecessor-version":[{"id":4185,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/posts\/1171\/revisions\/4185"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/media\/1172"}],"wp:attachment":[{"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/media?parent=1171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/categories?post=1171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/tags?post=1171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}