Install WordPress on Ubuntu
While installing WordPress is easy, it contains multiple steps, and if these install steps are followed, you will end up with a successful website
Start by updating the existing software and install the underlying software required for WordPress to function
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install net-tools
sudo apt-get install apache2
sudo apt-get install mysql-server libapache2-mod-auth-mysql php7.4-mysq
Secure you mysql installation:
sudo mysql_secure_installation
Download WordPress Software
sudo mkdir /var/www/YOURWEBSITENAME
cd /var/www/YOURWEBSITENAME
sudo wget https://wordpress.org/latest.tar.gz
sudo tar -xzvf latest.tar.gz
sudo mv wordpress/* ./
sudo rmdir wordpress
sudo mysql -u root -p ——‘YOURPASSWORD!
CREATE DATABASE YOURDATABASE;
CREATE USER ‘YOURWORDPRESSUSER’@’localhost’ IDENTIFIED BY ‘YOURPASSWORD!’;
GRANT ALL ON YOURPASSWORD.* TO ‘wpuser’@’localhost’;
user YOURWORDPRESSUSER – database YOURDATABASE
sudo nano /var/www/YOURWEBSITENAME/.htaccess
add Directory Index /snap/index.php to file
user@ubuntu-server:~/wordpress/wordpress
sudo cp * /var/www/html/snap/ -r
sudo nano /etc/apache2/apache2.conf
Options FollowSymLinks
AllowOverride None
Require all denied
sudo nano /etc/apache2/sites-available/000-default.conf
change –
change ServerAdmin admin@yoursite.com
change DocumentRoot /var/www/YOURWEBSITENAME
sudo a2dissite 000-default
sudo apache2ctl configtest
sudo systemctl reload apache2
https://YOURWEBSITENAME
sudo nano /etc/apache2/mods-enabled/dir.conf
sudo systemctl reload apache2
nano /var/www/YOURWEBSITENAME/info.php
<?php
phpinfo();
https://www.snapwhole.com/info.php
sudo rm /var/www/snapwhole/info.php
sudo mysql
CREATE DATABASE example_database;
CREATE USER ‘example_user’@’%’ IDENTIFIED WITH mysql_native_password BY ‘PASSWORD’;
GRANT ALL ON example_database.* TO ‘example_user’@’%’;
exit
mysql -u example_user -p
SHOW DATABASES;
CREATE TABLE example_database.todo_list (
item_id INT AUTO_INCREMENT,
content VARCHAR(255),
PRIMARY KEY(item_id)
);
INSERT INTO example_database.todo_list (content) VALUES (“My first important item 1”);
INSERT INTO example_database.todo_list (content) VALUES (“My first important item 2”);
INSERT INTO example_database.todo_list (content) VALUES (“My first important item 3”);
SELECT * FROM example_database.todo_list;
exit
nano /var/www/snapwhole/todo_list.php
<?php
$user = “example_user”;
$password = “YOURPASSWORD”;
$database = “example_database”;
$table = “todo_list”;