Skip to content

Set Up WordPress on a Linux Server – Start Your Own Website or Blog

Discover how to install WordPress on a Linux server with the LAMP stack to efficiently create and manage your website → Learn more now

12 November 20266 min read36 Views0 helpful

Introduction

WordPress is a popular web content management system used to manage and publish websites. Today, WordPress has expanded into many other areas such as mailing, forums, shops, and much more. This is supported by an active community that has built a strong plugin ecosystem and templates, making it easy for end users to set up almost anything. In this guide, we show you how to install the WordPress CMS on a Linux server.

Installing WordPress with One-Click Apps

You can install WordPress directly via One-Click Apps in the dashboard of your dedicated server. After the initial setup of the apps, open the app catalog, search for WordPress, and start the installation with your preferred project, environment, and domain settings. This allows you to deploy and manage WordPress quickly and user-friendly without manually working via the command line – while still benefiting from integrated web management, support for custom domains, and SSL certificates where available.

Preparation

First, connect to your server via SSH. If you don’t know how to do this, check out our First Access (SSH) guide.

Info

In this guide, we use the Ubuntu distribution combined with Apache as the web server, MySQL as the database, and PHP as the core dependency. This is called the LAMP stack: Linux, Apache, MySQL, and PHP.

Once logged in, start with the update command.

Code
sudo apt update

Then you can install all necessary dependencies. Simply copy the entire command below and paste it to install everything at once. Be patient, this may take a while.

Code
sudo apt install apache2 \
                 ghostscript \
                 libapache2-mod-php \
                 mysql-server \
                 php \
                 php-bcmath \
                 php-curl \
                 php-imagick \
                 php-intl \
                 php-json \
                 php-mbstring \
                 php-mysql \
                 php-xml \
                 php-zip

After the dependencies are installed, there are a few recommended steps to ensure all core components of the LAMP stack are working.

Apache & Firewall

First, you need to configure the firewall so that the Apache web server can communicate with the internet and function properly. It’s important to create the appropriate firewall rules so the web server is accessible from outside.

In this example, we use the UFW firewall because Apache has a registered application profile for it. If you use a different firewall, make sure port 80 (HTTP) is open. Learn more about firewalls on Linux in our Manage Firewall guide.

Make sure the UFW firewall is enabled and that a rule for SSH exists.

Code
# Create rule for SSH
sudo ufw allow OpenSSH

# Enable UFW firewall
sudo ufw enable
Warning

Make sure you have set up an SSH rule if you use UFW! Without this, you won’t be able to log in via SSH after losing connection!

Now create the rule for Apache and then check if the rules are present.

Code
# Create rule for Apache
sudo ufw allow in "Apache Full"

# Show UFW firewall rules
sudo ufw status
Tip

Use the command ufw app list to see which profiles are available. In the example above, Apache Full opens both HTTP (port 80) and HTTPS (port 443).

You should see Apache and Apache (v6) with the action ALLOW, confirming the firewall is ready. You will also see other rules you set up earlier, including the SSH rule.

After opening the firewall for Apache, make sure Apache is running. To do this, open your server’s IP address in a browser: http://[your_ip_address]

If everything is working, you will see a default welcome page. If not, check the service status with: systemctl status apache2

MySQL Setup

Next, perform the initial setup of MySQL. It is recommended to run the security script to secure your MySQL server. This is optional but highly recommended. Start it with: sudo mysql_secure_installation

The script will guide you interactively through the setup. First, you will be asked about password validation. We recommend choosing Y to allow only secure passwords in the future, then either MEDIUM with 1 or STRONG with 2.

Then you will be asked whether to remove the anonymous user and disable remote root login. For security reasons, confirm both with Y. This removes the test user and restricts root user access to local SSH only, minimizing risk.

Finally, you will be asked whether to remove the test database and reload privilege tables. We also recommend Y here, as the test database is not needed and privilege tables must be reloaded for changes.

Now check if the MySQL database is running by logging in with the following command: sudo mysql -u root. If successful, a welcome message appears. Use quit to exit the session.

Testing PHP

Finally, ensure PHP is working as expected. Create an info.php file in the Apache directory /var/www/html/ with the following content that runs the phpinfo() function.

Code
# Open nano editor for the new file
nano /var/www/html/info.php

# Insert the following content
<?php
phpinfo();
?>

Save the file with CTRL+X, then Y and Enter.

Now open the following URL in your browser, which should display a PHP info page if everything works:

Code
http://[your_ip_address]/info.php

Once the core components of the LAMP stack are tested and functional, you can start the actual WordPress installation.

Conclusion

Congratulations, you have successfully installed and configured WordPress! As a next step, we strongly recommend setting up a domain and an SSL certificate so your data is transmitted securely and access to the WordPress panel is easier. Check out our Certbot Guide focusing on the Apache plugin and follow the interactive setup to quickly and easily get a certificate for your desired domain.

For further information and setup tips, we recommend our WordPress Plugins and WordPress Elementor guides, which show you how to install plugins and use the popular, user-friendly page builder Elementor.

If you have questions or problems, our support team is available daily – don’t hesitate to contact us! 🙂

FAQ

Frequently asked questions

You can install WordPress directly via One-Click Apps in the dashboard of your dedicated server by searching for WordPress in the app catalog and starting the installation with your preferred project, environment, and domain settings.
The guide uses the LAMP stack: Linux, Apache as the web server, MySQL as the database, and PHP as the core dependency, demonstrated on Ubuntu.
Connect to your server via SSH and first run the command sudo apt update before installing the necessary dependencies.

Feedback

Was this article helpful?

Your feedback helps us prioritize and improve content.

0 of 0 Users found this article helpful.

Personal support

Need more help than the guide provides?

Our ZAP support team knows your product — briefly describe your issue and we'll help you personally.

Zappy knows this guide and answers you right in the chat.