How to Install mongodb on centos 6 64 bit

Configure the package management system (yum).

Create a /etc/yum.repos.d/mongodb-org-3.0.repo file so that you can install MongoDB directly, using yum.

Use the following repository file to specify the latest stable release of MongoDB.

[mongodb-org-3.0]
name=MongoDB Repository
baseurl=http://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.0/x86_64/
gpgcheck=0
enabled=1
nano /etc/yum.repos.d/mongodb-org-3.0.repo

Install the MongoDB packages and associated tools.

When you install the packages, you choose whether to install the current release or a previous one. This step provides the commands for both.

To install the latest stable version of MongoDB, issue the following command:

sudo yum install -y mongodb-org

Start MongoDB.

You can start the mongod process by issuing the following command:

sudo service mongod start

How to install Node.js on centos6

How To Install And Run A Node.js App On Centos 6.4 64bit

Introduction

This article outlines the steps necessary to run a “Hello world” in node.js + express, running on a 64bit Centos 6.4 installation. We will be building the latest version of source (at this moment, v0.10.4) from the upstream provider.

As is written on their homepage, Node.js is a platform built on Chrome’s JavaScript runtime for easily building fast, scalable network applications. This is a fast, event driven platform and server-side Javascript engine used for building web applications. DigitalOceans’ droplets are a cost-effective way to install and start studying server-side Javascript and bulding or deploying web applications with Node.js.

Setup a VPS

To get started, we will need a droplet – the smallest instance will do just enough – and a SSH client (ie. Putty on Windows, Linux systems and Mac Os X usually have it out of the box). When we receive our initial root password, we can ssh into the instance. SSH into the VPS and change the root password, if you haven’t already. It would probably be a good idea to also update software repository to the latest versions:

yum -y update

This will update installed software on our VPS to the latest versions.

Yum can take a few minutes, but when it’s done, we need to prepare for software installation. We’re going to build Node.js from the latest source available at the moment of writing this (v0.10.4). To do that, we’ll need “Development Tools”. It’s a group of tools for compiling software from sources.

yum -y groupinstall "Development Tools"

This command will pull a “Development Tools” group with the applications needed to compile node.js.

Also, we’ll install GNU screen – a piece of software that allows us to connect to our VPS, start a session and detach from it. We could disconnect and connect later, or from another workstation, and pick up where we left. It’s very handy, especially during development of an app, when we want to learn stuff.

yum -y install screen

Node.js installation

Now that we’re ready to install Node.js from sources. First, we’ll move to /usr/src directory – the usual place to hold software sources.

cd /usr/src

Now, we pick the latest compressed source archive from Node.js website at http://nodejs.org/download/.

wget http://nodejs.org/dist/v0.10.4/node-v0.10.4.tar.gz

We could and should replace the url and use the more recent version of node.js, if there is one. Next, we are uncompressing the source files and move into that directory.

tar zxf node-v0.10.4.tar.gz
cd node-v0.10.4

Now the source for Node.js is extracted and we’re in the source directory. We can now prepare our compiler commands, by executing the configure script:

./configure

It will read the properties of our system to prepare compiler flags. Ie. it could be a system architecture (32/64bit, CPU specific flags etc). With it, we’re ready to actually compile the source now. To do that, just type:

make

This is probably the most time-consuming task here: on my example VPS it took about 6 minutes and 34 seconds to complete. When we’re done, we need to make this available system-wide:

make install

The latest command will place the compiled binaries in system path, so all users could use it without any further setup. By default, node binary should be installed in /usr/local/bin/node.

Install Express.js

We now have Node.js installed and complete, we can start developing right away, deploy an already done application or we can proceed to create our Express.js application. First, we’ll use npm, nodes’ module manager, to install express middleware and supervisor – a helpful module that keeps our app started, monitors for file changes (ie. when we’re developing the app) and restarts the VPS when needed.

UPDATE: To be able to run an executable in /usr/local/bin through sudo, you have add /usr/local/bin to your secure_path using visudo.

sudo visudo

Look for secure_path, and append the following to it: “:/usr/local/bin”. Once you have done that, you’re now ready to install the express and supervisor modules.

npm -g install express express-generator supervisor

npm -g install will install the express and supervisor modules from npm software repository and make it available to the whole system. The -g switch in this command means “global” – the express and supervisor commands will be available accross the whole system.

Add non-privileged user

You should now, for security reasons, create a regular system user and run node under non-privileged account.

To do this, add the user first. You can replace “exampleuser” with whatever name your prefer.

useradd exampleuser

We have a new system user. Add a decent password for the new user:

passwd exampleuser

Log out, and log back in as the new user.This changes our login shell from root (system user) to exampleuser (non-privileged user who can compromise the system with less damage).

Creating an express app

Express is powerfull framework, and to create our first application, all we have to do is type:

express hello

