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
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
Add a row to the file to save:
Perform:
Sysctl Vm.overcommit_memory=1
6, add the startup script, execute:
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 start
Or /etc/init.d/redis start
, stop Redis's command. service redis stop
Or /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:
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.