User Tools

Site Tools


setupwordpressubuntu22

TinkersDocs Home Back to tektinkers.com

Setup Wordpress - Ubuntu 22


Setup Database's Username and Password

sudo mysql
mysql -u root -p
CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;

Change wordpressuser and password to whatever you want:

CREATE USER 'wordpressuser'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
FLUSH PRIVILEGES;
EXIT;


Installing Additional PHP Extensions:

sudo apt install php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip
sudo systemctl restart apache2


Adjust Apache Config to allow overrides and rewrites in .htaccess

sudo nano /etc/apache2/sites-available/wordpress.conf
<VirtualHost *:80>
. . .
    <Directory /var/www/wordpress/>
        AllowOverride All
    </Directory>
. . .
</VirtualHost>
sudo a2enmod rewrite
sudo apache2ctl configtest
sudo systemctl restart apache2


Downloading Wordpress

cd /tmp
curl -O https://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz
touch /tmp/wordpress/.htaccess
cp /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php
mkdir /tmp/wordpress/wp-content/upgrade

Change 2nd wordpress to name of directory to put wordpress in

sudo cp -a /tmp/wordpress/. /var/www/wordpress


Configure Wordpress Directory

sudo chown -R www-data:www-data /var/www/wordpress
sudo find /var/www/wordpress/ -type d -exec chmod 750 {} \;
sudo find /var/www/wordpress/ -type f -exec chmod 640 {} \;

Copy salts to notepad for safekeeping temporarily

curl -s https://api.wordpress.org/secret-key/1.1/salt/
sudo nano /var/www/wordpress/wp-config.php

Update file and add line

. . .

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

/** MySQL database username */
define( 'DB_USER', 'wordpressuser' );

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

/** 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', '' );


. . .

define('FS_METHOD', 'direct');


Complete Install from Web Interface
From the web browser navigate to websites IP or URL


Credit to: https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-on-ubuntu-22-04-with-a-lamp-stack

setupwordpressubuntu22.txt · Last modified: 2025/04/29 00:26 by tektinkers