Install the Redis and MongoDB tutorials under CentOS 7 _linux

Source: Internet
Author: User
Tags auth download redis mkdir mongodb redis centos redis server value store

The previous article toss the node.js, this time toss down Redis and MongoDB, so basically install a good nodejs of the whole development environment.

Redis

CentOS under the installation of Redis is also relatively simple, follow the steps step-by-step operation, basic will not be wrong.

1, switch to the /usr/src directory (if you are installed in another directory, note that some of the following path to be modified), download Redis, currently the latest is 2.8.13 version
D/usr/src

wget http://download.redis.io/releases/redis-2.8.13.tar.gz

2, decompression, switch directory

Tar xzf redis-2.8.13.tar.gz
CD redis-2.8.13

3, compile

Make make
Install

4, open redis.conf Modify the configuration file, the most important is the following lines, other settings refer to the official documents:

Daemonize Yes
loglevel notice
logfile/var/log/redis.log
dir./

5, set up the system of overcommit_memory, implementation

Vi/etc/sysctl.conf

Add a row to the file to save:

Vm.overcommit_memory = 1

Perform:

Sysctl Vm.overcommit_memory=1

6, add the startup script, execute:

Vi/etc/init.d/redis

Write the following code to save:

#!/bin/sh # # Redis Startup script for Redis Server # chkconfig:-# Description:redis are an open source, adv 
Anced Key-value Store. # processname:redis-server # config:/etc/redis.conf # pidfile:/var/run/redis.pid redisport=6379 EXEC=/usr/local/bin /redis-server redis_cli=/usr/local/bin/redis-cli pidfile=/var/run/redis.pid conf= "/usr/src/redis-2.8.13/ redis.conf "Case" ' in Start ' if [-f $PIDFILE] then echo $PIDFILE exists, process is already runn ing or crashed "else echo" starting Redis server ... "$EXEC $CONF fi if [" $? "
  = "0"] then echo "Redis is running ..." FI; STOP) if [! f $PIDFILE] then echo "$PIDFILE does not exist, the process is not running" else PI
        d=$ (cat $PIDFILE) echo "Stopping ..." $REDIS _cli-p $REDISPORT SHUTDOWN While [-X ${pidfile}]
        Do echo ' Waiting for Redis to shutdown ... ' sleep 1Done echo "Redis stopped" FI;
 restart|force-reload) ${0} stop ${0} start;; *) echo "Usage:/etc/init.d/redis {start|stop|restart|force-reload}" >&2 exit 1 Esac

Set permissions and boot up:

chmod +x/etc/init.d/redis
chkconfig--add redis chkconfig Redis on

OK, it's ready now. Start Redis Use service redis startOr /etc/init.d/redis start, stop Redis's command. service redis stopOr /etc/init.d/redis stop, use Redis under Windows systems to refer to this article.

Mongodb

1, the following installation MongoDB, first download:

CD/USR/SRC
wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.6.4.tgz

2, decompression, access to the directory:

TAR-ZXVF mongodb-linux-x86_64-2.6.4.tgz-c/usr/src
cd mongodb-linux-x86_64-2.6.4

3, create the database and log directory:

mkdir Log
mkdir db

4, in the background run the way to start:

./bin/mongod--dbpath=./db--logpath=./log/mongodb.log--fork--auth

will display the following:

About to fork the child process, the waiting until server is ready for connections.
Forked process:4623 Child
process started successfully, parent exiting

5, set up boot:

echo "/usr/src/mongodb-linux-x86_64-2.6.4/bin/mongod--dbpath=/usr/src/mongodb-linux-x86_64-2.6.4/db--logpath=/ Usr/src/mongodb-linux-x86_64-2.6.4/log/mongodb.log--fork--auth ">>/etc/rc.local

OK, it's done, and then you can see the lower mouth. netstat -nalupt | grep mongo :

TCP  0  0 0.0.0.0:27017  0.0.0.0:*  LISTEN   4623/./bin/mongod

Original link: http://keenwon.com/1335.html

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.