How to Install WordPress Manually on a Linux Server: A Complete Technical Guide

How to Install WordPress Manually on a Linux Server: A Complete Technical Guide

Overview

Installing WordPress manually grants you absolute control over your website's foundation, making it the preferred method for developers, system administrators, and anyone prioritizing security and performance. This guide provides a detailed, step-by-step walkthrough for a manual installation on a Linux server with a standard LAMP (Linux, Apache, MySQL, PHP) stack. You will learn to prepare a secure database, correctly place and configure WordPress files, run the web installer, and apply essential post-installation hardening measures. This method is foundational knowledge for managing custom server environments.

Why Choose Manual Installation Over Automated Options?

Manual installation is ideal when you require granular control over the server environment, are working on a custom configuration, or want to avoid the potential overhead and opacity of automated scripts. It ensures a clean installation with minimal software footprint and provides deep insight into how WordPress interacts with its underlying components.

Installation Method Control & Transparency Speed & Convenience Best For
Manual Installation High: You configure every component. Slower: Requires CLI interaction and manual steps. Developers, sysadmins, learning environments, custom setups.
One-Click / Marketplace Low: Pre-configured and abstracted. Very Fast: Automated process. Beginners, rapid deployment, shared hosting.

Prerequisites and Server Preparation

Before you begin, ensure your server meets the following technical requirements. A clean, fresh installation of a supported operating system is recommended. If you are starting from scratch, you will need to install a LAMP stack.

  • Operating System: A supported Linux distribution (e.g., Ubuntu 20.04+, Debian 11+, CentOS 7+). If you need to reinstall your OS first, providers often offer this via their control panel.
  • Web Server: Apache installed and running with the mod_rewrite module enabled.
  • Database: MySQL 5.7+ or MariaDB 10.3+ installed and running.
  • PHP: Version 7.4 or higher, with required extensions (php-mysql, php-gd, php-mbstring, php-curl, php-zip).
  • Network: A static public IP address and a registered domain name with DNS records pointing to your server's IP.
  • Access: SSH terminal access to your server.
  • Database Credentials: A prepared database name, username, and strong password (you will create these in Step 1).

Step 1: Create a Dedicated MySQL Database and User

WordPress stores all its content in a database. For security, you should create a dedicated database and a restricted user for WordPress to use, isolating it from other applications.

Log into your MySQL or MariaDB server as the root user:

mysql -u root -p

Enter your root password when prompted. Then, execute the following SQL commands. Replace the placeholder values with your own desired names and a strong, unique password.

CREATE DATABASE wordpress_db;
CREATE USER 'wp_user'@'localhost' IDENTIFIED BY 'YourStrongPassword123!';
GRANT ALL PRIVILEGES ON wordpress_db.* TO 'wp_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Record these credentials securely. You will need them in Step 4.

Credential Your Value (Example)
Database Name wordpress_db
Database User wp_user
Database Password YourStrongPassword123!
Database Host localhost

Step 2: Download and Place WordPress Files

With the database ready, download the latest WordPress core files and place them in your web server's public document root.

Navigate to your Apache document root (typically /var/www/html):

cd /var/www/html

Download the latest WordPress tarball from the official repository:

sudo wget

Extract the archive:

sudo tar -xzvf latest.tar.gz

This creates a wordpress folder. You can safely remove the downloaded archive:

sudo rm latest.tar.gz

Step 3: Configure File Permissions and Ownership

The web server needs specific permissions to read, write, and execute certain files. For Apache on Debian/Ubuntu systems, the web server user is typically www-data.

Set the correct ownership for all WordPress files and directories:

sudo chown -R www-data:www-data /var/www/html/wordpress

Apply secure directory and file permissions. Directories should be 755 (owner can read/write/execute, others can read/execute), and files should be 644 (owner can read/write, others can read).

sudo find /var/www/html/wordpress -type d -exec chmod 755 {} \;
sudo find /var/www/html/wordpress -type f -exec chmod 644 {} \;

Step 4: Create and Edit the wp-config.php File

This is the most critical configuration step. The wp-config.php file connects WordPress to your database.

First, create the file by copying the sample configuration:

cd /var/www/html/wordpress
sudo cp wp-config-sample.php wp-config.php

Edit this new file with a text editor like nano:

sudo nano wp-config.php

Locate the database settings section and replace the placeholder values with the credentials you created in Step 1.

// ** Database settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpress_db' );

/** Database username */
define( 'DB_USER', 'wp_user' );

/** Database password */
define( 'DB_PASSWORD', 'YourStrongPassword123!' );

/** Database hostname */
define( 'DB_HOST', 'localhost' );

Pro Tip: For enhanced security, generate unique AUTH_KEY, SECURE_AUTH_KEY, and other keys from the WordPress Salt API and paste them into the corresponding section in this file.

