You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

WordPress is one of the top most used CMS systems in the world. Its successful adoption has been made possible by its open source nature. WordPress is licensed under GPLv2 and has plenty of themes and plugins thus making it simple to customize. In this tutorial i’ll show show full steps on how to setup wordpress on Arch and configuring php and mysql database. WordPress is easy to customize and administer yet very powerful content management system.
Install wordpress on Arch Linux with this straightforward process which can be done by issuing few commands on the terminal. So let’s get started.

Setup wordpress and configure

  1. Install Apache Web server

[pastacode lang=”bash” message=”” highlight=”” provider=”manual” manual=”%23%20pacman%20-Sy%20apache%0A”/]

Start Apache

[pastacode lang=”bash” message=”” highlight=”” provider=”manual” manual=”%23%20systemctl%20start%20httpd%0A”/]

Enable apache to start at boot

[pastacode lang=”bash” message=”” highlight=”” provider=”manual” manual=”%23%20systemctl%20start%20httpd%0A”/]

  1. Install Php

[pastacode lang=”bash” message=”” highlight=”” provider=”manual” manual=”%23%20pacman%20-Sy%20php%20php-%7Bcgi%2Cgd%2Cpgsql%7D%0A”/]

Sample output:

[pastacode lang=”bash” message=”” highlight=”” provider=”manual” manual=”root%40darkpy%3Apts%2F5-%3E%20%2Froot%20(0)%0A%3E%20sudo%20pacman%20-Sy%20php%20php-%7Bcgi%2Cgd%2Cpgsql%7D%0A%3A%3A%20Synchronizing%20package%20databases…%0Acore%20is%20up%20to%20date%0Aextra%20is%20up%20to%20date%0Acommunity%20is%20up%20to%20date%0Amultilib%20is%20up%20to%20date%0Aarchlinuxfr%20is%20up%20to%20date%0Aarchlinuxcn%20is%20up%20to%20date%0Awarning%3A%20php-7.0.7-1%20is%20up%20to%20date%20–%20reinstalling%0Awarning%3A%20php-gd-7.0.7-1%20is%20up%20to%20date%20–%20reinstalling%0Aresolving%20dependencies…%0Alooking%20for%20conflicting%20packages…%0APackages%20(4)%20php-7.0.7-1%20php-cgi-7.0.7-1%20php-gd-7.0.7-1%20php-pgsql-7.0.7-1%0ATotal%20Download%20Size%3A%202.06%20MiB%0ATotal%20Installed%20Size%3A%2024.44%20MiB%0ANet%20Upgrade%20Size%3A%209.18%20MiB%0A%3A%3A%20Proceed%20with%20installation%3F%20%5BY%2Fn%5D%20y%0A%3A%3A%20Retrieving%20packages…%0Aphp-cgi-7.0.7-1-x86_64%202.0%20MiB%20490K%2Fs%2000%3A04%20%5B%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%5D%20100%25%0Aphp-pgsql-7.0.7-1-x…%2052.6%20KiB%20202K%2Fs%2000%3A00%20%5B%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%5D%20100%25%0A(4%2F4)%20checking%20keys%20in%20keyring%20%5B%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%5D%20100%25%0A(4%2F4)%20checking%20package%20integrity%20%5B%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%5D%20100%25%0A(4%2F4)%20loading%20package%20files%20%5B%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%5D%20100%25%0A(4%2F4)%20checking%20for%20file%20conflicts%20%5B%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%5D%20100%25%0A(4%2F4)%20checking%20available%20disk%20space%20%5B%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%5D%20100%25%0A%3A%3A%20Processing%20package%20changes…%0A(1%2F4)%20reinstalling%20php%20%5B%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%5D%20100%25%0A(2%2F4)%20installing%20php-cgi%20%5B%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%5D%20100%25%0A(3%2F4)%20reinstalling%20php-gd%20%5B%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%5D%20100%25%0A(4%2F4)%20upgrading%20php-pgsql%20%5B%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%5D%20100%25%0A%3A%3A%20Running%20post-transaction%20hooks…%0A(1%2F1)%20Updating%20manpage%20index…%0A”/]

  1. Install MariaDB database service

