Saturday, August 18, 2018

How2 install and configure MongoDB 4 on CentOS 7

1] To get started we first need add a yum repository

    # vi /etc/yum.repos.d/mongodb-org-4.0.repo

    add the following and save the file

    [mongodb-org-4.0]
    name=MongoDB Repository
    baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.0/x86_64/
    gpgcheck=1
    enabled=1
    gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc


2] Now proceed to install MongoDB

    # yum install mongodb-org

3] Lets configure MongoDB for security and take care of MongoDB warning.

    # vi /etc/mongod.conf

    and to enable security search for

    #security:

    and change it to

    security:
      authorization: enabled


    and save the file

4] We need to disable hugepage which affects the performance on MongoDB and also take care of MongoDB warnings. It is enabled by default in Centos7 and there are various ways to disable it and below is one of them

    # vi /etc/rc.local

    and append following lines at the end of the file and save the file

  if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
      echo never > /sys/kernel/mm/transparent_hugepage/enabled
  fi
  if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
      echo never > /sys/kernel/mm/transparent_hugepage/defrag
  fi


    for it to work we need to make rc.local executable and reboot the server

  # chmod +x /etc/rc.d/rc.local
  # reboot


5]  Login again to start and enable auto start for MongoDB

  # systemctl start mongod && systemctl enable mongod
  # systemctl status mongod


6] Now lets go ahead and connect to MongoDB and create admin user and database to store credential details. Please ensure secure password is used for admin.

    $ mongo
  > use admin
  > db.createUser({user: "admin", pwd: "Password", roles:[{role: "userAdminAnyDatabase", db: "admin"}]})
  > quit()


    and login with admin credentials

    $ mongo -u adminm -p --authenticationDatabase admin

    Now proceed to use MongoDB to create databases, collections etc.

Saturday, April 16, 2016

HowTo deploy Icinga2 Monitoring Server with Icinga Web 2 and Icingacli on CentOS 7.x 64 bit

To start with we require server ready with CentOS 7.x 64 bit

1) For Icinga2 installation we require server root access

$ sudo su -

now enter password to get the root prompt

#


2) Ensure SELINUX is disabled and to check the status run following command

# sestatus

and to disable read

Howto Disable SELINUX on CentOS 5.x / RHEL 5.x



3) Add EPEL repository as it is required for deploying Icinga2

# yum install epel-release


4) Add Icinga2 repository

# rpm --import http://packages.icinga.org/icinga.key
# curl -o /etc/yum.repos.d/ICINGA-release.repo http://packages.icinga.org/epel/ICINGA-release.repo
# yum makecache


5) Deploy Apache2 web server

# yum install httpd

to start and enable Apache2 server run following command

# systemctl start httpd && systemctl enable httpd

and to check the status of the server

# systemctl status httpd

open http://SERVERIPADDRESS/ url in the browser and you should get default apache2 page

create index.html file as this will take care of http warning initially displayed by Icinga2

# touch /var/www/html/index.html


6) Deploy MariaDB database server

# yum install mariadb-server mariadb

to start and enable MariaDB server run following command

# systemctl start mariadb && systemctl enable mariadb

and check the status of the server

# systemctl status mariadb

now lets secure Mariadb server

# mysql_secure_installation

Enter current password for root (enter for none):  (click on enter as no password is set by default)

Set root password? [Y/n] (click on enter to set root password)

New password: (type new root password)
Re-enter new password: (reenter new root password)

Remove anonymous users? [Y/n] (click on enter to remove all anonymous users)

Disallow root login remotely? [Y/n] (click on enter to disallow root login remotely)

Remove test database and access to it? [Y/n] (click on enter to delete test database)

Reload privilege tables now? [Y/n] (click on enter to reload user privileges)


7) Deploy PHP

# yum install php php-mysql php-ldap

update timezone in php.ini

# vi /etc/php.ini

search for [date] section and set timezone as per your location and save the file

