How To Install WordPress on Ubuntu Apache Server - HostNamaste

How To Install WordPress on Ubuntu Apache Server

Posted on
How To Install WordPress on Ubuntu Apache Server - HostNamaste
How To Set up WordPress on Ubuntu Apache Server – HostNamaste

WordPress is one of the best Content Management Systems available in the market. It permits customers to simply arrange versatile blogs and web sites with MySQL because the backend and PHP processing the dynamic pages of the web site. WordPress CMS has seen charge of adoption and is a superb alternative for getting your web sites on the search engine and working them shortly.

There are various methods of putting in WordPress together with the one utilizing LAMP or LEMP stack. This is likely one of the most extremely used strategies. Its spectacular options and in depth plugin framework and theme programs permits website homeowners and builders to get pleasure from its easy and highly effective publishing instruments. 

On this information, you’ll learn to set up WordPress cases arrange on Ubuntu.


Earlier than you begin, it’s essential to full some vital steps on the server. 

You could be a non-root consumer utilizing your sudo privileges. 

Login to your server as root or as a consumer with root privilege (sudo)

To examine your hostname, run the next code:

hostname -f

The primary code will convey your brief hostname and the second states your absolutely certified area title (FQDN). 

You could configure LAMP or LEMP Stack.

How To Set up WordPress on Ubuntu Apache Server

The next steps will assist you to to put in WordPress on Ubuntu.

Step 1): Set up MySQL database

WordPress is a relational database used to handle and retailer website and the consumer info. With MySQL put in, you may fulfil this performance. You could make a database and a consumer for WordPress to work with.

Arrange MySQL database for WordPress.

Comply with these steps:

Log in to your MySQL command line as a root (administrative) consumer by utilizing the command:

mysql -u root -p

You may be requested for the password you used to set your MySQL root account.

Now, it’s essential to create a separate database that WordPress can management. You may name it something you need. Right here, on this instance, we use the title WordPress. Enter the command:


All SQL statements should finish in semi-colon. Subsequent, it’s essential to create a separate MySQL consumer account that may solely be used to function the database. Assign a consumer title to it and a password. You’ll have to change the username and password once you create your individual account. Use the command:

CREATE USER [email protected] IDENTIFIED BY 'password';

You could grant the consumer acess to the database. Use the command: 

GRANT ALL PRIVILEGES ON wordpress.* TO [email protected];

Now, it’s essential to take away the earlier MySQL cases to pressure the brand new privilege modifications made. 


Exit MySQL database utilizing command:


Step 2) Obtain WordPress

You must obtain WordPress software program from the web site. Comply with these steps: 

You could create a listing referred to as src beneath your web site’s listing, to retailer the recent WordPress information. Enter the command:

sudo mkdir /var/www/html/
cd /var/www/html/

Right herevar/www/html/ is used for example. You may create your individual residence listing. 

Set the consumer of your net server because the proprietor of your website’s residence listing. 

sudo chown -R www-data:www-data /var/www/html/

Now, set up the most recent model of WordPress and extract it utilizing command,

sudo wget
sudo -u www-data tar -xvf newest.tar.gz

Now, rename newest.tar.gz as WordPress adopted by the date, to retailer a backup of the unique information in case you ever set up new model sooner or later. 

sudo mv newest.tar.gz wordpress-`date "+%Y-%m-%d"`.tar.gz

Subsequent, create a public listing to be the basis listing for WordPress. Which means everybody will be capable to entry your WordPress website. Use command 

sudo mkdir /var/www/html/
sudo mv wordpress/* ../public_html/

Now, change the net server possession to the general public folder.

sudo chown -R www-data:www-data /var/www/html/

Step 3) Configure WordPress

This configuration will likely be achieved on the command line of WordPress. Comply with these steps: 

Navigate your area within the net browser. Fill in your particulars like the popular language and click on on the Let’s go button. Use the database credentials that have been set once you put in MYSQL:

As soon as WordPress confirms the credentials, immediate to Run to Set up

Fill in all of the administrator or root info. And click on on set up WordPress.

Now, enter your particulars and click on on Log In.

WordPress will immediate you for FTP credentials once you set up any new theme or plugins. To bypass it, modify the WordPress configuration (wp-config.php) by including the next strains:

/** Bypass FTP */
outline('FS_METHOD', 'direct');

In case you’re utilizing Apache or LAMP stack, run the next command to make sure that mod_rewrite is enabled. Restart Apache to use the modifications.


If you wish to make any additional modifications, entry the WordPress dashboard from the net interface by including code,/wp-admin to your web site tackle. 

Now, you could have efficiently put in WordPress.

Step 4) Create WordPress Permalinks

Permalinks or everlasting hyperlinks, are URLs which are mechanically created for some posts or pages in WordPress. This helps in interlinking or backlinking of posts. By default, WordPress assigns submit numbers as permalinks. Which means each particular submit can have a p=23 sort of quantity related to it. If you’d like permalinks to be extra info, it’s essential to make a number of changes to Apache or Nginx, relying on the stack you used.

Comply with these steps to configure permalink settings. 

  • Login to your WordPress admin panel by including /wp-admin to the URL.
  • Click on on Settings after which navigate to Permalinks.

You may choose your most well-liked permalink fashion or customise your individual, utilizing Customized Construction. Click on on Save Modifications.

Step 5) Configure WordPress to permit permalinks on Apache

You could modify Apache to permit rewrites on the .htaccess overrides. You are able to do so by enhancing the digital host file within the Listing Part.

<Listing /var/www/html/>
    Choices Indexes FollowSymLinks
    AllowOverride All
    Require all granted

Restart Apache to avoid wasting the modifications.

sudo systemctl restart apache2

Step 6) Configure WordPress to permit permalinks on Nginx

By default, Nginx assumes that every permalink doesn’t consult with an present web page. It, subsequently, returns a server-side 404 error. You could replace the command strains within the location / { block of the digital host file configuration. Use the code:

Step 7) Modify most file dimension add setting to permit bigger information

By default, PHP permits solely net uploads beneath 2 megabytes. If you wish to add bigger information via the net interface, configure the upload_max_filesize setting within the php.ini.

For Apache: /and so forth/php/7.0/apache2/php.ini

For Nginx: /and so forth/php/7.0/fpm/php.ini

Search for the command line:

; Most allowed dimension for uploaded information.
; http://php.internet/upload-max-filesize
upload_max_filesize = 2M


I hope this weblog submit will assist you to to put in WordPress on ubuntu simply.  Let me know within the feedback when you have any questions or options for the submit.

Associated Net Internet hosting, VPS Weblog / Net Internet hosting Enterprise Information:

offshore vps