How to Setup | Install a WordPress website in Linux painlessly


Let’s Setup | Install a WordPress website in Linux painlessly. WordPress is the most popular WebApp in the internet. It is a free and open-source content management system(CMS) based on PHP  and MySQL . WordPress is designed for blogging. Most of the people are choosing WordPress for their blogs including me! because we can easily create a website using WordPress with no pain . Let me explain how we can do it here …

I assume you have a LAMP server  ready to install WordPress on it. If you don’t, please learn how to setup a LAMP server from here >> 

Step1: Download WordPress:

Let’s download WordPress to our server using wget  command. Latest version of WordPress is always available at https://wordpress.org/

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

 

Downloading WordPress

 

From the message, you can see that WordPress is downloaded as a compressed file latest.tar.gz  to the current working directory.

 

Let’s extract the file:

tar -xvf latest.tar.gz

 

Step2: Copy WordPress files to Document root:

You will see a directory called ‘WordPress’ is created in the current working directory. All WordPress files are located under this directory. We need to copy this files to the document root of Apache.  /var/www/html/  is the document root of my apache website. I am copying content of ‘WordPress’ directory to the document root using following command.

sudo cp -r wordpress/* /var/www/html/

 

Let’s save some disk space by deleting ‘latest.tar.gz’ and ‘wordpress’ in the current directory.

rm -rf latest.tar.gz wordpress

 

To fix all permission and ownership issues in the document root, run following commands.

chown -R `ps aux | egrep '([a|A]pache|[h|H]ttpd)' | awk '{ print $1}' | uniq | tail -1`. /var/www/html;     #Change ownership of all files and directories to apache user

find /var/www/html -type d -exec chmod 755 {} \;     #grant permission 755 to all directories

find /var/www/html -type f -exec chmod 644 {} \;     #grant permission 644 to all files

 

 

Now open your brand new WordPress website in the browser http://your_server_ipaddress  and you should see something like this.

 

WordPress setup page

 

Step3: Create a Database and Database user for WordPress:

As I mentioned above, this is the WordPress setup page. During the setup process, you will be asked to type in the database details for your website. So Let’s create a Database and a user.

Log in to MySQL  server as root.

mysql -u root -p'mysql_root_password_here'

and type in following DB queries

CREATE DATABASE mydb;
CREATE USER 'mydbuser'@'localhost' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON mydb.* TO 'mydbuser'@'localhost';
FLUSH PRIVILEGES;

 

screenshot

That’s it! A user mydbuser  is created who has full access on db mydb . Please remember to give a strong password for the user(not like what I given here).

Step4: Follow WordPress Installation instructions in the browser:

Once done, click on Let’s go!  button on the browser and input details of newly created database. Then It should look like this.

 

 

Click ‘Submit’ button and then Run the installation  button.

 

 

Next you get a page to input WordPress admin credentials. There give a strong password and proceed further.

 

 

 

That’s it. Now you can access your WordPress Website using https://your_server_ip_address  and access the WordPress admin page with https://your_server_ip_address/wp-admin

 

WordPress admin page

 

 

WordPress main page

 

 

I hope you could follow my blog on WordPress installations. I will be filling this article with a lot useful information soon. Stay tuned by Subscribing to the website (Checkout Right Sidebar for the Subscription Form).

 

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top
x