[pastacode lang=”bash” message=”” highlight=”” provider=”manual” manual=”%23%20pacman%20-S%20libmariadbclient%20mariadb%20mariadb-clients%0A”/]

Set base configurations

[pastacode lang=”bash” message=”” highlight=”” provider=”manual” manual=”%23%20mysql_install_db%20–user%3Dmysql%20–basedir%3D%2Fusr%20–datadir%3D%2Fvar%2Flib%2Fmysql%0A”/]

Start and enable MariaDB

[pastacode lang=”bash” message=”” highlight=”” provider=”manual” manual=”%23%20systemctl%20enable%20mysqld.service%0A%23%20systemctl%20start%20mysqld.service”/]

Setup Root password for MariaDB

[pastacode lang=”bash” message=”” highlight=”” provider=”manual” manual=”%23%20mysql_secure_installation%0A”/]

See picture below for details:
If you did upgrade, just type:

[pastacode lang=”bash” message=”” highlight=”” provider=”manual” manual=”%23%20mysql_upgrade%20-u%20root%20-p%0A”/]

  1. Confirm to make sure you’ve correct /etc/hosts file configured. This is crucial if you’re accessing WordPress site on LAN with domain.

[pastacode lang=”bash” message=”” highlight=”” provider=”manual” manual=”%23%20cat%20%2Fetc%2Fhosts%0A”/]

My output is as shown below

[pastacode lang=”bash” message=”” highlight=”” provider=”manual” manual=”%23%3Cip-address%3E%20%3Chostname.domain.org%3E%20%3Chostname%3E%0A127.0.0.1%20localhost.localdomain%20localhost%0A%3A%3A1%20localhost.localdomain%20localhost”/]

  1. Configure PHP

[pastacode lang=”bash” message=”” highlight=”” provider=”manual” manual=”%23%20vim%20%2Fetc%2Fhttpd%2Fconf%2Fhttpd.conf%0A”/]

Comment the line below:

[pastacode lang=”bash” message=”” highlight=”” provider=”manual” manual=”%23LoadModule%20mpm_event_module%20modules%2Fmod_mpm_event.so%0A”/]

Uncomment below line:

[pastacode lang=”bash” message=”” highlight=”” provider=”manual” manual=”LoadModule%20mpm_prefork_module%20modules%2Fmod_mpm_prefork.so%0A”/]

Place below line in the LoadModule list just after LoadModule dir_module modules/mod_dir.so:

[pastacode lang=”bash” message=”” highlight=”” provider=”manual” manual=”LoadModule%20php7_module%20modules%2Flibphp7.so”/]

install wordpress
At the end of include list, add:

[pastacode lang=”apacheconf” message=”” highlight=”” provider=”manual” manual=”Include%20conf%2Fextra%2Fphp7_module.conf”/]

install wordpress
Enable mysqli and gd modules:

[pastacode lang=”bash” message=”” highlight=”” provider=”manual” manual=”%23%20vim%20%2Fetc%2Fphp%2Fphp.ini%0A”/]

Make sure below lines are uncommented

[pastacode lang=”bash” message=”” highlight=”” provider=”manual” manual=”extension%3Dmysqli.so%0Aextension%3Dgd.so”/]

install wordpress

Restart Apache:

[pastacode lang=”bash” message=”” highlight=”” provider=”manual” manual=”%23%20systemctl%20restart%20httpd%0A”/]

Then:

[pastacode lang=”bash” message=”” highlight=”” provider=”manual” manual=”%23%20mysql%20-u%20root%20-p%24password%0A”/]

You’ll drop on Mysql cli terminal:

[pastacode lang=”bash” message=”” highlight=”” provider=”manual” manual=”%23%20mysql%20-u%20root%20-p%24password%0AWelcome%20to%20the%20MariaDB%20monitor.%20Commands%20end%20with%20%3B%20or%20g.%0AYour%20MariaDB%20connection%20id%20is%204%0AServer%20version%3A%2010.1.14-MariaDB%20MariaDB%20Server%0ACopyright%20(c)%202000%2C%202016%2C%20Oracle%2C%20MariaDB%20Corporation%20Ab%20and%20others.%0AType%20’help%3B’%20or%20’h’%20for%20help.%20Type%20’c’%20to%20clear%20the%20current%20input%20statement.%0AMariaDB%20%5B(none)%5D%3E”/]

Create Database and database user and Grant privileges:

[pastacode lang=”bash” message=”” highlight=”” provider=”manual” manual=”CREATE%20DATABASE%20wordpress%3B%0ACREATE%20USER%20’wordpressuser%20’%40’localhost’%20IDENTIFIED%20BY%20’password’%3B%0AGRANT%20ALL%20PRIVILEGES%20ON%20wordpress.*%20TO%20’wordpressuser’%40’localhost’%3B%0AFLUSH%20PRIVILEGES%3B%0Aq%0A”/]

Remember to change WordPress user and database name accordingly.

  1. Install wordpress

[pastacode lang=”bash” message=”” highlight=”” provider=”manual” manual=”%23%20cd%20%2Fsrv%2Fhttp%2F%0A%23%20wget%20https%3A%2F%2Fwordpress.org%2Flatest.tar.gz%23%20tar%20xvzf%20latest.tar.gz%0A%23%20cd%20wordpress”/]

 

Modify group ownership of wordpress to http

[pastacode lang=”bash” message=”” highlight=”” provider=”manual” manual=”%23%20chown%20-R%20root%3Ahttp%20%2Fsrv%2Fhttp%2Fwordpress%0A”/]

Create and modify configuration file

[pastacode lang=”bash” manual=”%23%20cd%20%2Fsrv%2Fhttp%2Fwordpress%0A%23%20cp%20wp-config-sample.php%20wp-config.php%0A” message=”” highlight=”” provider=”manual”/]

Edit wp-config.php to configure Database user, database name, and database password:

[pastacode lang=”bash” message=”” highlight=”” provider=”manual” manual=”%23%20vim%20wp-config.php%0A”/]

Modify to look like below

[pastacode lang=”bash” message=”” highlight=”” provider=”manual” manual=”%2F**%20The%20name%20of%20the%20database%20for%20WordPress%20*%2F%0Adefine(‘DB_NAME’%2C%20’wordpress’)%3B%0A%2F**%20MySQL%20database%20username%20*%2F%0Adefine(‘DB_USER’%2C%20’wordpressuser’)%3B%0A%2F**%20MySQL%20database%20password%20*%2F%0Adefine(‘DB_PASSWORD’%2C%20’password’)%3B%0A”/]

See below screenshot.

install wordpress

  1. Open wordpress on browser

You’re done with installation of wordpress, to access it just type below url on our favorite browser

http://localhost/wordpress

You’ll see window like one shown below

install wordpress

Set:

  • Blog Title
  • Password
  • user to login

Then Login

  1. Installing WordPress Template

Download Best WordPress templates from http://themeforest.net/?ref=josemutai
Download theme you like then go to:
Dashboard > Appearance > Themes > Add New > Add Themes > Upload Theme > Browse > Choose File, then locate .zip theme file and upload it.

Conclusion

We’ve covered how to setup wordpress and configured everything on Arch Linux needed for wordpress to run and host site. You can now customize wordpress and add any plugin you want but be careful on the number of plugins you enable since they can drastically impact negatively on your site.

You can support us by downloading this article as PDF from the Link below. Download the guide as PDF