WordPress is the most mainstream CMS (content administration framework) on the web. It permits you to effectively set up adaptable sites and sites on top of a MySQL backend with PHP preparing. WordPress has seen amazing reception and is an incredible decision for getting a site going rapidly. After arrangement, practically everything organization should be possible through the web frontend.
In this post, We will install and configure wordpress on ubuntu 18.04 LTS.
Step 1: Installing Apache Web Server
This is very important to update the Ubuntu repository by using the following command.
sudo apt-get update
After this you need to install the apache web server with given command.
sudo apt-get install apache2 -y
Once the Apache2 packages is installed, So then we need to verify service is running or not and by default you will get the Apache2 web service on running state.
sudo systemctl status apache2
You should get the put like this.
Step 2: UFW Rules
Now you need to open the port 80 in your filrewall if enabled, Use the given command for the same.
sudo ufw status
sudo ufw allow 80
Once this command executed successfully So then test the Apache server in web browser with the URL – http://localhost or http://IP_Address
Step 3: Installing PHP
WordPress based on php programing language So we need to install the PHP required packages by using the following command.
sudo apt-get install php php-mysql -y
After installation of the package, You need to verify it.
php -v
You should get the out put like this.
After this we need to test php with apache web server also, Create the a phpinfo.php file in RootDocument of apaache web server, You need to take as a root user in your system, Use the given command for that.
sudo -secho "<?php phpinfo();?>" > /var/www/html/phpinfo.php
After this you need to open the web browser with the given URL.
http://localhost/phpinfo.php or http://IP_Address/phpinfo.php
Now you should get the output like this.
After testing php web page we need to remove the php and apache test web pages from the server, To do that you need to execute the given commands.
rm /var/www/html/index.html && rm /var/www/html/phpinfo.php
Step 4: Installing MariaDB Database Server
We need to install database server like MariaDB for wordpress, Use the following command for that, We are going to install 2 mariaDB packages.
sudo apt-get install mariadb-server mariadb-client -y
Once the requored packages successfully installed So then you need to secure the MariaDB server, Use the following command for the same as a root user.
mysql_secure_installation
You will be asked for few security question, You need to type Y button to do that.
All set now, Now we need to create a database and user with required permission in MariaDB database server, Follow the given step for the same.
Login to MariaDB database server and execute the following command.
mysql -u root -p
Once you have logged in MariaDB database So then you need to execute the given mysql query step by step but make sure you need to change username, password and database name as per your need.
CREATE DATABASE wordpress;
CREATE USER 'wordpress_user'@'localhost' IDENTIFIED BY 'wordpress_password';
GRANT ALL ON wordpress.* TO 'wordpress_user'@'localhost' IDENTIFIED BY 'wordpress_password';
FLUSH PRIVILEGES;
EXIT
Here our database work is completed now We can go ahead for the next level.
Step 5: Installing WordPress
Now you need to download the wordpress and extract it by using the given command.
cd /tmp
wget https://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
After this you need to move the wordpress file in Apache2 RootDocument directory, Use the following command for the same.
mv wordpress/* /var/www/html/
Now you need to update the permission and few changes for the wordpress.
mkdir /var/www/html/wp-content/uploads
chown -R www-data:www-data /var/www/html/
chmod -R 755 /var/www/html/
Lets open the web browser with http://localhost or http://IP_Address to setup the wordpress with database with username.
Select your language and click on continue button to get next step.
Here you need to ready with wordpress database name, usernanem and password to configure wordpress with MariaDB server.
Click on Run the installation, It will configure your database credentials in wordpress’s database config file.
Now just click on Install WordPress button to get next step.
You should get the message Already installed, Here we are ready to login in WordPress Admin Panel.
Use your username and password, Few step ago we have submitted in web form.
Now we have successfully installed and configure new wordpress on ubuntu 18.04.
Conclusion
WordPress ought to be introduced and prepared to utilize! Some basic subsequent stages are to pick the permalinks setting for your posts (can be found in Settings > Permalinks) or to choose another topic (in Appearance > Themes). In the event that this is your first time utilizing WordPress, investigate the interface a touch to get to know your new CMS.