Install OS: Difference between revisions

From MyLVS
Jump to navigation Jump to search
Line 83: Line 83:
Please run the following to set permissions for www-data:
Please run the following to set permissions for www-data:
  root@mylvs01:# chown www-data /var/www/mylvs -R
  root@mylvs01:# chown www-data /var/www/mylvs -R
==Main configuration==
*/etc/mylvs/mylvs.conf.xml
<?xml version="1.0"?>
<CONFIG>
  <!-- LVS1 SQL Config!-->
  <SQLServer Address="127.0.0.1" Database="mylvs" User="mylvsuser" Password="demo" />
  <!-- LVS2 SQL Config!-->
  <SQLServerBackup Enabled="0" Address="" Database="" User="" Password="" ReplCommand="no-sample-available-yet" />
  <!-- SQL Configuration Backup !-->
  <SQLConfigBackup Path="/var/www/mylvs/backup/" RestoreApp="/var/www/mylvs/scripts/mkrestore.sh" BackupApp="/var/www/mylvs/scripts/mkbackup.sh"/>
  <!-- LVS General command string - add sudo to support appache!-->
  <LVS Command="/usr/bin/sudo /sbin/ipvsadm"  />
  <!-- Color set which is used within the webinterface!-->
  <ShowAmount ActiveWarning="200" InActiveWarning="2000" HTTP_ERR="120" HTTP_WARN="80" MaxConCount="1000"/>
  <!-- Operation mode for testing!-->
  <Operation WebSimulate="0" MonSimulate="0"/>
  <!-- Used within the connection view, support whois and nmap which is needed to be installed!-->
  <Information host="/usr/bin/sudo /usr/bin/host" nmap="/usr/bin/sudo /usr/bin/nmap -sS -O -v" />
  <!-- General mailing information if not given somewhere else used by the lvs monitor!-->
  <Operator Mailserver="mail.mylvs.com" Mailfrom="lvsmon@mylvs.com" MailTo="postmaster@mylvs.com" MailCC="anybody@domain.com" MailBCC=""/>
  <!-- Daily operations!-->
  <Maintenance FileAge="5" SQLAge="5"/>
  <!-- Web styles/moudules!-->
  <Modules Path="/usr/local/lvs/wwwroot/modules/"/>
  <!-- Exlude addresses from the connection view!-->
  <StatusView SupressedAddress=""/>
    <!-- View Options!-->
  <View HTMLLVSOutput="0"/>
  <!-- Log Options!-->
  <Log Name="mylvslog.log" Path="/var/log/mylvs/" gzip="/bin/gzip" Days="24"/>
  <!-- Customize Logo!-->
  <Logo Path="/images/Linux_Logo.gif" />
</CONFIG>

Revision as of 20:31, 22 August 2015


Install

Sample for Debian 8:

  • Default installation
    • Choose package Web server
    • Choose package SSh server

Packages

MySQL

apt-get install mysql-server-5.5

Perl Core

core modules

apt-get install libnet-snmp-perl libxml-simple-perl libmail-sendmail-perl
libnet-whois-raw-perl

for monitoring purposes:

apt-get install nagios-plugins-standard

other

 apt-get install libdatetime-perl

Apache Perl CGI

apt-get install libapache2-mod-fcgid libcgi-fast-perl 
apt-get install libcgi-pm-perl libcgi-session-perl 
apt-get install libfcgi-perl libfcgi0ldbl


Enable CGI

a2enmod cgi

Apache additional

apt-get install libnet-snmp-perl libxml-simple-perl


SUDO

Sudo is required to run commands from apache

apt-get install sudo
  • visudo -f /etc/sudoers
www-data ALL=NOPASSWD: /sbin/ipvsadm
www-data ALL=NOPASSWD: /usr/bin/nmap
www-data ALL=NOPASSWD: /var/wwwl/mylvs/repl.sh
www-data ALL=NOPASSWD: /usr/local/nagios/libexec/check_nrpe
www-data ALL=NOPASSWD: /var/www/mylvs/scripts/mkbackup.sh
www-data ALL=NOPASSWD: /var/www/mylvs/scripts/mkbackupcomment.sh
www-data ALL=NOPASSWD: /usr/bin/mysqldump
www-data ALL=NOPASSWD: /usr/bin/mysql
www-data ALL=NOPASSWD: /bin/echo
www-data ALL=NOPASSWD: /var/www/mylvs/scripts/mkbackup.sh
www-data ALL=NOPASSWD: /var/www/mylvs/scripts/mkrestore.sh
www-data ALL=NOPASSWD: /var/www/mylvs/scripts/reboot.sh


Note: The above commands represents all possible myLVS functions even if the scripts are not setup at this time.


Permissions

=> make me look nice Make sure to have this:

root@mylvs01:/var/www/mylvs# ls -all
total 124
drwxr-xr-x 6 www-data root  4096 Aug 22 14:14 .
drwxr-xr-x 4 root     root  4096 Jun 12 14:48 ..
drwxr-xr-x 2 www-data root  4096 Aug 22 15:27 backup
-rw-r--r-- 1 www-data root   229 Feb  9  2015 LEGAL
-rwxr-xr-x 1 root     demo  3828 Aug 18 13:25 mylvsinit.pl
-rwxr-xr-x 1 root     demo 92370 Aug 18 13:30 mylvsmon.pl
drwxr-xr-x 2 www-data root  4096 Aug 22 14:59 scripts
drwxr-xr-x 4 www-data root  4096 Feb  9  2015 ws
drwxr-xr-x 4 www-data root  4096 Aug 22 14:10 wwwroot
root@mylvs01:/var/www/mylvs#

Please run the following to set permissions for www-data:

root@mylvs01:# chown www-data /var/www/mylvs -R


Main configuration

  • /etc/mylvs/mylvs.conf.xml
<?xml version="1.0"?>
<CONFIG>
  <SQLServer Address="127.0.0.1" Database="mylvs" User="mylvsuser" Password="demo" />
  <SQLServerBackup Enabled="0" Address="" Database="" User="" Password="" ReplCommand="no-sample-available-yet" />
  <SQLConfigBackup Path="/var/www/mylvs/backup/" RestoreApp="/var/www/mylvs/scripts/mkrestore.sh" BackupApp="/var/www/mylvs/scripts/mkbackup.sh"/>
  <LVS Command="/usr/bin/sudo /sbin/ipvsadm"  />
  <ShowAmount ActiveWarning="200" InActiveWarning="2000" HTTP_ERR="120" HTTP_WARN="80" MaxConCount="1000"/>
  <Operation WebSimulate="0" MonSimulate="0"/>
  <Information host="/usr/bin/sudo /usr/bin/host" nmap="/usr/bin/sudo /usr/bin/nmap -sS -O -v" />
  <Operator Mailserver="mail.mylvs.com" Mailfrom="lvsmon@mylvs.com" MailTo="postmaster@mylvs.com" MailCC="anybody@domain.com" MailBCC=""/>
  <Maintenance FileAge="5" SQLAge="5"/>
  <Modules Path="/usr/local/lvs/wwwroot/modules/"/>
  <StatusView SupressedAddress=""/>
  <View HTMLLVSOutput="0"/>
  <Log Name="mylvslog.log" Path="/var/log/mylvs/" gzip="/bin/gzip" Days="24"/>
  <Logo Path="/images/Linux_Logo.gif" />
</CONFIG>