Improve CentOS 7 install instructions (#10477)

* Improve instructions

Documentation when open_basedir is set
Also gives list of packages when installing php-fpm
Fixes cron and logrotate files not being executed if umask is set

* Split dependencies universal / php

* Updated php doc

* Add more binaries to open_basedir
This commit is contained in:
Orsiris de Jong
2019-09-18 16:59:20 +02:00
committed by Tony Murray
parent d5b61002cc
commit a0c2df6cd9

View File

@@ -8,18 +8,55 @@ path: blob/master/doc/
**Please note the minimum supported PHP version is 7.1.3** **Please note the minimum supported PHP version is 7.1.3**
# Install Required Packages
## Install Common Required Packages ##
``` ```
yum install epel-release yum install epel-release
``` ```
```
yum install git cronie fping jwhois ImageMagick mtr MySQL-python MySQL-python net-snmp net-snmp-utils nmap python-memcached rrdtool policycoreutils-python httpd mariadb mariadb-server unzip
```
### Install PHP
CentOS 7 comes with php 5.4 which is not compatible with LibreNMS.
There are multiple ways to install php 7.x on CentOS 7, like Webtatic, Remi or SCL, the last two are maintained by Remi Collet of RedHat.
#### Running with Remi PHP
```
yum localinstall http://rpms.remirepo.net/enterprise/remi-release-7.rpm
```
```
yum install composer php73-php-fpm php73-php-cli php73-php-common php73-php-curl php73-php-gd php73-php-mbstring php73-php-process php73-php-snmp php73-php-xml php73-php-zip php73-php-memcached php73-php-mysqlnd
```
#### Running with Webtatic PHP
``` ```
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
``` ```
``` ```
yum install composer cronie fping git httpd ImageMagick jwhois mariadb mariadb-server mtr MySQL-python net-snmp net-snmp-utils nmap php72w php72w-cli php72w-common php72w-curl php72w-gd php72w-mbstring php72w-mysqlnd php72w-process php72w-snmp php72w-xml php72w-zip python-memcached rrdtool yum install composer php73w php73w-cli php73w-common php73w-curl php73w-gd php73w-mbstring php73w-mysqlnd php73w-process php73w-snmp php73w-xml php73w-zip
```
#### Running with CentOS SCL php
```
yum install centos-release-scl
```
```
yum install rh-php72-php-fpm rh-php72-php-cli rh-php72-php-common rh-php72-php-curl rh-php72-php-gd rh-php72-php-mbstring rh-php72-php-process rh-php72-php-snmp rh-php72-php-xml rh-php72-php-zip rh-php72-php-memcached rh-php72-php-mysqlnd
```
```
ln -s /opt/rh/rh-php72/root/usr/bin/php /usr/bin/php
``` ```
# Add librenms user # Add librenms user
@@ -41,8 +78,8 @@ git clone https://github.com/librenms/librenms.git
``` ```
chown -R librenms:librenms /opt/librenms chown -R librenms:librenms /opt/librenms
chmod 770 /opt/librenms chmod 770 /opt/librenms
setfacl -d -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/ setfacl -d -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/ /opt/librenms/cache
setfacl -R -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/ setfacl -R -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/ /opt/librenms/cache
``` ```
# Install PHP dependencies # Install PHP dependencies
@@ -97,10 +134,24 @@ See <http://php.net/manual/en/timezones.php> for a list of supported
timezones. Valid examples are: "America/New_York", timezones. Valid examples are: "America/New_York",
"Australia/Brisbane", "Etc/UTC". "Australia/Brisbane", "Etc/UTC".
When PHP is configured with open_basedir, be sure to allow the following paths for LibreNMS to work:
```
php_admin_value[open_basedir] = /opt/librenms:/usr/lib64/nagios/plugins:/dev/urandom:/usr/sbin/fping:/usr/sbin/fping6:/usr/bin/snmpgetnext:/usr/bin/rrdtool:/usr/bin/snmpwalk:/usr/bin/snmpget:/usr/bin/snmpbulkwalk:/usr/bin/snmptranslate:/usr/bin/traceroute:/usr/bin/whois:/bin/ping:/usr/sbin/mtr:/usr/bin/nmap:/usr/sbin/ipmitool:/usr/bin/virsh:/usr/bin/nfdump"
```
``` ```
vi /etc/php.ini vi /etc/php.ini
``` ```
or
```
vi /etc/opt/rh/rh-php72/php.ini
```
## Configure Apache ## Configure Apache
Create the librenms.conf: Create the librenms.conf:
@@ -156,9 +207,18 @@ restorecon -RFvv /opt/librenms/storage/
semanage fcontext -a -t httpd_sys_content_t '/opt/librenms/bootstrap/cache(/.*)?' semanage fcontext -a -t httpd_sys_content_t '/opt/librenms/bootstrap/cache(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/opt/librenms/bootstrap/cache(/.*)?' semanage fcontext -a -t httpd_sys_rw_content_t '/opt/librenms/bootstrap/cache(/.*)?'
restorecon -RFvv /opt/librenms/bootstrap/cache/ restorecon -RFvv /opt/librenms/bootstrap/cache/
semanage fcontext -a -t httpd_sys_content_t '/opt/librenms/cache(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/opt/librenms/cache(/.*)?'
restorecon -RFvv /var/www/opt/librenms/cache/
setsebool -P httpd_can_sendmail=1 setsebool -P httpd_can_sendmail=1
``` ```
Additional SELinux problems may be found by executing the following command
```
audit2why < /var/log/audit/audit.log
```
# Allow fping # Allow fping
Create the file http_fping.tt with the following contents. You can Create the file http_fping.tt with the following contents. You can