The command will create a “hello” directory and setup some basics for a new application. Now we should enter this directory and install express dependencies:

cd hello && npm install

npm install part of the command will read all the module dependencies from a generated package.json file and install it from npm software repository.

We should start a new screen session so we can leave node app running:

screen

Finally, we can start our application with the help of supervisor that we installed earlier.

supervisor ./bin/www

Now we’re able to access our first express app at your VPS IP. For example http://123.456.78.90:3000/.

Install xrdp Remote Desktop to CentOS 6.6

xrdp is an Open Source Remote desktop Protocol server, which allows you to RDP to your Linux server from Windows machine; it is capable of accepting connections from rdesktop, freerdp, and remote desktop clients. This how to will help you to setup xrdp server on CentOS 6 / RHEL 6.

Prerequisites:

Install EPEL repository on CentOS 6.

32 Bit

# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

64 Bit

# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

Installation:

Issue the following command to install xrdp

# yum -y install xrdp tigervnc-server

You will get the following output, make sure you are getting package from the newly created repository.

Installed:
  tigervnc-server.x86_64 0:1.1.0-8.el6_5      xrdp.x86_64 0:0.5.0-0.13.el6
 
Dependency Installed:
  libXmu.x86_64 0:1.1.1-2.el6
  xorg-x11-fonts-misc.noarch 0:7.2-9.1.el6
  xorg-x11-xauth.x86_64 1:1.0.2-7.1.el6

Once it is installed, lets start the xrdp service.

# service xrdp start

xrdp will listen on 3389, lets confirm this by issuing following command.

# netstat -antup | grep xrdp
tcp        0      0 127.0.0.1:3350              0.0.0.0:*                   LISTEN      11299/xrdp-sesman
tcp        0      0 0.0.0.0:3389                0.0.0.0:*                   LISTEN      11295/xrdp

By default, services wont auto start after system reboot. Issue the following command to enable the service at system start up.

# chkconfig xrdp on
# chkconfig vncserver on

Test:

Now take rdp from any windows machine using Remote Desktop Connection, enter ip address of Linux server in computer field and click on connect.

CentOS 6 - xRDP MSTSC
CentOS 6 – xRDP MSTSC

You would be asked to enter the user name and password, you can either use root or any user that you have it on system. Make sure you use module “sesman-Xvnc”.

CentOS 6 - xRDP Login Screen
CentOS 6 – xRDP Login Screen

If you click ok, you will see the processing. In less than a half min, you will get a desktop.

CentOS 6 - xRDP Desktop
CentOS 6 – xRDP Desktop

How to install Ruby on Rails in Centos 6.5

Introduction

Ruby on Rails

Ruby on Rails is one of the most popular web development framework, it’s build upon Ruby Programming Language, and it’s the hottest web development stack currently.

Rbenv

Rbenv is a shell script tools created by Sam Stephenson. It’s used for groom your app’s Ruby environment.Use rbenv can pick a Ruby version for your application and guarantee that your development environment matches production.

rbenv works by inserting a directory of shims at the front of your PATH:

 ~/.rbenv/shims:/usr/local/bin:/usr/bin:/bin

Through a process called rehashing, rbenv maintains shims in that directory to match every Ruby command across every installed version of Ruby—irb, gem, rake, rails, ruby, and so on.

CentOS

CentOS is derived from Red Hat Enterprise Linux. The target users of these distributions are usually businesses, which require their systems to be running the most stable way for a long time.So we are going to use CentOS 6.5 running our applications.

Step One – Install dependencies

Before, installing any package, it’s always recommended to update package repository cache use yum.

 sudo yum update

Now,in order to get necessary development tools and dependencies, run the following:

 sudo yum groupinstall -y 'development tools'
 sudo yum install -y gcc-c++ glibc-headers openssl-devel readline libyaml-devel readline-devel zlib zlib-devel  sqlite-devel  

Step Two – Install Rbenv and ruby-build

Then we are ready to get Rbenv downloaded installed, run the following to check out rbenv into ~/.rbenv:

 git clone git://github.com/sstephenson/rbenv.git ~/.rbenv

Add ~/.rbenv/bin to your $PATH for access to the rbenv command-line utility:

 echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile

Add rbenv init to your shell to enable rbenv shims and autocompletion.

 echo 'eval "$(rbenv init -)"' >> ~/.bash_profile

Ruby-build is a Rbenv plugin which provides the rbenv install command that simplifies the process of installing new Ruby versions. Install rbenv-build:

 git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

reloaded your bash_profile to enable rbenv command:

 source ~/.bash_profile

Step Three – Install Ruby

Install Ruby 2.1.0 and make it the default

 rbenv install 2.1.0
 rbenv rehash
 rbenv global 2.1.0

Now you can run:

 ruby -v

to verify your ruby environment has been installed successful。 It will output something like this:

 ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]