Install Latest WordPress with LEMP Stack on Debian 12

This article will demonstrate how to Install Latest WordPress LEMP Stack on Debian 12. Free and open-source content management software called WordPress, which is based on PHP, is frequently used to build public websites and private blogs. WordPress gives you the ability to create a website that is tailored to your specific needs. WordPress may be used to create any kind of website, including blogs, business websites, portfolios, online shops, and more.

Features of WordPress

  • Flexibility: A personal blog or website, a photoblog, a commercial website, a professional portfolio, a government website, etc. may all be made with WordPress.
  • Simplicity: You can rapidly get online and start publishing thanks to simplicity. Nothing should stand in the way of launching your website and disseminating your content.
  • Publishing Tools: You can easily manage your content with WordPress. Make drafts, set a publishing date, then review your post-revisions. Make your content public or private, and password-protect posts and pages.
  • Freedom: WordPress is covered by the GPL, which was developed to safeguard your liberties. WordPress may be installed, used, modified, and distributed in any way you desire. The cornerstone upon which WordPress is based is software freedom.
  • Easy Theme System: Three default themes are included with WordPress, but if you don’t like them, you may choose from thousands of other themes in the theme directory to build a stunning website.
  • Extend with Plugins: Every user can benefit from the many features that come with WordPress. There are thousands of plugins in the plugin directory for any feature that isn’t in the core of WordPress. Include intricate galleries, forums, social media widgets, social networking, spam protection, and many more.
  • Search Engine Optimized: WordPress comes pre-configured with search engine optimization. There are several SEO plugins available to handle that for you if you want more granular SEO control.
  • Easy Installation and Upgrades: It has always been simple to install and update WordPress. Many web providers provide one-click WordPress installations, allowing you to set up WordPress with only one simple click.

Install Latest WordPress with LEMP Stack on Debian 12

The following steps will guide you on how to install WordPress with LEMP stack on Debian 12 successfully.

System Update

Run the following command to update and upgrade Debian 12 system before beginning your installation;

sudo apt update && sudo apt upgrade -y

Reboot Debian 12 system after system upgrade;

sudo reboot now

Install LEMP on Debian 12

Following our guide below, you will be able to install LEMP on Debian 12;

Install LEMP stack on Debian 12

After installing LEMP successfully on Debian 12, create a database and user for WordPress as follows;

mysql> CREATE DATABASE wpdb;

mysql> CREATE USER 'wp-admin'@'localhost' IDENTIFIED BY '@ChangeME';

mysql> GRANT ALL ON wpdb.* TO 'wp-admin'@'localhost';

mysql> FLUSH PRIVILEGES;

mysql> exit

Download and Install  Latest WordPress 6.x on Debian 12

Navigate to the WordPress Downloads’ page to obtain the installer;

wget https://wordpress.org/wordpress-6.3.1.tar.gz

Set up the web root directory in which you’ll install WordPress. In that case, change the names accordingly;

sudo mkdir -p /var/www/html/wp.itnixpro-demo.com

Configure the correct permissions for the directory;

sudo chown -R www-data:www-data /var/www/html/wp.itnixpro-demo.com/
sudo chmod -R 755 /var/www/html/wp.itnixpro-demo.com/

After that, extract the WordPress archive’s contents to the Web root directory you just created;

tar xzf wordpress-6.3.1.tar.gz -C /var/www/html/wp.itnixpro-demo.com --strip-components=1

Confirm that the WordPress files are in place;

ls /var/www/html/wp.itnixpro-demo.com

Output;

index.php	 wp-blog-header.php    wp-includes	  wp-settings.phplicense.txt	 wp-comments-post.php  wp-links-opml.php  wp-signup.phpreadme.html	 wp-config-sample.php  wp-load.php	  wp-trackback.phpwp-activate.php  wp-content	       wp-login.php	  xmlrpc.phpwp-admin	 wp-cron.php	       wp-mail.php

Then configure WordPress Database connection;

cd  /var/www/html/wp.itnixpro-demo.com
sudo cp wp-config-sample.php wp-config.php

Modify  wp-config.php as follows;

sudo vim wp-config.php

Output;

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

/** MySQL database username */
define( 'DB_USER', 'wp-admin' );

/** MySQL database password */
define( 'DB_PASSWORD', '@ChangeME' );

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

/** Database Charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );
...

Create unique keys and salts for authentication next. The keys and salts can be easily generated using the WordPress Secret-Key service as shown below;

curl -s https://api.wordpress.org/secret-key/1.1/salt/

Output;

define('AUTH_KEY',         '8DfE:fsf$^+#%^x#<mQ-)erSha.lXoMf;oXneG+!Or^e,e-x!K14oORLKq-V)E9R');
define('SECURE_AUTH_KEY',  'rp+|ZP[%X,3sZg1f6xZ0x#zLTE0 4g<U5YK#@NUkmoH|_pWl C)xNoI.rRe)D$o5');
define('LOGGED_IN_KEY',    'ZSvQ-p(`r~w4_&T4{W8:c+8-v*<p(4g6a!H X&s^vv[;Q$m-2MN?f:8q<7YQg|2(');
define('NONCE_KEY',        '2`6N*J:R[p-Hd0hmC-J$N>/$icN(j-T[}$q1/8<xgnqqOrI6cH2H.(Y-+#WltR7u');
define('AUTH_SALT',        'qbBG1ZkfyE c<~p}+_5Z`NpS-.j4|Iz|wRjp_UM6Us<4(08(_?0%cx ^[>Y!pR@7');
define('SECURE_AUTH_SALT', 'G8#KZGYMj|7X+Aqujjl^Oy` ;&GdZ4?CVlKjBzC<)Wq.} <r6Z#@*RG<+65Gf-`3');
define('LOGGED_IN_SALT',   'm!|dzBjGC[od)N:y}W+wB5jEO%ooT$pIQpmp~-8/Bc>~6`-OTK5gJ~q8&t{SN.mN');
define('NONCE_SALT',       '?=m%dJy5SK[tRwJzh E}8)O?xe},R7R!~ko -G7%Y/J#ov<pF&Q){rU4p+2-D$@y');

Note: Don’t use the keys mentioned above. Create yours.

Replace the following lines in wp-config.php with the ones from above;

 .....
* @since 2.6.0
 */
