Skip to content

Commit dee6a8f

Browse files
docs: fix SELinux policy guidance and add CentOS EOL notices
Refs #209 Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
1 parent c707c76 commit dee6a8f

4 files changed

Lines changed: 152 additions & 68 deletions

File tree

Lines changed: 55 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Installing on CentOS/RHEL/ROCKY
1+
# Installing on CentOS/RHEL/Rocky Linux/AlmaLinux
2+
3+
> **Note:** CentOS Linux reached end-of-life on June 30, 2024 (CentOS 7) and December 31, 2021 (CentOS 8). New installations should use [Rocky Linux](https://rockylinux.org/) or [AlmaLinux](https://almalinux.org/), which are binary-compatible RHEL rebuilds. The commands in this guide apply to both.
24
35
> **Note**: As of Cacti 1.2.31, PHP 8.1 is required and PHP Composer is required.
46
> Composer will be used to ensure all of the libraries are installed and are up to date.
@@ -7,7 +9,7 @@
79

810
### Web Server (Apache)
911

10-
1. For Centos/RHEL/ROCKY 8+
12+
1. For RHEL/Rocky Linux/AlmaLinux 8+
1113

1214
```console
1315
dnf module reset php
@@ -47,13 +49,13 @@ Daemon to rebuild the Cache or you may receive a HTTP 500 Error
4749
systemctl restart php-fpm
4850
```
4951

50-
2.Install Apache
52+
2. Install Apache
5153

5254
```console
53-
yum install -y httpd
55+
dnf install -y httpd
5456
```
5557

56-
3.Enable and start the service to ensure it starts when the system reboots
58+
3. Enable and start the service to ensure it starts when the system reboots
5759

5860
```console
5961
systemctl start httpd
@@ -156,7 +158,7 @@ bridged.
156158
1. Install MySQL server
157159

158160
```console
159-
yum install -y mysql mysql-server
161+
dnf install -y mysql mysql-server
160162
```
161163

162164
2. Enable and start the service to ensure it starts when the system reboots
@@ -171,7 +173,7 @@ bridged.
171173
1. Install MariaDB server
172174

173175
```console
174-
yum install -y MariaDB-server MariaDB-client
176+
dnf install -y MariaDB-server MariaDB-client
175177
```
176178

177179
2. Enable and start the service to ensure it starts when the system reboots
@@ -211,13 +213,10 @@ during the installation.
211213
[mysqld]
212214
character-set-server=utf8mb4
213215
collation-server=utf8mb4_unicode_ci
214-
innodb_file_format = Barracuda
215216
max_allowed_packet = 16777777
216217
join_buffer_size = 32M
217218
innodb_file_per_table = ON
218-
innodb_large_prefix = 1
219219
innodb_buffer_pool_size = 250M
220-
innodb_additional_mem_pool_size = 90M
221220
innodb_flush_log_at_trx_commit = 2
222221
log-error = /var/log/mysql/mysql-error.log
223222
log-queries-not-using-indexes = 1
@@ -308,7 +307,7 @@ PHP and various packages are all required by Cacti for successful operation
308307
1. Install PHP and required packages.
309308

310309
```console
311-
yum install -y php php-common php-bcmath php-cli \
310+
dnf install -y php php-common php-bcmath php-cli \
312311
php-mysqlnd php-gd php-gmp php-intl \
313312
php-json php-ldap php-mbstring \
314313
php-pdo php-pear php-snmp php-process \
@@ -329,15 +328,15 @@ RRDtool is required to store the data retrieved from devices in `.rra` files to
329328
produce the graphs which are shown within Cacti
330329

331330
```console
332-
yum install -y rrdtool
331+
dnf install -y rrdtool
333332
```
334333

335334
#### SNMP
336335

337336
SNMP is used to query most devices for information.
338337

339338
```console
340-
yum install -y net-snmp net-snmp-utils
339+
dnf install -y net-snmp net-snmp-utils
341340
```
342341

343342
### Cacti
@@ -413,17 +412,22 @@ configure the basics for Cacti.
413412

414413
1. Install the necessary packages to compile and install spine
415414

416-
For RHEL/CENTOS/ROCKY 8+, you must enable the powertools repo first before
417-
downloading the below packages
415+
On RHEL 8 / Rocky Linux 8 / AlmaLinux 8, enable the PowerTools repository first:
416+
417+
```console
418+
dnf config-manager --set-enabled powertools
419+
```
420+
421+
On RHEL 9 / Rocky Linux 9 / AlmaLinux 9, the equivalent repository is called `crb`:
418422

419423
```console
420-
yum config-manager --set-enabled powertools
424+
dnf config-manager --set-enabled crb
421425
```
422426

423-
For RHEL/CENTOS/ROCKY 7.x and below
427+
Then install the build dependencies:
424428

425429
```console
426-
yum install -y autoconf automake libtool dos2unix help2man \
430+
dnf install -y autoconf automake libtool dos2unix help2man \
427431
openssl-devel mariadb-devel net-snmp-devel
428432
```
429433

@@ -478,31 +482,56 @@ configure the basics for Cacti.
478482

479483
### Security Enhanced Linux (SELinux)
480484

481-
If you are having issues to access the web page, disable SELinux temporarily to
482-
prove that the issues come from the SELinux policy. It is NOT recommended to
483-
disable SELinux permanently.
485+
If you suspect SELinux is blocking Cacti, disable it temporarily to confirm, then re-enable it and apply the correct policy rather than leaving it disabled.
484486

485-
[CentOS](https:////wiki.centos.org/es/HowTos/SELinux) has a lot of
486-
documentation on how to make your SELinux policy right.
487+
The [RHEL SELinux documentation](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/using_selinux/) covers policy management in depth and applies equally to Rocky Linux and AlmaLinux.
487488

488489
1. Check SELinux status
489490

490491
```console
491492
getenforce
492493
```
493494

494-
2. Disable SELinux temporarily
495+
2. Disable SELinux temporarily for testing
495496

496497
```console
497498
setenforce 0
498499
```
499500

500-
3. Enable SELinux back
501+
3. Re-enable SELinux
501502

502503
```console
503504
setenforce 1
504505
```
505506

507+
4. Configure SELinux booleans for Cacti
508+
509+
Cacti requires two booleans so Apache can reach the database and make outbound SNMP connections during polling:
510+
511+
```console
512+
setsebool -P httpd_can_network_connect 1
513+
setsebool -P httpd_can_network_connect_db 1
514+
```
515+
516+
5. Set file contexts (only needed if Cacti is outside `/var/www/html`)
517+
518+
If you installed Cacti to a non-default path, apply the correct SELinux file contexts. The `semanage` command is provided by `policycoreutils-python-utils`; install it first if not already present:
519+
520+
```console
521+
dnf install -y policycoreutils-python-utils
522+
```
523+
524+
Replace `/path/to/cacti` with your actual install path:
525+
526+
```console
527+
semanage fcontext -a -t httpd_sys_content_t "/path/to/cacti(/.*)?"
528+
semanage fcontext -a -t httpd_sys_rw_content_t "/path/to/cacti/rra(/.*)?"
529+
semanage fcontext -a -t httpd_sys_rw_content_t "/path/to/cacti/log(/.*)?"
530+
restorecon -Rv /path/to/cacti
531+
```
532+
533+
These labels grant Apache read access to Cacti's files and write access to the RRD and log directories. Without `httpd_sys_rw_content_t` on `rra/` and `log/`, graph generation silently fails even when UNIX permissions appear correct.
534+
506535
### Considerations when using Proxies in front of Cacti (Cacti 1.2.23+)
507536

508537
For optimal security, only specify the HTTP headers that are set by your proxy
@@ -536,8 +565,7 @@ These can be set by editing the following section of config.php
536565
$proxy_headers = null;
537566
```
538567

539-
**Note:** If you installed Cacti out of `/var/www/html` make sure you fix up
540-
all SELinux context and permissions.
568+
**Note:** If you installed Cacti outside `/var/www/html`, run the `semanage fcontext` and `restorecon` commands from step 5 of the SELinux section above to apply the correct file contexts.
541569

542570
---
543571
Copyright (c) 2004-2026 The Cacti Group

0 commit comments

Comments
 (0)