What is WordPress?
WordPress is a free and open-source platform for building websites. On a more technical level, WordPress is a PHP-based content management system (CMS) that uses a MySQL database. WordPress is the most user-friendly and powerful blogging and website builder available today.
Important note: According to WPVALID the default WordPress memory limit is 32MB, you need to increase this value if your website has a high volume of posts and traffic.
Find or locate your php.ini file. Create your php.ini file and save it in the root directory of your WordPress installation if you can’t find it.
Search for the line that begins with “memory limit = 32M,” and replace 32M with the appropriate limit (e.g. 256M or 512M).
Step 1 – Install the requirements: PHP, Apache, and MariaDB
dnf install mariadb mariadb-server httpd
dnf install httpd-tools php php-cli php-json php-gd php-mbstring php-pdo php-xml php-mysqlnd php-pecl-zip wget
Step 2 – Start and Enable Apache and MySQL
systemctl start httpd
systemctl enable httpd
systemctl status httpd
[root@node1 ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Drop-In: /usr/lib/systemd/system/httpd.service.d
└─php-fpm.conf
Active: inactive (dead)
Docs: man:httpd.service(8)
[root@node1 ~]# systemctl start httpd
[root@node1 ~]# systemctl enable httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
[root@node1 ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Drop-In: /usr/lib/systemd/system/httpd.service.d
└─php-fpm.conf
Active: active (running) since Thu 2022-08-04 11:03:49 IST; 222ms ago
Docs: man:httpd.service(8)
Main PID: 59343 (httpd)
Status: "Started, listening on: port 80"
Tasks: 195 (limit: 11519)
Memory: 25.1M
CGroup: /system.slice/httpd.service
├─59343 /usr/sbin/httpd -DFOREGROUND
├─59356 /usr/sbin/httpd -DFOREGROUND
├─59362 /usr/sbin/httpd -DFOREGROUND
├─59365 /usr/sbin/httpd -DFOREGROUND
└─59367 /usr/sbin/httpd -DFOREGROUND
Aug 04 11:03:49 node1 systemd[1]: Starting The Apache HTTP Server...
Aug 04 11:03:49 node1 httpd[59343]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::216:3eff:fecb:d422. Set the 'ServerName' directive globally to suppress this message
Aug 04 11:03:49 node1 systemd[1]: Started The Apache HTTP Server.
Aug 04 11:03:49 node1 httpd[59343]: Server configured, listening on: port 80
systemctl start mariadb
systemctl enable mariadb
systemctl status mariadb
[root@node1 ~]# systemctl status mariadb
● mariadb.service - MariaDB 10.3 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2022-08-04 11:04:55 IST; 1s ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Main PID: 59741 (mysqld)
Status: "Taking your SQL requests now..."
Tasks: 30 (limit: 11519)
Memory: 81.6M
CGroup: /system.slice/mariadb.service
└─59741 /usr/libexec/mysqld --basedir=/usr
Aug 04 11:04:55 node1 mysql-prepare-db-dir[59635]: See the MariaDB Knowledgebase at http://mariadb.com/kb or the
Aug 04 11:04:55 node1 mysql-prepare-db-dir[59635]: MySQL manual for more instructions.
Aug 04 11:04:55 node1 mysql-prepare-db-dir[59635]: Please report any problems at http://mariadb.org/jira
Aug 04 11:04:55 node1 mysql-prepare-db-dir[59635]: The latest information about MariaDB is available at http://mariadb.org/.
Aug 04 11:04:55 node1 mysql-prepare-db-dir[59635]: You can find additional information about the MySQL part at:
Aug 04 11:04:55 node1 mysql-prepare-db-dir[59635]: http://dev.mysql.com
Aug 04 11:04:55 node1 mysql-prepare-db-dir[59635]: Consider joining MariaDB's strong and vibrant community:
Aug 04 11:04:55 node1 mysql-prepare-db-dir[59635]: https://mariadb.org/get-involved/
Aug 04 11:04:55 node1 mysqld[59741]: 2022-08-04 11:04:55 0 [Note] /usr/libexec/mysqld (mysqld 10.3.28-MariaDB) starting as process 59741 ...
Aug 04 11:04:55 node1 systemd[1]: Started MariaDB 10.3 database server.
[root@node1 ~]#
Step 3 – Create a MySQL database for WordPress
1. mysql -u root -p (When it ask for a password just hit Enter)
2. CREATE DATABASE wordpress;
3. GRANT ALL ON wordpress.* TO 'wordpress'@'localhost' IDENTIFIED BY 'mysecretpassword';
4. FLUSH PRIVILEGES;
5. quit
NOTE: You should choose a STRONGER password and a different username and database name.
Step 4 – Install WordPress
1. cd /var/www/html
2. wget https://wordpress.org/latest.tar.gz
3. tar xvzf latest.tar.gz
4. rm -rf latest.tar.gz
5. chown -Rf apache:apache ./wordpress/
6. chmod -Rf 775 ./wordpress/
7. ONLY for CentOS 8/RHEL 8 with SELinux: semanage fcontext -a -t httpd_sys_rw_content_t \
"/var/www/html/wordpress(/.*)?"
Step 5 – Create wordpress.conf in the Apache configuration
nano /etc/httpd/conf.d/wordpress.conf (if you don't have nano: dnf install -y nano)
And paste this:
<VirtualHost *:80>
ServerAdmin root@localhost
DocumentRoot /var/www/html/wordpress
<Directory "/var/www/html/wordpress">
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
</Directory>
ErrorLog /var/log/httpd/wordpress_error.log
CustomLog /var/log/httpd/wordpress_access.log common
</VirtualHost>
CTRL + X and Y + Enter to save it
Note: You must restart the Apache server: systemctl restart httpd
Step 6 – Navigate to your WordPress website
Open your favorite browser and navigate to https://server_IP/wordpress/
Choose your language and Continue
Now we have to configure the MySQL database
We need to use the credentials from Step 3 – Create a MySQL database for WordPress, remember?
All right, sparky! You’ve made it through this part of the installation. WordPress can now communicate with your database.
In the final step, choose the site title, username, password and email then hit Install WordPress
1 Comment
How To Install WordPress Using Docker Compose - Virtono Community · June 25, 2023 at 8:22 PM
[…] can access your WordPress site once the containers are up and running by opening a web browser and typing […]