date.timezone = "Asia/Kolkata"

restart apache2 server

# systemctl restart httpd

and check the status of the server

# systemctl status httpd


8) Deploy Icinga2

# yum install icinga2

to start and enable Icinga2 server run following command

# systemctl start icinga2 && systemctl enable icinga2


and check the status of the server

# systemctl status icinga2

by default all config files are stored in /etc/icinga2 directory

and by default Icinga2 enables three features and it can be checked by running following command

# icinga2 feature list


9)  Install Nagios plugins

# yum install nagios-plugins-all

by default plugins are installed in /usr/lib64/nagios/plugins/ directory and if plugin path is to be changed then it has to be updated for "const PluginDir" parameter in /etc/icinga2/constants.conf file

restart Icinga2 server

# systemctl restart icinga2


10) Configure IDO Mysql module

# yum install icinga2-ido-mysql

login into mariadb

# mysql -u root -p (at the password prompt provide root password)

at the prompt run following commands

> CREATE DATABASE icinga;

> GRANT SELECT, INSERT, UPDATE, DELETE, DROP, CREATE VIEW, INDEX, EXECUTE ON icinga.* TO 'icinga'@'localhost' IDENTIFIED BY 'icinga';

> use icinga;

to import database schema run following command

> \. /usr/share/icinga2-ido-mysql/schema/mysql.sql

> exit

now lets update ido-mysql.conf file as follows

# vi /etc/icinga2/features-available/ido-mysql.conf

Edit IdoMysqlConnection section as follows

object IdoMysqlConnection "ido-mysql" {
  user = "icinga"
  password = "icinga"
  host = "localhost"
  port = 3306
  database = "icinga"
  table_prefix = "icinga_"
  instance_name = "icinga2"
  instance_description = "icinga2 instance"
}


11) Enable web interface feature to send commands to Icinga2

# icinga2 feature enable command

check if command is added in Enabled feature list

# icinga2 feature list

restart icinga2 to take effect

# systemctl restart icinga2


12) Add apache user to icingacmd group

# usermod -a -G icingacmd apache

to check if apache user is added to the group run following command

# id apache

and output would look similar to

uid=48(apache) gid=48(apache) groups=48(apache),992(icingacmd)


13) Deploy Icinga Web 2 and Icingacli

# yum install icingaweb2 icingacli


restart icinga2 to take effect


# systemctl restart icinga2

create database for Icinga web 2

# mysql -u root -p (at the password prompt provide mariadb root password)

at the prompt run following commands

> CREATE DATABASE icingaweb2;

> GRANT SELECT, INSERT, UPDATE, DELETE, DROP, CREATE VIEW, INDEX, EXECUTE ON icingaweb2.* TO 'icingaweb2'@'localhost' IDENTIFIED BY 'icingaweb2';

> exit


restart apache2 server

# systemctl restart httpd

and check the status of the server

# systemctl status httpd


14) Now generate token to proceed with the installation using browser

icingacli setup token create

to recheck generated token run following command


# icingacli setup token show

open http://SERVERIPADDRESS/icingaweb2/setup URL in the browser to proceed with the installation

On 'Setup' page provide setup token and click on "Next"

On 'Modules' page click on "Next"

On 'Requirement' page ensure every option is green, scroll to bottom of the page and click on "Next"

On 'Authentication' page the default Authentication Type is set to Database, click on "Next"

On 'Database Resource' page provide details as follows

Resource Name : icingaweb2
Database Type : MySQL
Host          : localhost
Port          : 3306
Database Name : icingaweb2
Username      : icingaweb2
Password      : icingaweb2

Click on "Validate Configuration" and once successfully validated click on "Next"

On 'Database Setup' page for Username and Password provide MariaDB administrative username i.e root and its configured password and click on "Next"

On 'Authentication Backend' page keep default value and click on "Next"

On 'Administration' page create Icinga Web2 administrative user i.e admin, and set its password now click on "Next"

