Install aaPanel and a LNMP Stack on a Linux VPS

4 min
VPS/VDS Hosting

aaPanel is a free web control panel that installs and manages Nginx, MySQL/MariaDB, PHP, FTP and SSL certificates with a few clicks. On a VPS Linux Infrawire it gives you a ready-to-use LNMP web stack without hand-editing configuration files. This guide uses Ubuntu 24.04 or Debian 12.

📋 Prerequisites

  • A clean KVM VPS running Ubuntu 24.04 or Debian 12, with no web server or other panel installed.
  • Root SSH access and at least 1 GB of RAM (2 GB is more comfortable for MySQL and PHP). From your customer area you will find the VPS IP and the root password.
  • A domain whose A record points to VPS_IP if you want to host a real site.

🔄 1. Update the system

Connect as root and update the packages before installing anything.

Bash
ssh root@VPS_IP apt update && apt -y upgrade && apt -y install curl

⬇️ 2. Run the official installer

The installer script name contains a version number that changes over time. Always copy the current command from the official aaPanel website (https://www.aapanel.com) rather than from an old tutorial. At the time of writing it looks like this:

Bash
curl -ksSO https://www.aapanel.com/script/install_7.0_en.sh bash install_7.0_en.sh aapanel

The script asks whether it may install aaPanel in the /www directory: answer y. The installation takes several minutes. Read the script before running it if you want to be careful: it is a plain shell file.

At the end, the installer prints the panel URL, a user name and a password. Copy them immediately, because the password is random.

🔑 3. Retrieve the URL and credentials later

If you closed the terminal, the access details are available at any time with the bt command:

Bash
bt default

The URL looks like http://VPS_IP:PORT/SECURITY_PATH. The port is random and the path after it is the security entrance: both are required to see the login form. Running bt without arguments opens an interactive menu that also lets you reset the password, change the user name or change the port.

🧱 4. Install the LNMP stack

After the first login, aaPanel suggests a recommended software bundle. Choose LNMP (Linux, Nginx, MySQL, PHP) and the Fast installation method, then select the PHP version your application needs. You can also install phpMyAdmin from the same screen. Installation continues in the background and progress appears in the task list.

Once finished, go to Website > Add site, type example.com, create a database if needed and validate. Place your files in the site root shown in the panel, usually under /www/wwwroot/example.com. To get HTTPS, open the site settings, SSL, choose Let's Encrypt and request the certificate once the DNS record points to the VPS.

🔓 5. Open the required ports

Open ports 80 and 443 for the sites, 22 for SSH, and the random panel port. In the panel, use Security > Firewall to add a rule for each port. If you use UFW on Ubuntu, the equivalent is:

Bash
ufw allow 22/tcp ufw allow 80/tcp ufw allow 443/tcp ufw allow PANEL_PORT/tcp ufw enable

Allow SSH before enabling UFW, otherwise you lock yourself out. Replace PANEL_PORT with the port shown by bt default.

🛡️ 6. Harden the panel

  • In Settings, change the panel port to another high port and update your firewall rule.
  • Change the Security entrance to a custom path that is hard to guess.
  • Change the default user name and password, and enable two-factor authentication if available in your version.
  • Restrict access with Authorized IP if your IP address is stable.
  • Install updates regularly: use the update notice on the panel home page and keep the system current with apt update && apt -y upgrade.
  • Remove software you do not use from the App Store.

The panel restarts after a port change; if you lose access, use bt from SSH to read the new settings.

✅ 7. Verify

Bash
bt default ss -tlnp | grep -E ':(80|443)\b' /www/server/nginx/sbin/nginx -t

The panel URL must open in your browser, ports 80 and 443 should be listening once a site exists, and nginx -t should report that the syntax is OK.

🧰 Troubleshooting

  • The panel page does not load: the port or the firewall is blocking you, or you omitted the security path. Check bt default and the firewall rules, then restart with /etc/init.d/bt restart.
  • Forgotten password or user name: run bt and pick the option that changes the password or the user name.
  • The installer fails or stops: the system is probably not clean or lacks memory. Check free -h and df -h, then reinstall the OS on a clean VPS if another web server was present.
  • Let's Encrypt fails: the domain does not point to the VPS yet, or port 80 is closed. Fix DNS and the firewall and try again.

🎉 aaPanel and your LNMP stack are ready: create your sites, harden the panel and keep it updated.

Stay up to date with the latest offers, discounts and special promotions.

View promotions

We use cookies

We use analytics cookies to improve your experience on our site. No data is sold to third parties. Learn more in our privacy policy.