This document is free text: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
This document is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see
Based on Brian Boucheron's Tutorial
My server: www.386387.xyz Debian 12 (or 11) and Ubuntu 24.04 Server (or 22.04)
Wordpress Mariadb Database Name: wordpress
Wordpress Mariadb Database User: wordpressuser
Password of wordpressuser: pAsswOrd1234
Wordpress website location: /var/www/wordpress
LAMP stack must be installed; see LampOnDebianUbuntu Tutorial
sudo mkdir /var/www/wordpress
sudo nano /etc/apache2/sites-available/386387.xyz.conf
Fill as below:
<VirtualHost *:80>
ServerAdmin postmaster@386387.xyz
ServerName www.386387.xyz
ServerAlias 386387.xyz
DocumentRoot /var/www/wordpress
ErrorLog ${APACHE_LOG_DIR}/386387.xyz-error.log
CustomLog ${APACHE_LOG_DIR}/386387.xyz-access.log combined
</VirtualHost>
sudo a2ensite 386387.xyz.conf
sudo systemctl reload apache2
sudo mariadb
Create a database named as wordpress, create a user named as wordpressuser and give the user necessarry permissions for the database.
Run on Mariadb Shell:
CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'pAsswOrd1234';
GRANT ALL ON wordpress.* TO 'wordpressuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
sudo apt update
sudo apt install php-curl php-gd php-mbstring php-xml php-xmlrpc \
php-soap php-intl php-zip
Restart apache
sudo systemctl restart apache2
Edit our site config, adding folders to override
sudo nano /etc/apache2/sites-available/386387.xyz.conf
Add following lines to just after DocumentRoot line
<Directory /var/www/wordpress/>
AllowOverride All
</Directory>
sudo a2enmod rewrite
sudo apache2ctl configtest
sudo systemctl restart apache2
Wordpress can be installed by Debian packages, but we prefer to download the latest version from the original source
For Debian, you may need to install curl
sudo apt install --yes curl
cd /tmp
curl -O https://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz
Create a dummy .htaccess file
touch /tmp/wordpress/.htaccess
Copy sample config file to real config file
cp /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php
sudo cp -a /tmp/wordpress/. /var/www/wordpress
Owned by www-data:www-data
sudo chown -R www-data:www-data /var/www/wordpress
All files 640, all dirs 750
sudo find /var/www/wordpress/ -type d -exec chmod 750 {} \;
sudo find /var/www/wordpress/ -type f -exec chmod 640 {} \;
WP requires some secure phrases for security, we will create them now
curl -s https://api.wordpress.org/secret-key/1.1/salt/
The output of this program will be something like following:
Temporarily copy them into a text file, we'll use it later
define('AUTH_KEY', 'O`tLoX^0[pT24ty<YOByEP#}wBtd|7M!9^-az.W_v{`;+!*PX_9/A#^#}SL@I_wD');
define('SECURE_AUTH_KEY', '-U]7Eu_Bbh!tA/5lk3.eDRzGrY<%i,:cn*yBOiE^*zZHK&RTbHmv]^+[[1v49=bq');
define('LOGGED_IN_KEY', 'VHYd-]>SDIsT_^-;>_0DBV:2}>u^wI;]T>IqXr}++h1sRjQM%U^I0ijVwAi? (yB');
define('NONCE_KEY', 'lui4^EuI3U-m8m!IUI%>;+)r[dJW`w2pl@g4JU==(,ipCi|EC)+vo,&2rAR Dm+-');
define('AUTH_SALT', 'W,>S!kG,KCPZ/`Y7;(hpL,1-M2lanZz(3)kdds-{;t9D(X&Qy:+0^H&3jE%WS:L4');
define('SECURE_AUTH_SALT', 'f*q%x{M6#GQ|L{U|!UoI~`8(71};e}Xm;4#e^J/b&DC<DO=Xv6$caAC<2q4gs}^0');
define('LOGGED_IN_SALT', '=HN;=E:zl1-X:5w:MTw3LHV^?VP})Z}&T*P!zvAG|R=S>6;~Xz|rh@S#MrSH2FA)');
define('NONCE_SALT', '`d)>*Ae)9g<Aaa1eQ*9HlqY-|__kE5,Nte2UAMJO3ro=9T#y=,|-/^D(&+XQ:,la');
sudo nano /var/www/wordpress/wp-config.php
Browse to the section with the following lines, replace them with the text you copied. (Around line 50)
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' );
While in the same file, browse up to the section with the following lines:
/** The name of the database for WordPress */
define( 'DB_NAME', 'database_name_here' );
/** MySQL database username */
define( 'DB_USER', 'username_here' );
/** MySQL database password */
define( 'DB_PASSWORD', 'password_here' );
/** MySQL hostname */
define( 'DB_HOST', 'localhost' );
/** Database Charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );
/** The Database Collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );
Change as specified: - database_name_here : wordpress - username_here : wordpressuser - password : pAsswOrd1234
Add following line:
define('FS_METHOD', 'direct');
http://www.386387.xyz
Of course it would be a good idea to add SSL to your site, refer to CertbotOnDebianUbuntu Tutorial.