Merge pull request #2043 from paszczus/docs_centos

- updated RHEL/CentOS installation docs
This commit is contained in:
Daniel Preussker
2015-10-06 09:25:39 +00:00

View File

@@ -1,4 +1,4 @@
NOTE: What follows is a very rough list of commands. This works on a fresh install of CentOS 6.4.
NOTE: What follows is a very rough list of commands. This works on a fresh install of CentOS 6.4 and CentOS 7.
NOTE: These instructions assume you are the root user. If you are not, prepend `sudo` to all shell commands (the ones that aren't at `mysql>` prompts) or temporarily become a user with root privileges with `sudo -s`.
@@ -8,6 +8,7 @@ This host is where the MySQL database runs. It could be the same machine as you
> ** Whilst we are working on ensuring LibreNMS is compatible with MySQL strict mode, for now, please disable this after mysql is installed.
**CentOS 6**:
You are free to choose between using MySQL or MariaDB:
**MySQL**
@@ -24,11 +25,30 @@ chkconfig mariadb on
service mariadb start
```
**CentOS 7**
(NOTE: In CentOS 7 there is only mariadb in official repo)
**MariaDB**
```bash
yum install net-snmp mariadb-server mariadb-client
systemctl enable mariadb
systemctl start mariadb
```
Now continue with the installation:
**CentOS 6**
```bash
service snmpd start
chkconfig snmpd on
service snmpd start
mysql_secure_installation
mysql -uroot -p
```
**CentOS 7**
```bash
systemctl enable snmpd
systemctl start snmpd
mysql_secure_installation
mysql -uroot -p
```
@@ -69,22 +89,43 @@ Install necessary software. The packages listed below are an all-inclusive list
Note if not using HTTPd (Apache): RHEL requires `httpd` to be installed regardless of of `nginx`'s (or any other web-server's) presence.
**CentOS 6**
```bash
yum install epel-release
yum install php php-cli php-gd php-mysql php-snmp php-pear php-curl httpd net-snmp graphviz graphviz-php mysql ImageMagick jwhois nmap mtr rrdtool MySQL-python net-snmp-utils vixie-cron php-mcrypt fping git
pear install Net_IPv4-1.3.4
pear install Net_IPv6-1.2.2b2
```
### Adding the librenms-user ###
**CentOS 7**
```bash
yum install php php-cli php-gd php-mysql php-snmp php-pear php-curl httpd net-snmp graphviz graphviz-php mariadb ImageMagick jwhois nmap mtr rrdtool MySQL-python net-snmp-utils vixie-cron php-mcrypt fping git
pear install Net_IPv4-1.3.4
pear install Net_IPv6-1.2.2b2
```
### Adding the librenms-user for Apache ###
```bash
useradd librenms -d /opt/librenms -M -r
usermod -a -G librenms apache
```
### Adding the librenms-user for Nginx ###
```bash
useradd librenms -d /opt/librenms -M -r
usermod -a -G librenms nginx
```
### Using HTTPd (Apache2) ###
Set `httpd` to start on system boot.
**CentOS 6**
chkconfig --levels 235 httpd on
**CentOS 7**
systemctl enable httpd
Next, add the following to `/etc/httpd/conf.d/librenms.conf`
```apache
@@ -109,14 +150,25 @@ If the file `/etc/httpd/conf.d/welcome.conf` exists, you might want to remove th
Install necessary extra software and let it start on system boot.
**CentOS 6**
```bash
yum install nginx php-fpm
chkconfig nginx on
chkconfig php-fpm on
```
**CentOS 7**
```bash
yum install nginx php-fpm
systemctl enable nginx
systemctl enable php-fpm
```
Modify permissions and configuration for `php-fpm` to use nginx credentials.
mkdir /var/lib/php/session
chown root:nginx /var/lib/php -R
vi /etc/php-fpm.d/www.conf # At line #12: Change `listen` to `/var/run/php5-fpm.sock`
vim /etc/php-fpm.d/www.conf # At line #12: Change `listen` to `/var/run/php5-fpm.sock`
# At line #39-41: Change the `user` and `group` to `nginx`
Add configuration for `nginx` at `/etc/nginx/conf.d/librenms.conf` with the following content:
@@ -151,15 +203,19 @@ server {
You can clone the repository via HTTPS or SSH. In either case, you need to ensure the appropriate port (443 for HTTPS, 22 for SSH) is open in the outbound direction for your server.
```bash
cd /opt
git clone https://github.com/librenms/librenms.git librenms
cd /opt/librenms
```
At this stage you can either launch the web installer by going to http://IP/install.php, follow the on-screen instructions then skip to the 'Web Interface' section further down. Alternatively if you want
to continue the setup manually then just keep following these instructions.
```bash
cp config.php.default config.php
vim config.php
```
NOTE: The recommended method of cloning a git repository is HTTPS. If you would like to clone via SSH instead, use the command `git clone git@github.com:librenms/librenms.git librenms` instead.
@@ -193,24 +249,53 @@ To prepare the web interface (and adding devices shortly), you'll need to create
First, create and chown the `rrd` directory and create the `logs` directory
```bash
mkdir rrd logs
chown -R librenms:librenms /opt/librenms
chmod 775 rrd
# For HTTPd (Apache):
chown apache:apache logs
# For Nginx:
chown nginx:nginx logs
chmod 775 rrd
```
> If you're planing on running rrdcached, make sure that the path is also chmod'ed to 775 and chown'ed to librenms:librenms.
**SELinux**
> if you're using SELinux you need to allow web server user to write into logs directory.
> semanage tool is a part of policycoreutils-python, so if don't have it, you can install it
> **Please note that running LibreNMS with SELinux is still experimental and we cannot guarantee that everything will be working fine for now.**
```bash
yum install policycoreutils-python
```
```bash
semanage fcontext -a -t httpd_sys_content_t '/opt/librenms/logs(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/opt/librenms/logs(/.*)?'
restorecon -RFvv /opt/librenms/logs/
```
Start the web-server:
**CentOS 6**
# For HTTPd (Apache):
service httpd restart
# For Nginx:
service nginx restart
**CentOS 7**
# For HTTPd (Apache):
systemctl restart httpd
# For Nginx:
systemctl restart nginx
### Add localhost ###
php addhost.php localhost public v2c