๐๐๐ฅ๐ญ๐ข๐ฆ๐๐ญ๐ ๐๐ฎ๐ข๐๐: ๐๐ง๐ฌ๐ญ๐๐ฅ๐ฅ๐ข๐ง๐ ๐๐จ๐ซ๐๐๐ซ๐๐ฌ๐ฌ ๐จ๐ง ๐๐๐ฎ๐ง๐ญ๐ฎ ๐๐จ๐ซ ๐๐๐ ๐ข๐ง๐ง๐๐ซ๐ฌ ๐
Step-by-Step Guide: How to Install WordPress on Ubuntu
WordPress is a popular content management system that powers millions of websites worldwide. If youโre looking to create a website or blog with WordPress, you'll need to install it on a web server first. In this article, we'll show you how to install WordPress on Ubuntu, a popular Linux distribution.
Before we get started, ensure you have access to a server running Ubuntu and root privileges or sudo access.
Step 1: Install Apache Web Server
The first step in installing WordPress on Ubuntu is to install the Apache web server. Apache is the most popular web server in the world and can be easily installed using the apt package manager. Open up your terminal and run the following command:
sudo apt update
sudo apt install apache2Step 2: Install MySQL Database Server
WordPress uses a MySQL database to store and manage its content. You can install the MySQL server by running the following command:
sudo apt install mysql-serverDuring the installation, you will be prompted to set a password for the MySQL root user. Make sure to remember this password as you will need it later.
Get Janushanth Sivaratnamโs stories inย yourย inbox
Join Medium for free to get updates fromย thisย writer.
Letโs now secure our MySQL database engine and disallow remote root login.
$ mysql_secure_installationThe first step will prompt you to change the root password to log in to the database. You can opt to change it or skip it if you are convinced that you have a strong password. To skip changing type n.
For safetyโs sake, you will be prompted to remove anonymous users. Type Y.
Next, disallow remote root login to prevent hackers from accessing your database. However, for testing purposes, you may want to allow log-in remotely if you are configuring a virtual server
Next, remove the test database.
Finally, reload the database to effect the changes.
Step 3: Install PHP
PHP is the scripting language that WordPress is built on. You can install PHP and some of its commonly used extensions by running the following command:
sudo apt install php libapache2-mod-php php-mysql php-curl php-gd php-imagick php-intl php-json php-mbstring php-xml php-xmlrpc php-zipTo confirm that PHP is installed, created a info.php file at /var/www/html/ path
nano /var/www/html/info.phpAppend the following lines:
<?php
phpinfo();
?>Save and Exit. Open your browser and append /info.php to the serverโs URL.
https://ip-address/info.phpStep 4: Create a MySQL Database and User for WordPress
Before we can install WordPress, we need to create a MySQL database and use it. Log in to the MySQL server as the root user:
sudo mysql -u root -pEnter the password you set for the MySQL root user during installation. Once youโre logged in, create a new database for WordPress:
CREATE DATABASE wordpress;Next, create a new MySQL user and grant it privileges to access the WordPress database:
CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'your_password_here';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuser'@'localhost';
FLUSH PRIVILEGES;Make sure to replace your_password_here with a strong password of your choice.
Step 5: Download and Install WordPress
Now that we have all the necessary components installed and configured, we can download and install WordPress. Start by navigating to the /var/www/html directory:
cd /var/www/htmlThen, download the latest version of WordPress using the wget command:
sudo apt-get install wgetsudo wget https://wordpress.org/latest.tar.gzExtract the downloaded archive using the tar command:
sudo tar -xzvf latest.tar.gzStep 6: Configure WordPress
The final step is to configure WordPress. Rename the sample configuration file:
cd wordpress
sudo mv wp-config-sample.php wp-config.phpEdit the wp-config.php file:
sudo nano wp-config.phpEnter the MySQL database and user details we created earlier:
define('DB_NAME', 'wordpress');
define('DB_USER', 'wordpressuser');
define('DB_PASSWORD', 'your_password_here');
define('DB_HOST', 'localhost');Save and close the file.
Step 7: Set file permissions
To ensure WordPress can write files to the server, weโll set the correct permissions for the Apache web server to write to certain directories:
sudo chown -R www-data: /var/www/html/wordpress/
sudo find /var/www/html/wordpress/ -type d -exec chmod 755 {} \;
sudo find /var/www/html/wordpress/ -type f -exec chmod 644 {} \;Step 8: Verity the installed services
php -v
sudo service mysql status
sudo service apache2 statusStep 9: Finish the Installation
Weโre almost done! Open up your web browser and navigate to your serverโs IP address or domain name. You should see the WordPress installation
https://ip-address/wordpressOpen your browser and append /wordpress to the serverโs URL.
Choose the language of your choice.
Enter the installation detailsโฆ
When you complete the installation, it will request your WordPress login and password.
Conclusion
The WordPress dashboard is now gone, ready for you to start your own blog or website! Thank you for making it this far. You can now move on to learning more about the many features, plugins, and themes and start creating your first blog or website! ๐