On 'Application Configuration' page keep default value and click on "Next"

On 'Configuration' page it will show all configuration provided earlier and would mention that Icinga Web 2 is successfully installed and click on "Next"

On 'Welcome' page click on "Next"

On 'Monitoring Backend' page keep default values and click on "Next"

On 'Monitoring IDO Resource'page provide details as follows

Resource Name : icingaido
Database Type : MySql
Host          : localhost
Port          : 3306
Database Name : icinga
Username      : icinga
Password      : icinga

Click on "Validate Configuration" and once successfully validated click on "Next"

On 'Command Transport' page keep default values and click on "Next"

On 'Monitoring Security' page keep default values and click on "Next"

On 'Finish' page click on "Finish"

On 'Congratulations' page on the the right hand side, click on 'Login to Icinga Web 2'. On login page provide Icinga Web2 admin user name and password to go to Icinga Dashboard page.

With this you have successfully deployed Icinga2 Server along with Icinga Web2 and Icingacli module. Now you can proceed with configuring servers to be monitored that will be covered in the next blog post.

Tuesday, February 17, 2015

Howto disable / enable autostart of MariaDB 5.x & 10.x at system startup on Ubuntu 14.04.1 64bit

To disable autostart of MariaDB during system boot / startup do as follows

$ sudo update-rc.d -f mysql disable


and to enable it again do

$ sudo update-rc.d mysql enable

or

$ sudo update-rc.d mysql default

Monday, February 16, 2015

Howto change default Python version 2.7 to 3.4 in Ubuntu 14.04.1 LTS 64bit

Ubuntu 14.04 LTS comes with both Python version 2.7 and 3.4. The default Python version is 2.7 and update-alternatives is not configured to switch Python versions

$ sudo update-alternatives --config python
update-alternatives: error: no alternatives for python

1. So to configure alternatives for Python 2.7 & 3.4 we need to configure update-alternatives as follows

$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
update-alternatives: using /usr/bin/python2.7 to provide /usr/bin/python (python) in auto mode

$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.4 2
update-alternatives: using /usr/bin/python3.4 to provide /usr/bin/python (python) in auto mode

2. And now you can switch between Python versions

$ sudo update-alternatives --config python
[sudo] password for linuxuser: 
There are 2 choices for the alternative python (providing /usr/bin/python).

  Selection    Path                Priority   Status
------------------------------------------------------------
  0            /usr/bin/python3.4   2         auto mode
* 1            /usr/bin/python2.7   1         manual mode
  2            /usr/bin/python3.4   2         manual mode

Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/bin/python3.4 to provide /usr/bin/python (python) in manual mode

Tuesday, January 28, 2014

Howto access data from MS Access .MBD file on Ubuntu 12.04.4 64 bit

There are very few tools / guides available to access data from MS Access .mdb file on GNU/Linux and following steps would help you quickly install MDB tools and access data from MS Access .mdb file on your system.

1) Install MDB tools

$ sudo apt-get install mdbtools

2) Install MDB graphical interface

$ sudo apt-get install mdbtools-gmdb

3) Now from command prompt run

$ gmdb2

and select .mdb file to access tables, queries, forms, reports macros & modules.

4) Also you can use other mdb tools commands prefixed with 'mdb-' from command prompt

Monday, August 12, 2013

Howto Setup Intel® SDK for OpenCL* Applications XE 2013 (Open Computing Language) for GPGPU & Parallel Programming on Ubuntu 12.04.2 64 bit

There are very few installation guides available for setting up Intel® SDK for OpenCL* Applications XE 2013 on Ubuntu 12.04.2 and following steps should help with you to quickly configure your system

1. Download Intel SDK for OpenCL Application XE 2013 version from Intel site

http://software.intel.com/en-us/vcsource/tools/opencl-sdk-xe

select 64-bit SDK and click on download button

2. Then click on "Installation Instruction" link (just under download button) and download public key from this page.

