1.Redis
1.1下载
wget http://download.redis.io/releases/redis-2.8.11.tar.gz
1.2解压
tar xvfz redis-2.8.11.tar.gz
1.3安装
cd redis-2.8.11 && sudo make && sudo make install
1.4测试
sudo make test
1.5配置使用
这时Redis 的可执行文件被放到了/usr/local/bin
1.5.1、下载配置文件和init启动脚本:
wget https://github.com/ijonas/dotfiles/raw/master/etc/init.d/redis-serverwget https://github.com/ijonas/dotfiles/raw/master/etc/redis.confsudo mv redis-server /etc/init.d/redis-serversudo chmod +x /etc/init.d/redis-serversudo mv redis.conf /etc/redis.conf
1.5.2、初始化用户和日志路径
第一次启动Redis前,建议为Redis单独建立一个用户,并新建data和日志文件夹
sudo useradd redissudo mkdir -p /var/lib/redissudo mkdir -p /var/log/redissudo chown redis.redis /var/lib/redissudo chown redis.redis /var/log/redis
useradd创建的user是3无用户,一无Home Directory,二无密码,三无系统Shell.但是默认group跟user一样,所以下面 chown redis.redis可以这样用
1.5.3、设置开机自动启动,关机自动关闭
sudo update-rc.d redis-server defaults
1.5.4、启动Redis:
sudo /etc/init.d/redis-server star
1.5.5、启动client客户端连接:
$ redis-cliredis> set foo barOKredis> get foo"bar"
2.MongoDB
2.1GPG Key
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
2.2list file
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
2.3Reload local package
sudo apt-get update
2.4install package
sudo apt-get install mongodb-org
2.5 MongoDB Use
2.5.1 start
sudo service mongod startorsudo /etc/init.d/mongod start
2.5.2 check
sudo vim /var/log/mongodb/mongod.log
2.5.3 stop
sudo service mongod stoporsudo /etc/init.d/mongod stop
2.5.4 restart
sudo service mongod restartorsudo /etc/init.d/mongod restart