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.
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.
First, connect to your server via SSH. If you don’t know how to do this, check out our First Access (SSH) guide.
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.
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.
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.
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.
# Create rule for SSH
sudo ufw allow OpenSSH
# Enable UFW firewall
sudo ufw enable
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.
# Create rule for Apache
sudo ufw allow in "Apache Full"
# Show UFW firewall rules
sudo ufw status
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
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.
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.
# 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:
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.
The WordPress installation can be divided into three parts: first preparing the MySQL database, then installing WordPress, and finally configuring it via the WordPress setup wizard.
To start, you need to create a new MySQL database. This is important because you will need this data later in the WordPress setup wizard. We recommend using our examples.
Simply copy the following commands to create the database, tables, and user.
# Log into MySQL
sudo mysql -u root
# Create database
CREATE DATABASE wordpress;
# Create dedicated WordPress user
# Replace [your_password] with your own password
CREATE USER wordpress@localhost IDENTIFIED BY '[your_password]';
# Set permissions for the user (copy all as one command)
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER
ON wordpress.*
TO wordpress@localhost;
# Reload privilege tables
FLUSH PRIVILEGES;
After setup, exit MySQL with quit. Now you are ready for the WordPress installation.
For the WordPress installation, we recommend using the official version from wordpress.org instead of the APT package. This is recommended by WordPress to avoid potential issues.
Download the latest version to the temporary directory with the following command:
cd /tmp && wget https://wordpress.org/latest.tar.gz
Extract the archive, which creates a wordpress folder with all necessary files:
tar -xvf latest.tar.gz
Copy the folder to your Apache directory /var/www/html/ so everything is accessible via the web. Run the following commands to copy the folder, create an uploads directory, and set permissions so the www-data group has access:
# Copy WordPress folder and set ownership
cp -R wordpress /var/www/html/
chown -R www-data:www-data /var/www/html/wordpress/
# Create uploads directory
mkdir /var/www/html/wordpress/wp-content/uploads
# Adjust file permissions
chmod -R 755 /var/www/html/wordpress/
chown -R www-data:www-data /var/www/html/wordpress/wp-content/uploads/
WordPress is now installed. Open the setup wizard at: http://[your_ip_address]/wordpress
In the setup wizard, you can now configure WordPress – the final step of the installation. First, you will be asked to select the language.
Then you must enter the database settings. You prepared these during the MySQL setup, so use the same credentials here. If you followed our examples, fill in the fields accordingly and replace [your_password] with your password.
After this step, you will be prompted to start the installation – this is the last part of the setup.
On the next page, enter various details including the site title, an email address, and a username and password for the WordPress root account you will use to log into the panel later. You can also set whether search engines are allowed to index your site.
Choose a strong password and save your login details so you don’t lose access to your WordPress panel!
When ready, click the Install WordPress button to complete the process.
You will be redirected to a success page that leads you to the Login. There, log in with your credentials for the first time to access the WordPress panel!
And you’re in – your WordPress panel with a complete installation.
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! 🙂