A lot of people use WordPress as it is the world’s most popular website builder.
The quick way to install WordPress on an Ubuntu machine with Apache. We can also call it WordPress with LAMP. Just copy to paste the commands and see how it works.
If the Ubuntu version is below 18.04, then add below lines
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
Installing PHP 7.4 and Mysql Server
sudo apt install php7.4 libapache2-mod-php7.4 mysql-server php7.4-mysql
sudo apt install php7.4-curl php7.4-gd php7.4-xml php7.4-mbstring php7.4-xmlrpc php7.4-zip php7.4-soap php7.4-intl
Download WordPress and set permissions
cd /tmp
curl -O https://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz
mv -r wordpress /var/www/.
cd /var/www/
sudo chown www-data:www-data -R wordpress
cd wordpress
sudo find . -type d -exec chmod 755 {} \;
sudo find . -type f -exec chmod 644 {} \;
Mysql setup
sudo mysql -u root
mysql> CREATE DATABASE wordpress;
mysql> CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'test123456';
mysql> GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuser'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> \q
Setting up Apache virtual host
vim /etc/apache2/sites-available/wordpress.conf
#add below lines in above file
<VirtualHost *:80>
ServerName www.domainxyz.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/wordpress
<Directory /var/www/wordpress>
#Options Indexes FollowSymLinks MultiViews
AllowOverride All
#Require all granted
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
sudo a2ensite wordpress
sudo a2dissite 000-default.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
sudo apt install imagemagick
sudo apt install php7.4-imagick
sudo systemctl restart apache2
Now check your domain or http://localhost.com and follow instructions on the browser. Your wordpress installation is done.
Feel free to add comments for any improvements or issues.