This Blog is about new technologies, Linux, Sysadmin, Devops, Programming, AWS, Cloud platforms, HP, Hardware, Tech news, Networking, How tos, Configurations, Apache, PHP, Java, Kubernetes, Docker, Openstack, MySQL,
Tuesday, October 23, 2018
Monday, October 22, 2018
Installing nagios NRPE on AWS EC2
yum install nagios-plugins-all nagios-plugins-nrpe nrpe
chkconfig nrpe on
update the config by checking allowed_hosts and
vi /etc/nagios/nrpe.cfg
sudo /etc/init.d/nrpe start
How to install Nagios on AWS
Prerequisites
=========
* Apache
* PHP
* GCC compiler
* GD development libraries
Steps
====
sudo yum install httpd php
sudo yum install gcc glibc glibc-common
sudo yum install gd gd-devel
Create Users
=========
sudo adduser -m nagios
sudo passwd nagios
sudo groupadd nagcmd
sudo usermod -a -G nagcmd nagios
sudo usermod -a -G nagcmd apache
Download Nagios Core
=================
mkdir ~/downloads
cd ~/downloads
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.8.tar.gz
wget http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz
Compile and Install Nagios
====================
tar zxvf nagios-4.0.8.tar.gz
cd nagios-4.0.8
./configure --with-command-group=nagcmd
make all
sudo make install
sudo make install-init
sudo make install-config
sudo make install-commandmode
Customize Configuration
==================
Sample configuration files have now been installed in the /usr/local/nagios/etc directory. These sample files should work fine for getting started with Nagios. You'll need to make just one change before you proceed...
Edit the /usr/local/nagios/etc/objects/contacts.cfg config file with your favorite editor and change the email address associated with the nagiosadmin contact definition to the address you'd like to use for receiving alerts.
sudo vim /usr/local/nagios/etc/objects/contacts.cfg
Configure the Web Interface
====================
Install the Nagios web config file in the Apache conf.d directory.
sudo make install-webconf
Create a nagiosadmin account for logging into the Nagios web interface. Remember the password you assign to this account - you'll need it later.
sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Type the new password twice. Restart Apache to make the new settings take effect.
sudo service httpd restart
Compile and Install the Nagios Plugins
============================
cd ~/downloads
tar zxvf nagios-plugins-2.0.3.tar.gz
cd nagios-plugins-2.0.3
Compile and install the plugins.
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
sudo make install
Start Nagios
=========
sudo chkconfig --add nagios
sudo chkconfig nagios on
Verify the sample Nagios configuration files.
sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
If there are no errors, start Nagios.
sudo service nagios start
Enable 80 port in AWS
=================
* From the EC2 console select Security Groups from the left navigation pane.
* Select the Security Group applicable for the instance that Nagios was installed on and open the Inbound tab
* If there is no rule to allow HTTP traffic on port 80 then click edit in the Inbound tab to add a new rule
* Click on New Rule button
* Scroll down to select HTTP from the list under Type
* If you want to be able to access nagios from anywhere then select Save, otherwise enter the IP address or range of IP address you want to be able to access it from then select Save.
Access Nagios
===========
http://ec2-xx-xxx-xxx-xx.ap-southeast-2.compute.amazonaws.com/nagios/
=========
* Apache
* PHP
* GCC compiler
* GD development libraries
Steps
====
sudo yum install httpd php
sudo yum install gcc glibc glibc-common
sudo yum install gd gd-devel
Create Users
=========
sudo adduser -m nagios
sudo passwd nagios
sudo groupadd nagcmd
sudo usermod -a -G nagcmd nagios
sudo usermod -a -G nagcmd apache
Download Nagios Core
=================
mkdir ~/downloads
cd ~/downloads
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.8.tar.gz
wget http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz
Compile and Install Nagios
====================
tar zxvf nagios-4.0.8.tar.gz
cd nagios-4.0.8
./configure --with-command-group=nagcmd
make all
sudo make install
sudo make install-init
sudo make install-config
sudo make install-commandmode
Customize Configuration
==================
Sample configuration files have now been installed in the /usr/local/nagios/etc directory. These sample files should work fine for getting started with Nagios. You'll need to make just one change before you proceed...
Edit the /usr/local/nagios/etc/objects/contacts.cfg config file with your favorite editor and change the email address associated with the nagiosadmin contact definition to the address you'd like to use for receiving alerts.
sudo vim /usr/local/nagios/etc/objects/contacts.cfg
Configure the Web Interface
====================
Install the Nagios web config file in the Apache conf.d directory.
sudo make install-webconf
Create a nagiosadmin account for logging into the Nagios web interface. Remember the password you assign to this account - you'll need it later.
sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Type the new password twice. Restart Apache to make the new settings take effect.
sudo service httpd restart
Compile and Install the Nagios Plugins
============================
cd ~/downloads
tar zxvf nagios-plugins-2.0.3.tar.gz
cd nagios-plugins-2.0.3
Compile and install the plugins.
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
sudo make install
Start Nagios
=========
sudo chkconfig --add nagios
sudo chkconfig nagios on
Verify the sample Nagios configuration files.
sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
If there are no errors, start Nagios.
sudo service nagios start
Enable 80 port in AWS
=================
* From the EC2 console select Security Groups from the left navigation pane.
* Select the Security Group applicable for the instance that Nagios was installed on and open the Inbound tab
* If there is no rule to allow HTTP traffic on port 80 then click edit in the Inbound tab to add a new rule
* Click on New Rule button
* Scroll down to select HTTP from the list under Type
* If you want to be able to access nagios from anywhere then select Save, otherwise enter the IP address or range of IP address you want to be able to access it from then select Save.
Access Nagios
===========
http://ec2-xx-xxx-xxx-xx.ap-southeast-2.compute.amazonaws.com/nagios/
Monday, September 8, 2014
How to install Redmine
===============================================================
Install the dependencies packages
===============================================================
yum -y install nano zip unzip libyaml-devel zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel mysql-devel gcc ruby-devel gcc-c++ make postgresql-devel ImageMagick-devel sqlite-devel perl-LDAP mod_perl perl-Digest-SHA
===============================================================
Install Apache and MySQL
===============================================================
yum -y install httpd mysql mysql-server
chkconfig httpd on
chkconfig mysqld on
service httpd start
service mysqld start
/usr/bin/mysql_secure_installation
===============================================================
Turn off SELinux
===============================================================
vim /etc/selinux/config
SELINUX=disabled
===============================================================
Set up the Hostname
===============================================================
vim /etc/hosts
===============================================================
Disable IPTALBES
===============================================================
/etc/init.d/iptables stop
/etc/init.d/ip6tables stop
chkconfig iptables off
chkconfig ip6tables off
reboot
===============================================================
Install PHP and phpMyAdmin
===============================================================
yum -y install php php-mysql php-gd php-imap php-ldap php-mbstring php-odbc php-pear php-xml php-xmlrpc php-pecl-apc php-soap
service httpd restart
rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
yum -y install phpmyadmin
vim /etc/httpd/conf.d/phpmyadmin.conf
change "Allow from 127.0.0.1" to "Allow from all"
vim /usr/share/phpmyadmin/config.inc.php
Replace text :
$cfg['Servers'][$i]['auth_type'] = 'cookie';
To :
$cfg['Servers'][$i]['auth_type'] = 'http';
service httpd restart
vim /etc/httpd/conf.d/phpmyadmin.conf
<VirtualHost *:8081>
DocumentRoot /usr/share/phpmyadmin/
ServerName costi02
</VirtualHost>
vim /etc/httpd/conf/httpd.conf
add
Listen 8081
service httpd restart
http://localhost:8081
==================================================================
Install Ruby
==================================================================
curl -L https://get.rvm.io | bash
source /etc/profile.d/rvm.sh
rvm list known
rvm install 1.9.3
ruby -v
==================================================================
Install Rubygems
==================================================================
yum -y install rubygems
==================================================================
Install Passenger
==================================================================
gem install passenger
passenger-install-apache2-module
vim /etc/httpd/conf.d/passenger.conf
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p545/gems/passenger-4.0.37/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p545/gems/passenger-4.0.37
PassengerDefaultRuby /usr/local/rvm/gems/ruby-1.9.3-p545/wrappers/ruby
</IfModule>
service httpd restart
=================================================================
Create Database for Redmine
=================================================================
mysql --user=root --password=omnibis
create database redmine_db character set utf8;
create user 'redmine_admin'@'localhost' identified by 'redadmin';
grant all privileges on redmine_db.* to 'redmine_admin'@'localhost';
quit;
================================================================
Install Redmine
================================================================
cd /var/www
wget http://www.redmine.org/releases/redmine-2.5.0.tar.gz
tar xvfz redmine-2.5.0.tar.gz
mv redmine-2.5.0 redmine
rm -rf redmine-2.5.0.tar.gz
cd /var/www/redmine/config
cp database.yml.example database.yml
vim database.yml
================================================================
Setting up Rails
================================================================
cd /var/www/redmine
gem install bundler
bundle install
rake generate_secret_token
RAILS_ENV=production rake db:migrate
RAILS_ENV=production rake redmine:load_default_data
================================================================
Activate FCGI
================================================================
cd /var/www/redmine/public
mkdir plugin_assets
cp dispatch.fcgi.example dispatch.fcgi
cp htaccess.fcgi.example .htaccess
================================================================
Setting up Apache and FastCGI
================================================================
cd /var/www/
rpm --import https://fedoraproject.org/static/0608B895.txt
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
yum -y install mod_fcgid
rm -rf epel-release-6-8.noarch.rpm
=================================================================
Creating Files Directory
=================================================================
mkdir -p /opt/redmine/files
chown -R apache:apache /opt/redmine
cd /var/www/redmine/config
cp configuration.yml.example configuration.yml
vim configuration.yml
Enter the directory path containing the data files you just created in the previous step into the line "attachments_storage_path".
Note: You must add a space at the begin of the path "/opt/redmine/files" after character ":"
=================================================================
Configuring Email
=================================================================
vim /var/www/redmine/config/configuration.yml
email_delivery:
delivery_method: :sendmail
For GMAIL
email_delivery:
delivery_method: :smtp
smtp_settings:
enable_starttls_auto: true
address: "smtp.gmail.com"
port: 587
domain: "smtp.gmail.com"
authentication: :plain
user_name: "your_email@gmail.com"
password: "your_password"
=================================================================
Create Virtual Host for Redmine
=================================================================
vim /etc/httpd/conf.d/redmine.conf
<VirtualHost *:80>
ServerName your_domain
ServerAdmin your_domain@domain.com
DocumentRoot /var/www/redmine/public/
ErrorLog logs/redmine_error_log
<Directory "/var/www/redmine/public/">
Options Indexes ExecCGI FollowSymLinks
Order allow,deny
Allow from all
AllowOverride all
</Directory>
</VirtualHost>
==================================================================
Running Redmine
==================================================================
cd /var/www
chown -R apache:apache redmine
chmod -R 755 redmine
service httpd restart
==================================================================
Install Subversion
==================================================================
mkdir -p /opt/repositories/svn
chown -R apache:apache /opt/repositories/
chmod 0755 /opt/repositories
yum install mod_dav_svn subversion subversion-ruby
mkdir /usr/lib64/perl5/vendor_perl/Apache
ln -s /var/www/redmine/extra/svn/Redmine.pm /usr/lib64/perl5/vendor_perl/Apache/Redmine.pm
vim /etc/httpd/conf.d/subversion.conf
PerlLoadModule Apache::Redmine
<Location /svn>
DAV svn
SVNParentPath "/opt/repositories/svn"
SVNListParentPath on
Order deny,allow
Deny from all
Satisfy any
LimitXMLRequestBody 0
SVNPathAuthz off
PerlAccessHandler Apache::Authn::Redmine::access_handler
PerlAuthenHandler Apache::Authn::Redmine::authen_handler
AuthType Basic
AuthName "Subversion Repository"
Require valid-user
RedmineDSN "DBI:mysql:database=redmine_db;host=localhost:3306"
RedmineDbUser "redmine_admin"
RedmineDbPass "your_password_database_redmine"
</Location>
==================================================================
Install Sample DATA
==================================================================
If you change any db keep mind to do following
cd /var/www/redmine
RAILS_ENV=production rake db:migrate
Install the dependencies packages
===============================================================
yum -y install nano zip unzip libyaml-devel zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel mysql-devel gcc ruby-devel gcc-c++ make postgresql-devel ImageMagick-devel sqlite-devel perl-LDAP mod_perl perl-Digest-SHA
===============================================================
Install Apache and MySQL
===============================================================
yum -y install httpd mysql mysql-server
chkconfig httpd on
chkconfig mysqld on
service httpd start
service mysqld start
/usr/bin/mysql_secure_installation
===============================================================
Turn off SELinux
===============================================================
vim /etc/selinux/config
SELINUX=disabled
===============================================================
Set up the Hostname
===============================================================
vim /etc/hosts
===============================================================
Disable IPTALBES
===============================================================
/etc/init.d/iptables stop
/etc/init.d/ip6tables stop
chkconfig iptables off
chkconfig ip6tables off
reboot
===============================================================
Install PHP and phpMyAdmin
===============================================================
yum -y install php php-mysql php-gd php-imap php-ldap php-mbstring php-odbc php-pear php-xml php-xmlrpc php-pecl-apc php-soap
service httpd restart
rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
yum -y install phpmyadmin
vim /etc/httpd/conf.d/phpmyadmin.conf
change "Allow from 127.0.0.1" to "Allow from all"
vim /usr/share/phpmyadmin/config.inc.php
Replace text :
$cfg['Servers'][$i]['auth_type'] = 'cookie';
To :
$cfg['Servers'][$i]['auth_type'] = 'http';
service httpd restart
vim /etc/httpd/conf.d/phpmyadmin.conf
<VirtualHost *:8081>
DocumentRoot /usr/share/phpmyadmin/
ServerName costi02
</VirtualHost>
vim /etc/httpd/conf/httpd.conf
add
Listen 8081
service httpd restart
http://localhost:8081
==================================================================
Install Ruby
==================================================================
curl -L https://get.rvm.io | bash
source /etc/profile.d/rvm.sh
rvm list known
rvm install 1.9.3
ruby -v
==================================================================
Install Rubygems
==================================================================
yum -y install rubygems
==================================================================
Install Passenger
==================================================================
gem install passenger
passenger-install-apache2-module
vim /etc/httpd/conf.d/passenger.conf
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p545/gems/passenger-4.0.37/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p545/gems/passenger-4.0.37
PassengerDefaultRuby /usr/local/rvm/gems/ruby-1.9.3-p545/wrappers/ruby
</IfModule>
service httpd restart
=================================================================
Create Database for Redmine
=================================================================
mysql --user=root --password=omnibis
create database redmine_db character set utf8;
create user 'redmine_admin'@'localhost' identified by 'redadmin';
grant all privileges on redmine_db.* to 'redmine_admin'@'localhost';
quit;
================================================================
Install Redmine
================================================================
cd /var/www
wget http://www.redmine.org/releases/redmine-2.5.0.tar.gz
tar xvfz redmine-2.5.0.tar.gz
mv redmine-2.5.0 redmine
rm -rf redmine-2.5.0.tar.gz
cd /var/www/redmine/config
cp database.yml.example database.yml
vim database.yml
================================================================
Setting up Rails
================================================================
cd /var/www/redmine
gem install bundler
bundle install
rake generate_secret_token
RAILS_ENV=production rake db:migrate
RAILS_ENV=production rake redmine:load_default_data
================================================================
Activate FCGI
================================================================
cd /var/www/redmine/public
mkdir plugin_assets
cp dispatch.fcgi.example dispatch.fcgi
cp htaccess.fcgi.example .htaccess
================================================================
Setting up Apache and FastCGI
================================================================
cd /var/www/
rpm --import https://fedoraproject.org/static/0608B895.txt
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
yum -y install mod_fcgid
rm -rf epel-release-6-8.noarch.rpm
=================================================================
Creating Files Directory
=================================================================
mkdir -p /opt/redmine/files
chown -R apache:apache /opt/redmine
cd /var/www/redmine/config
cp configuration.yml.example configuration.yml
vim configuration.yml
Enter the directory path containing the data files you just created in the previous step into the line "attachments_storage_path".
Note: You must add a space at the begin of the path "/opt/redmine/files" after character ":"
=================================================================
Configuring Email
=================================================================
vim /var/www/redmine/config/configuration.yml
email_delivery:
delivery_method: :sendmail
For GMAIL
email_delivery:
delivery_method: :smtp
smtp_settings:
enable_starttls_auto: true
address: "smtp.gmail.com"
port: 587
domain: "smtp.gmail.com"
authentication: :plain
user_name: "your_email@gmail.com"
password: "your_password"
=================================================================
Create Virtual Host for Redmine
=================================================================
vim /etc/httpd/conf.d/redmine.conf
<VirtualHost *:80>
ServerName your_domain
ServerAdmin your_domain@domain.com
DocumentRoot /var/www/redmine/public/
ErrorLog logs/redmine_error_log
<Directory "/var/www/redmine/public/">
Options Indexes ExecCGI FollowSymLinks
Order allow,deny
Allow from all
AllowOverride all
</Directory>
</VirtualHost>
==================================================================
Running Redmine
==================================================================
cd /var/www
chown -R apache:apache redmine
chmod -R 755 redmine
service httpd restart
==================================================================
Install Subversion
==================================================================
mkdir -p /opt/repositories/svn
chown -R apache:apache /opt/repositories/
chmod 0755 /opt/repositories
yum install mod_dav_svn subversion subversion-ruby
mkdir /usr/lib64/perl5/vendor_perl/Apache
ln -s /var/www/redmine/extra/svn/Redmine.pm /usr/lib64/perl5/vendor_perl/Apache/Redmine.pm
vim /etc/httpd/conf.d/subversion.conf
PerlLoadModule Apache::Redmine
<Location /svn>
DAV svn
SVNParentPath "/opt/repositories/svn"
SVNListParentPath on
Order deny,allow
Deny from all
Satisfy any
LimitXMLRequestBody 0
SVNPathAuthz off
PerlAccessHandler Apache::Authn::Redmine::access_handler
PerlAuthenHandler Apache::Authn::Redmine::authen_handler
AuthType Basic
AuthName "Subversion Repository"
Require valid-user
RedmineDSN "DBI:mysql:database=redmine_db;host=localhost:3306"
RedmineDbUser "redmine_admin"
RedmineDbPass "your_password_database_redmine"
</Location>
==================================================================
Install Sample DATA
==================================================================
cd /var/www/redmine
RAILS_ENV=production bundle exec rake generate_session_store
RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production bundle exec rake redmine:load_default_data
If you change any db keep mind to do following
cd /var/www/redmine
RAILS_ENV=production rake db:migrate
Subscribe to:
Posts (Atom)