how to install wordpress in ubuntu 18.043 min read

Prabhin Prabharkaran Administrator
DevOps Engineer

He is a Technical professional. He is a person who loves to share tricks and tips on the Internet. He Posts what he does!

follow me

how to install wordpress in ubuntu 18.04

Hi Techrunnr subscribers, today we will show you how to install wordpress in ubuntu 18.04

 Install Apache and mariadb server

Use the following commands to install apache and marriadbb server

sudo apt-get update
sudo apt-get install apache2 mariadb-server mariadb-client

After installing Apache2, the commands below can be used to stop, start and enable Apache2 service to always start up with the server boots.

sudo systemctl stop apache2.service
sudo systemctl start apache2.service
sudo systemctl enable apache2.service

sudo systemctl stop mariadb.service
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

After that, run the commands below to secure MariaDB server by creating a root password and disallowing remote root access.

sudo mysql_secure_installation

When prompted, answer the questions below by following the guide.

Enter current password for root (enter for none): Just press the Enter
Set root password? [Y/n]: Y
New password: Enter password
Re-enter new password: Repeat password
Remove anonymous users? [Y/n]: Y
Disallow root login remotely? [Y/n]: Y
Remove test database and access to it? [Y/n]: Y
Reload privilege tables now? [Y/n]: Y
Restart MariaDB server

sudo systemctl restart mariadb.service

Install PHP 7.1 , use the following repository to install latest php 7.1

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php

Then update and upgrade to PHP 7.1

sudo apt update

sudo apt install php7.1 libapache2-mod-php7.1 php7.1-common php7.1-mbstring php7.1-xmlrpc php7.1-gd php7.1-xml php7.1-mysql php7.1-cli php7.1-mcrypt php7.1-zip php7.1-curl

After install PHP 7.1, run the commands below to open PHP-FPM default file.

sudo vi /etc/php/7.1/apache2/php.ini
Then make the changes on the following lines below in the file and save.

file_uploads = On
allow_url_fopen = On
memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 360
date.timezone = Asia/Chennai

Create database for wordpress

login to mysql

mysql -u root -p

Enter the password

CREATE DATABASE site;
GRANT ALL PRIVILEGES ON site.* TO ‘your_username_here’@’localhost’ IDENTIFIED BY ‘your_chosen_password_here’;
FLUSH PRIVILEGES;
EXIT;

Download latest wordpress

cd /tmp && wget https://wordpress.org/latest.tar.gz
tar -zxvf latest.tar.gz
sudo mv wordpress /var/www/html/

Set the permission for wordpress files

chown -R www-data:www-data /var/www/html/
chmod -R 755 /var/www/html/

Configure the created database in the wordpress configurtion files.

cd /var/www/html
mv wp-config-sample.php wp-config.php

And configure same details in below mentioned lines in wp-config.php file.

define(‘DB_NAME’, ‘database_name_here’); /** MySQL database username */ define(‘DB_USER’, ‘username_here’); /** MySQL database password */ define(‘DB_PASSWORD’, ‘password_here’); /** MySQL hostname */ define(‘DB_HOST’, ‘localhost’); /** Database Charset to use in creating database tables. */ define(‘DB_CHARSET’, ‘utf8’); /** The Database Collate type. Don’t change this if in doubt. */ define(‘DB_COLLATE’, ”);

Once all these configuration Done , restart all the services

/etc/init.d/mysql restart

/etc/init.d/apache2 restart

Then open web browser and browse your IP address. Enter all the details. Enter the database,user, password, host details as you mentioned above.

WordPress

© 2018, Techrunnr. All rights reserved.

#1
#2
#3
Questions Answered
Articles Written
Overall Points

Related posts

Leave a Reply