A quick and dirty how-to install wordpress on an ubuntu 24 imageusing Amazon EC2 virtual machines. Contact me if you need help! Probably not complete.
sudo apt update
sudo apt install apache2 -y
sudo apt upgrade -y
sudo systemctl enable apache2
sudo systemctl start apache2
During mysql setup remove all test components and databases and only allow root to localhost this is important
sudo apt install php php-mysql libapache2-mod-php php-cli php-common php-xml php-zip php-curl php-mbstring -y
sudo systemctl restart apache2
sudo mysql -u root -p
CREATE DATABASE wordpress;
CREATE USER 'wp_user'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wp_user'@'localhost';
EXIT;
cd /tmp
wget https://wordpress.org/latest.tar.gz
tar -xvzf latest.tar.gz
sudo mv wordpress /var/www/html/
sudo chown -R www-data:www-data /var/www/html/wordpress
sudo chmod -R 755 /var/www/html/wordpress
sudo nano /etc/apache2/sites-available/wordpress.conf
#paste this
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/
ServerName your_domain_or_IP_address
<Directory /var/www/html/wordpress>
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/wordpress
ServerName your_domain_or_ip
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/your_domain_or_ip/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/your_domain_or_ip/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/your_domain_or_ip/chain.pem
<Directory /var/www/html/wordpress>
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
then these commands
sudo a2ensite wordpress.conf
sudo a2enmod rewrite
sudo apt install certbot
sudo apt install python3-certbot-apache
SSLCertificateFile /etc/letsencrypt/live/illphated.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/illphated.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/illphated.com/chain.pem
sudo ufw allow in "Apache Full"
Leave a Reply