Showing posts with label Open Source. Show all posts
Showing posts with label Open Source. Show all posts

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.

Monday, April 30, 2012

Sucess Story - Deploying Open Source in Enterprise

We were setting up 75 seater backoffice for our organisation and we decided to use Linux as desktop operating system in anticipation of reducing TCO.

Basic Requirement

First step taken was to ensure that our sysadmin team is Linux ready with training and studying online references.

Preparation

We evaluated multiple Linux distributions and Ubuntu topped our list for its ease of use and extensive online documentation. Next step was to list down open source alternative softwares for all applications / tools used by our backoffice team.

We did test run with a small user group to ascertain Ubuntu's suitability and reliability for its smooth implementation in a larger environment. Issues encountered during implementation and operations were documented along with their solutions. After the successful run for a month with this user group, it was then implemented at our new 75 seater backoffice.

Deployment

To ensure that Ubuntu installation is consistent across all desktops, the customised Ubuntu installation guide was used which was prepared during test run. The applications installed on desktops were Libre Office, VLC, Flash plugin, Java JRE, PDF reader, 7Zip, Gimp, Microsoft compatible fonts, hplip printer drivers, etc. And likewise-open was used to join Ubuntu desktops to Windows Domain.

As all 75 desktops were of similar configuration we first got one system ready and then used clonezilla to clone this system to remaining 74 systems.

Key benefits

- Reduced TCO which is crucial for growing organisation
- Easy integration of Ubuntu system in existing environment
- Secured environment
- Better system management
- Reduced downtime
- Vast online community support

Seeing the result and the success herein Ubuntu replaced the existing operating at our regional offices thereby giving brighter results with each new implementation.

Tuesday, November 22, 2011

Revisiting Nginx (engine x) – Installation Guide on CentOS 5.5

It has been a long time since I worked with Nginx and decide to check it again. And was amazed to find that the server has improved and also its installation process is much simpler. Below are the revised installation steps.

1] Download Nginx from its official site (http://nginx.org/)

Stable version is available at

(Note : On production server use only stable version)

or

Development version is available at



2] Lets store downloaded file under a directory, for example 'download' directory

$ mkdir ~/download

$ mv nginx-1.0.10.tar.gz ~/download


3] We need to install following required Nginx dependencies - pcre pcre-devel zlib zlib-devel openssl openssl-devel

$ sudo yum install pcre pcre-devel zlib zlib-devel openssl openssl-devel


4] Create Nginx user and group id

$ sudo /usr/sbin/groupadd nginx

$ sudo /usr/sbin/useradd –g nginx –s /bin/false nginx


5] Proceed with source installation of Nginx

$ cd ~/download

$ tar -zxvf nginx-1.0.10.tar.gz

$ cd nginx-1.0.10.tar.gz


6] Configure Nginx source

$ ./configure \
--user=nginx \
--group=nginx \
--with-http_realip_module \
--with-http_flv_module \
--with-http_gzip_static_module \
--with-http_ssl_module \
--with-http_stub_status_module


7] Make and install

$ make

$ sudo make install


8] Change ownerships before we proceed

$ sudo chown nginx:nginx –R /usr/local/nginx


9] To start Nginx

$ sudo /usr/local/nginx/sbin/nginx

If we get no error while starting Nginx then lets check running process status

[joel@localhost ~]$ ps aux | grep nginx
root 14802 0.0 0.0 4076 500 ? Ss 01:27 0:00 nginx: master process /usr/local/nginx/sbin/nginx
nginx 14803 0.0 0.1 4264 1092 ? S 01:27 0:00 nginx: worker process
joel 15004 0.0 0.0 4016 708 pts/1 S+ 01:39 0:00 grep nginx

10] And now we are ready to use Nginx

Open http://localhost or http://127.0.0.1 on your system browser and Nginx shows up.

Bingo!!!

11] To shutdown Nginx

$ sudo kill `cat /usr/local/nginx/logs/nginx.pid`

Thursday, October 1, 2009

Nginx (engine x) – Installation Guide on CentOS

1] Download source code of Nginx from the official site (http://nginx.net/)

To get stable version as per this tutorial dated is

$ wget http://sysoev.ru/nginx/nginx-0.7.61.tar.gz

or

To get development version as per this tutorial dated is

$ wget http://sysoev.ru/nginx/nginx-0.8.7.tar.gz

(Note : For production server use stable version only)


2] We store downloaded file under a directory, for example we will use 'download' directory

$ mkdir ~/download

$ cp nginx-0.6.36.tar.gz ~/download

$ cd download


3] Install required Nginx dependencies

pcre pcre-devel zlib zlib-devel openssl openssl-devel

so using default package manager of CentOS

$ sudo yum install pcre pcre-devel zlib zlib-devel openssl openssl-devel


4] Create required Nginx user and group ids

$ sudo /usr/sbin/groupadd nginx

$ sudo /usr/sbin/useradd –g nginx –s /bin/false nginx


5] Proceed with source installation of Nginx

$ cd ~/download

unzip the source file

$ tar -zxvf nginx-0.7.61.tar.gz

$ cd nginx-0.7.61


6] Configure Nginx source

$ ./configure \

--prefix=/usr/local/nginx \

--sbin-path=/usr/local/sbin \

--conf-path=/usr/local/nginx/nginx.conf \

--http-log-path=/var/log/nginx/access.log \

--error-log-path=/var/log/nginx/error.log \

--pid-path=/var/run/nginx/nginx.pid \

--lock-path=/var/lock/nginx.lock \

--user=nginx \

--group=nginx \

--http-client-body-temp-path=/var/tmp/nginx/client/ \

--http-proxy-temp-path=/var/tmp/nginx/proxy/ \

--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \

--with-http_ssl_module \

--with-http_realip_module \

--with-http_perl_module \

--with-http_flv_module \

--with-http_gzip_static_module \

--with-http_stub_status_module \

--with-md5-asm \

--with-md5=auto/lib/md5 \

--with-sha1-asm \

--with-sha1=auto/lib/sha1


7] Make and Install

$ make

$ sudo make install


8] Change ownerships before we proceed

$ sudo chown nginx:nginx –R /usr/local/nginx


9] Create following directories with required ownership to proceed

$ sudo mkdir -p /var/tmp/nginx /{client,proxy,fcgi}

$ sudo chown nginx:nginx -R /var/tmp/nginx


10] Start Nginx

$ sudo /usr/local/sbin/nginx

If we get no error while starting Nginx then lets check running process status by executing following command and getting similar output as below

$ ps aux | grep nginx

root 10009 0.0 0.0 5524 592 ? Ss 07:21 0:00 nginx: master process /usr/local/sbin/nginx

nginx 10010 0.0 0.0 5716 928 ? S 07:21 0:00 nginx: worker process


11] And we are ready to use Nginx

Open your browser and type ip address of your server or just type localhost.

http://localhost

http://127.0.0.1


Bingo!!!

12] Shutdown Nginx

$ sudo kill `cat /var/run/nginx/nginx.pid`