Intel-E901-172E-EF96-900F-B8E1-4184-D7BE-0E73-F789-186F.pub

3. Now import the public key

$ sudo rpm --import Intel-E901-172E-EF96-900F-B8E1-4184-D7BE-0E73-F789-186F.pub

4. Once sdk is downloaded, extract the file.

$ tar zxvf intel_sdk_for_ocl_applications_2013_xe_sdk_3.0.67279_x64.tgz

5. Now we need to install additional packages to manage RPM files & other tools for building packages

$ sudo apt-get install rpm alien build-essential fakeroot dpkg-dev

6. Now lets verify signature of rpm files. For example, do this for all rpm files

$ rpm --checksig opencl-1.2-base-3.0.67279-1.x86_64.rpm

and the result should be as follows

opencl-1.2-base-3.0.67279-1.x86_64.rpm: rsa sha1 (md5) pgp md5 OK

7.  Lets proceed to convert all .rpm files to .deb

$ fakeroot alien --to-deb --scripts *.rpm

8. We need to create /usr/lib64 folder, if it is not existing

$ sudo mkdir /usr/lib64

9. Now lets proceed with the installation

$ sudo dpkg -i opencl-1.2-base_3.0.67279-2_amd64.deb
$ sudo dpkg -i opencl-1.2-devel_3.0.67279-2_amd64.deb
$ sudo dpkg -i opencl-1.2-intel-cpu_3.0.67279-2_amd64.deb

$ sudo dpkg -i opencl-1.2-intel-devel_3.0.67279-2_amd64.deb
$ sudo dpkg -i opencl-1.2-intel-mic_3.0.67279-2_amd64.deb

10. As required by Ubuntu, lets create symbolic links for libraries

$ sudo ln -s /usr/lib64/libOpenCL.so /usr/lib/libOpenCL.so
$ sudo ln -s /usr/lib64/libOpenCL.so.1 /usr/lib/libOpenCL.so.1
$ sudo ln -s /usr/lib64/libOpenCL.so.1.2 /usr/lib/libOpenCL.so.1.2

and update library cache

$ sudo ldconfig

11. Lets test our installation by downloading sample application from following link

http://software.intel.com/sites/default/files/article/391203/capsbasic-sample.tar.gz

and extract the file

$ tar zxvf capsbasic-sample.tar.gz
$ cd CapsBasic
$ make
$ ./capsbasic

And if the application compiles & runs successfully displaying system information then your installation is successful

Monday, October 29, 2012

Howto setup Eclipse Juno on Ubuntu 12.04.1

The Eclipse PPA is dated and to install Juno for Ubuntu 12.04.1 manually kindly follow these steps 

1. Select and download Eclipse Juno .tgz for your architecture from http://www.eclipse.org/downloads/

2. Open terminal windows (Ctrl + Alt + T) and type following command

$ cd ~/Downloads
$ tar zxvf eclipse-SDK-4.2.1-linux-gtk-x86_64.tar.gz
(Do not run this command as sudo or root)

$ sudo su

# mv eclipse /usr/lib/eclipse

# chown root:root /usr/lib/eclipse

# ln -s /usr/lib/eclipse/eclipse /usr/bin/eclipse

# exit

$ eclipse

this will start eclipse.

4. To add Juno update site, in Eclipse menu select 'Help' > 'Install New Software...'. Click on Add button and enter name as 'Juno' and location enter 'http://download.eclipse.org/releases/juno' and click on 'Ok' to save.
 
5. To add eclipse to Unity Launcher, open file editor and create eclipse.desktop file

$ sudo vi /usr/share/applications/eclipse.desktop

[Desktop Entry]
Type=Application
Name=Eclipse
Version=4.2.1
Comment=Eclipse Integrated Development Environment
Icon=/usr/lib/eclipse/icon.xpm
Exec=/usr/lib/eclipse/eclipse
Terminal=false
Categories=Development;IDE;


save the file and now go ahead and type eclipse in HUD and start eclipse.