Save the file and exit the editor. In nano, press Ctrl+X, then Y, then Enter.

Step 5: Run the WordPress Web Installer

With server-side setup complete, finish the installation via your web browser.

  1. Navigate to your domain or IP address followed by /wordpress. Example: or .
  2. Language Selection: Choose your preferred language and click Continue.
  3. Site Information: Enter your desired Site Title, Username (avoid "admin" for security), Password (use a strong one), and Email Address.
  4. Search Engine Visibility: Decide whether to discourage search engines from indexing the site during construction. Leave this unchecked for a live site you want to be found.
  5. Install WordPress: Click the button to complete the installation.

Upon success, you will see a confirmation screen. Click Log In to access your new WordPress dashboard.

Step 6: Essential Post-Installation Security and Configuration

Your site is now live, but these final steps are crucial for a secure and functional setup.

  • Update Permalinks: Go to Settings > Permalinks in your dashboard and select a search-engine-friendly structure like "Post name." This requires mod_rewrite to be active in Apache.
  • Enable HTTPS: Secure your site with an SSL certificate. You can use a free certificate from Let's Encrypt. After installation, force all traffic to HTTPS via a plugin or by editing your .htaccess file.
  • Delete Unused Content: Remove any default posts, pages, and themes you will not use to minimize the attack surface.
  • Set Up Regular Backups: Implement a reliable backup solution from day one. This is non-negotiable for any live site.

Pre-Launch Verification Checklist

Run through this final verification before promoting your site:

  • Database Connection: WordPress can access the database with the credentials in wp-config.php (no "Error establishing database connection").
  • File Permissions: The web server user (www-data) owns all files in the /wordpress directory.
  • Clean Installation: No leftover readme.html or license files in the web root if not desired.
  • Permalinks: All pages and posts load without 404 errors after configuring permalinks.
  • SSL/HTTPS: Site loads securely over HTTPS, and mixed content warnings are resolved.
  • Admin Account: Created with a unique username and a strong password.

Common Installation Errors and Fixes

  • "Error establishing a database connection": This is almost always a credential mismatch. Double-check the DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST values in wp-config.php against the database you created.
  • 500 Internal Server Error: Often a .htaccess issue or a PHP memory limit. Check server error logs (/var/log/apache2/error.log). A common fix is adding php_value memory_limit 256M to your .htaccess file.
  • White Screen after Install: Usually indicates a PHP error or a theme/plugin conflict. Access your server via SSH and check the PHP error log, or temporarily rename the wp-content/plugins and wp-content/themes folders to diagnose.

FAQ

What are the advantages of installing WordPress manually over using a one-click installer?

Manual installation provides full transparency and control over every component of the server stack. It results in a cleaner installation without potential bloat from automated scripts, allows for custom configurations from the start, and helps you develop valuable server administration skills.

Do I need to use Apache, or can I install WordPress on Nginx?

Yes, you can absolutely install WordPress on Nginx. The process for preparing the database and WordPress files is identical. The main difference lies in server configuration: you must configure Nginx to process PHP files (typically via PHP-FPM) and set up rewrite rules for permalinks in the Nginx site configuration file instead of an .htaccess file.

How do I handle the "PHP version not supported" error?

This error means your server's PHP version is below WordPress's minimum requirement (currently PHP 7.4). You must upgrade PHP on your server using your distribution's package manager (e.g., apt install php8.1 on Ubuntu) and ensure the required PHP extensions are installed.

Can I install WordPress on a Windows Server using IIS?

While possible, it is not the recommended or standard environment. WordPress runs best on a Linux/Apache or Linux/Nginx stack. The manual process on IIS requires different configuration for URL rewriting and PHP handling, adding unnecessary complexity. A Linux-based hosting environment is strongly advised.

What should I do if I forget my WordPress admin password?

You cannot recover the old password, but you can reset it. The most secure method is to use the "Lost your password?" link on the WordPress login page. If that isn't feasible, you can reset it directly in the database via phpMyAdmin or command-line MySQL by generating a new MD5 hash and updating the wp_users table.

Conclusion

Manually installing WordPress on a Linux server is a fundamental skill that provides ultimate control, a lightweight footprint, and deep understanding of your web environment. By following this step-by-step guide—from database creation and secure file configuration to post-install hardening—you establish a robust and secure foundation for any website. This knowledge empowers you to troubleshoot issues confidently and tailor your server setup for optimal performance.

For those seeking the power of a custom server without the management overhead, a managed VPS or a provider with one-click deployment options can offer a streamlined alternative while still giving you more control than basic shared hosting. Explore suitable hosting plans that provide the flexibility and support for your next WordPress project.

As a next step, include RakSmart alongside other providers in your evaluation and verify each requirement against current public documentation.