define( 'AUTH_KEY',         'put your unique phrase here' );
define( 'SECURE_AUTH_KEY',  'put your unique phrase here' );
define( 'LOGGED_IN_KEY',    'put your unique phrase here' );
define( 'NONCE_KEY',        'put your unique phrase here' );
define( 'AUTH_SALT',        'put your unique phrase here' );
define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
define( 'LOGGED_IN_SALT',   'put your unique phrase here' );
define( 'NONCE_SALT',       'put your unique phrase here' );

/**#@-*/

/**
.....

Your setup should be as follows;

.....
* @since 2.6.0
*/
 /**
define( 'AUTH_KEY',         'put your unique phrase here' );
define( 'SECURE_AUTH_KEY',  'put your unique phrase here' );
define( 'LOGGED_IN_KEY',    'put your unique phrase here' );
define( 'NONCE_KEY',        'put your unique phrase here' );
define( 'AUTH_SALT',        'put your unique phrase here' );
define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
define( 'LOGGED_IN_SALT',   'put your unique phrase here' );
define( 'NONCE_SALT',       'put your unique phrase here' );
 */
define('AUTH_KEY',         '8DfE:fsf$^+#%^x#<mQ-)erSha.lXoMf;oXneG+!Or^e,e-x!>
define('SECURE_AUTH_KEY',  'rp+|ZP[%X,3sZg1f6xZ0x#zLTE0 4g<U5YK#@NUkmoH|_pWl >
define('LOGGED_IN_KEY',    'ZSvQ-p(`r~w4_&T4{W8:c+8-v*<p(4g6a!H X&s^vv[;Q$m-2>
define('NONCE_KEY',        '2`6N*J:R[p-Hd0hmC-J$N>/$icN(j-T[}$q1/8<xgnqqOrI6c>
define('AUTH_SALT',        'qbBG1ZkfyE c<~p}+_5Z`NpS-.j4|Iz|wRjp_UM6Us<4(08(_>
define('SECURE_AUTH_SALT', 'G8#KZGYMj|7X+Aqujjl^Oy` ;&GdZ4?CVlKjBzC<)Wq.} <r6>
define('LOGGED_IN_SALT',   'm!|dzBjGC[od)N:y}W+wB5jEO%ooT$pIQpmp~-8/Bc>~6`-OT>
define('NONCE_SALT',       '?=m%dJy5SK[tRwJzh E}8)O?xe},R7R!~ko -G7%Y/J#ov<pF>
/**#@-*/
.....

Configure Nginx Web Server on Debian 12

Create an Nginx virtual host configuration for your WordPress site;

sudo vim /etc/nginx/conf.d/wordpress.conf

Add the following content to the file above;

server {
    listen 80;
    listen [::]:80;
    server_name  wp.example.com www.example.com;
    root /var/www/html/wp.itnixpro-demo.com;
    index  index.php index.html index.htm;
    access_log /var/log/nginx/wpress_access.log;
    error_log /var/log/nginx/wpress_error.log;

    client_max_body_size 100M;
    autoindex off;
    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
         include snippets/fastcgi-php.conf;
         fastcgi_pass unix:/var/run/php/php-fpm.sock;
         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
         include fastcgi_params;
    }
}

Verify the configuration syntax above;

sudo nginx -t

Output;

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Now restart Nginx Web server;

sudo systemctl restart nginx

If UFW is running, open port 80/tcp to allow external access;

sudo ufw allow 80/tcp

Complete Latest WordPress Setup on Debian 12

To complete setting up WordPress on Debian 12, navigate to the browser and access your WordPress site, http://<server-IP-Or-hostname>;

Choose your preferred installation Language;

Install Latest WordPress with LEMP Stack on Debian 12

Enter your WordPress Site Title, Admin username, Password and Email Address;

Install Latest WordPress with LEMP Stack on Debian 12

After successful installation of WordPress, login;

Install Latest WordPress with LEMP Stack on Debian 12

Use the username and password you just established to log into WordPress after the installation is complete. There you have it. Here is WordPress dashboard;

Install Latest WordPress with LEMP Stack on Debian 12

The End!

We have come to a conclusion of our guide on how Install Latest WordPress with LEMP Stack on Debian 12. We hope this guide is helpful. Enjoy the available guides on our platform.

Install WordPress with LEMP Stack on Ubuntu 22.04

Install WordPress with Apache on OpenSUSE

Install WordPress with LAMP Stack on Ubuntu 22.04

Install Apache Benchmark tool in Linux

Leave a Comment