WordPress is one of the most used CMS systems in the world. Its successful adoption is a result of the open source model and a huge community around the software. 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 website on Arch Linux / Manjaro Linux. This setup will include configuring php and mysql database.
Step 1: Update Arch Linux / Manjaro System
Let’s start the installation by upgrading the system:
$ sudo pacman -Syu :: Synchronizing package databases... core is up to date extra 1549.6 KiB 3.78 MiB/s 00:00 [#########################################################] 100% community 5.5 MiB 8.95 MiB/s 00:01 [#########################################################] 100% :: Starting full system upgrade... resolving dependencies... looking for conflicting packages... Packages (1) libldap-2.4.58-3 Total Download Size: 0.30 MiB Total Installed Size: 0.91 MiB Net Upgrade Size: 0.00 MiB :: Proceed with installation? [Y/n] y
Step 2: Install Apache httpd web server
Once the system is updated perform installation of Apache web server:
$ sudo pacman -Sy apache vim bash-completion :: Synchronizing package databases... core is up to date extra is up to date community is up to date resolving dependencies... looking for conflicting packages... Packages (3) apr-1.7.0-3 apr-util-1.6.1-8 apache-2.4.47-1 Total Download Size: 2.10 MiB Total Installed Size: 8.16 MiB :: Proceed with installation? [Y/n] y
$ sudo vim /etc/httpd/conf/httpd.conf ServerName mysite.example.com
Start Apache web server after installation:
sudo systemctl enable --now httpd
Let’s confirm service status:
$ systemctl status httpd ● httpd.service - Apache Web Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) Active: active (running) since Fri 2021-05-28 19:49:13 UTC; 37s ago Main PID: 814 (httpd) Tasks: 82 (limit: 2336) Memory: 6.8M CPU: 30ms CGroup: /system.slice/httpd.service ├─814 /usr/bin/httpd -k start -DFOREGROUND ├─815 /usr/bin/httpd -k start -DFOREGROUND ├─816 /usr/bin/httpd -k start -DFOREGROUND └─817 /usr/bin/httpd -k start -DFOREGROUND May 28 19:49:13 archlinux systemd: Started Apache Web Server.
Step 3: Install PHP on Arch Linux / Manjaro Linux
Run the following commands to install PHP and basic extensions on Arch Linux / Manjaro:
$ sudo pacman -Sy php php-cgi,gd,pgsql,fpm,apache :: Synchronizing package databases... core is up to date extra is up to date community is up to date resolving dependencies... looking for conflicting packages... .... Total Download Size: 27.55 MiB Total Installed Size: 143.27 MiB :: Proceed with installation? [Y/n] y
Uncomment the following lines in /etc/php/php.ini to MySQL/MariaDB extensions:
$ sudo vim /etc/php/php.ini extension=pdo_mysql extension=mysqli
Step 4: Install MariaDB database server
Next is installation of MariaDB database server on Arch Linux / Manjaro:
$ sudo pacman -S libmariadbclient mariadb mariadb-clients resolving dependencies... looking for conflicting packages... Packages (6) jemalloc-1:5.2.1-3 libaio-0.3.112-2 lzo-2.10-3 mariadb-10.5.10-1 mariadb-clients-10.5.10-1 mariadb-libs-10.5.10-1 Total Download Size: 36.35 MiB Total Installed Size: 305.29 MiB :: Proceed with installation? [Y/n] y
Initialize database server using the commands below:
$ sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql Installing MariaDB/MySQL system tables in '/var/lib/mysql' ... OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system Two all-privilege accounts were created. One is [email protected], it has no password, but you need to be system 'root' user to connect. Use, for example, sudo mysql The second is [email protected], it has no password either, but you need to be the system 'mysql' user to connect. After connecting you can set the password, if you would need to be able to connect as any of these users with a password and without sudo See the MariaDB Knowledgebase at https://mariadb.com/kb or the MySQL manual for more instructions. You can start the MariaDB daemon with: cd '/usr' ; /usr/bin/mysqld_safe --datadir='/var/lib/mysql' You can test the MariaDB daemon with mysql-test-run.pl cd '/usr/mysql-test' ; perl mysql-test-run.pl Please report any problems at https://mariadb.org/jira The latest information about MariaDB is available at https://mariadb.org/. You can find additional information about the MySQL part at: https://dev.mysql.com Consider joining MariaDB's strong and vibrant community: https://mariadb.org/get-involved/
Start and enable MariaDB service:
sudo systemctl enable --now mysqld.service
Secure your database server:
$ sudo mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and haven't set the root password yet, you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password or using the unix_socket ensures that nobody can log into the MariaDB root user without the proper authorisation. You already have your root account protected, so you can safely answer 'n'. Switch to unix_socket authentication [Y/n] y Enabled successfully! Reloading privilege tables.. ... Success! You already have your root account protected, so you can safely answer 'n'. Change the root password? [Y/n] y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] y ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] y ... Success! By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB!
Open MySQL Shell as root user:
$ mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 14 Server version: 10.5.10-MariaDB Arch Linux Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]>
Create Database for WordPress, user and grant privileges:
CREATE DATABASE wordpress; GRANT ALL ON wordpress.* TO [email protected] IDENTIFIED BY 'StrongPassword'; FLUSH PRIVILEGES; \q
Remember to change WordPress user and database name accordingly.
Step 5: Download WordPress on Arch Linux / Manjaro
Download the latest release of WordPress:
curl -O https://wordpress.org/latest.tar.gz
Extract the file downloaded:
tar xvf latest.tar.gz
Move the resulting wordpress folder to /srv/http/ directory:
sudo mv wordpress /srv/http/mysite
Create configuration file:
sudo mv /srv/http/mysite/wp-config-sample.php /srv/http/mysite/wp-config.php
Modify the file and provide database connection details:
$ sudo vim /srv/http/mysite/wp-config.php // ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define( 'DB_NAME', 'wordpress' ); /** MySQL database username */ define( 'DB_USER', 'wordpress' ); /** MySQL database password */ define( 'DB_PASSWORD', 'StrongPassword' );
Set web root directory permissions:
sudo chown -R root:http /srv/http/mysite
Modify the VirtualHost file to look like below:
$ sudo vim /etc/httpd/conf/extra/httpd-vhosts.conf
ServerAdmin [email protected] DocumentRoot "/srv/http/mysite" ServerName mysite.example.com ServerAlias www.mysite.example.com ErrorLog "/var/log/httpd/mysite-error_log" CustomLog "/var/log/httpd/mysite-access_log" common
- mysite.com is your valid domain name
- /srv/http/mysite is your wordpress root installation directory
- [email protected] is the Admin user email address
Edit the main httpd configuration file to load /etc/httpd/conf/extra/httpd-vhosts.conf file.
$ sudo vim /etc/httpd/conf/httpd.conf # Virtual hosts - Uncomment the line Include conf/extra/httpd-vhosts.conf
In /etc/httpd/conf/httpd.conf, comment the line:
#LoadModule mpm_event_module modules/mod_mpm_event.so
Uncomment the line:
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
To enable PHP, add these lines to /etc/httpd/conf/httpd.conf at the end of the LoadModule list:
LoadModule php_module modules/libphp.so AddHandler php-script .php
Place this at the end of the Include list:
Step 6: Configure WordPress from Web Console
Open http://mysite.com to start wordpress installation. You should get initial installation page which looks similar to one below.
Provide required information and click on “Install WordPress” button. If all goes well, you should get login page.
Click Log in and provide username and password.
On Login, you should get to wordpress Admin dashboard.
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.
For Multisite refer to our guide below: