Wednesday, December 11, 2024

Install & Configure WordPress In Fresh Ubuntu Server

👉 In this tutorial, we will guide you through the process of installing and configuring WordPress on a freshly set up Ubuntu server.


  • WordPress is an open-source content management system (CMS) that allows you to create and manage websites easily without requiring advanced technical skills.
  • It is built using PHP and uses a MySQL database for storing data.
  • WordPress is widely used for creating Blogs, Business Websites, E-commerce Stores, Portfolio Sites, Educational Sites, Forums and Communities.

Prerequisites:


Step 1) Install LAMP Stack (Linux, Apache, MySQL, PHP)

Step 2) Install Wordpress

Step 3) Configure Apache VirtualHost for WordPress

Step 4) Update /etc/hosts file

Step 5) Install phpMyAdmin

Step 6) Configure WordPress Installation



Step 1) Install LAMP Setup (Apache, Mysql, PHP)


Install Apache:


sudo apt update && sudo apt install apache2 -y

sudo systemctl start apache2 && sudo systemctl enable apache2


Install MySQL:


sudo apt install mysql-server -y

sudo mysql -u root -p -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';"

 

a) log into MySQL.

sudo mysql -u root -p

 

b) Create a database and user for WordPress.

CREATE DATABASE
wordpress_db;
CREATE USER 'wordpress_user'@'localhost' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON wordpress_db.* TO 'wordpress_user'@'localhost';
FLUSH PRIVILEGES;
EXIT; 


Install PHP: via bash script file.



Step 2) Install Wordpress


cd /tmp

wget https://wordpress.org/latest.tar.gz

tar -zxvf 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


Step 3) Configure Apache VirtualHost for WordPress


sudo vim /etc/apache2/sites-available/wordpress.conf


Add the Following Configuration:

 



Enable the New Virtual Host:


sudo a2ensite wordpress.conf

sudo a2enmod rewrite

sudo systemctl restart apache2


Step 4) Configure /etc/hosts file


sudo nano /etc/hosts


Add the following entry:


127.0.1.1   tech2towards.local


Step 5) Install phpMyAdmin:

Download Latest Version From : Here

cd /tmp

wget https://files.phpmyadmin.net/phpMyAdmin/5.2.1/phpMyAdmin-5.2.1-all-languages.zip

tar -zxvf phpMyAdmin-5.2.1-all-languages.zip


sudo mv phpMyAdmin-5.2.1-all-languages phpmyadmin

sudo mv phpmyadmin /var/www/html/wordpress/phpmyadmin


Step 6) Configure WordPress Installation:


Now, you need to configure WordPress to connect to the database you created earlier.

a) Go to your WordPress directory:

cd /var/www/html/wordpress/

b) Edit the wp-config.php file:

sudo vim wp-config.php

c) Find the following lines and update them with your database details:

  • define('DB_NAME', 'wordpress_db');
  • define('DB_USER', 'wordpress_user');
  • define('DB_PASSWORD', '123456');
  • define('DB_HOST', 'localhost');


d) Save and close the file.

e) Now, Check In Web Browser

  • http://your-Machine-ip/

 

No comments:

Post a Comment

testing