ubuntu LINUX中如何linux下安装ubuntuGUIDE

& 在Ubuntu中安装Redis
在Ubuntu中安装Redis
,主要介绍通过R语言连接使用nosql数据库。涉及的NoSQL产品,包括, , , , , 。希望通过我的介绍让广大的R语言爱好者,有更多的开发选择,做出更多地激动人心的应用。
关于作者:
张丹(Conan), 程序员Java,R,PHP,Javascript
weibo:@Conan_Z
转载请注明出处:
Redis是常用基于内存的Key-Value数据库,比Memcache更先进,支持多种数据结构,高效,快速。用Redis可以很轻松解决高并发的数据访问问题;做为时时监控信号处理也非常不错。
Redis在Windows中安装
Redis在Linux Ubuntu中安装
通过命令行客户端访问Redis
修改Redis的配置
1. Redis在Windows中安装
在Windows系统上安装Redis数据库是件非常简单的事情,下载可执行安装文件(exe),双击安装即可。下载地址:
Redis服务器运行命令:Redis安装目录/redis-server.exe
Redis客户端运行命令:Redis安装目录/redis-cli.exe
2. Redis在Linux Ubuntu中安装
本文使用的Linux是Ubuntu 12.04.2 LTS 64bit的系统,安装Redis数据库软件包可以通过apt-get实现。
在Linux Ubuntu中安装Redis数据库
#安装Redis服务器端
~ sudo apt-get install redis-server
安装完成后,Redis服务器会自动启动,我们检查Redis服务器程序
# 检查Redis服务器系统进程
~ ps -aux|grep redis
0:00 /usr/bin/redis-server /etc/redis/redis.conf
0:00 grep --color=auto redis
# 通过启动命令检查Redis服务器状态
~ netstat -nlt|grep 6379
0 127.0.0.1:6379
# 通过启动命令检查Redis服务器状态
~ sudo /etc/init.d/redis-server status
redis-server is running
3. 通过命令行客户端访问Redis
安装Redis服务器,会自动地一起安装Redis命令行客户端程序。
在本机输入redis-cli命令就可以启动,客户端程序访问Redis服务器。
~ redis-cli
redis 127.0.0.1:6379>
# 命令行的帮助
redis 127.0.0.1:6379> help
redis-cli 2.2.12
Type: "help @" to get a list of commands in
"help " for help on
"help " to get a list of possible help topics
"quit" to exit
# 查看所有的key列表
redis 127.0.0.1:6379> keys *
(empty list or set)
基本的Redis客户端命令操作
增加一条字符串记录key1
# 增加一条记录key1
redis 127.0.0.1:6379> set key1 "hello"
# 打印记录
redis 127.0.0.1:6379> get key1
增加一条数字记录key2
# 增加一条数字记录key2
set key2 1
# 让数字自增
redis 127.0.0.1:6379> INCR key2
(integer) 2
redis 127.0.0.1:6379> INCR key2
(integer) 3
# 打印记录
redis 127.0.0.1:6379> get key2
增加一条列表记录key3
# 增加一个列表记录key3
redis 127.0.0.1:6379> LPUSH key3 a
(integer) 1
# 从左边插入列表
redis 127.0.0.1:6379> LPUSH key3 b
(integer) 2
# 从右边插入列表
redis 127.0.0.1:6379> RPUSH key3 c
(integer) 3
# 打印列表记录,按从左到右的顺序
redis 127.0.0.1:6379> LRANGE key3 0 3
增加一条哈希表记录key4
# 增加一个哈希记表录key4
redis 127.0.0.1:6379> HSET key4 name "John Smith"
(integer) 1
# 在哈希表中插入,email的Key和Value的值
redis 127.0.0.1:6379> HSET key4 email ""
(integer) 1
# 打印哈希表中,name为key的值
redis 127.0.0.1:6379> HGET key4 name
"John Smith"
# 打印整个哈希表
redis 127.0.0.1:6379> HGETALL key4
2) "John Smith"
3) "email"
增加一条哈希表记录key5
# 增加一条哈希表记录key5,一次插入多个Key和value的值
redis 127.0.0.1:6379> HMSET key5 username antirez password P1pp0 age 3
# 打印哈希表中,username和age为key的值
redis 127.0.0.1:6379> HMGET key5 username age
1) "antirez"
# 打印完整的哈希表记录
redis 127.0.0.1:6379> HGETALL key5
1) "username"
2) "antirez"
3) "password"
4) "P1pp0"
# 查看所有的key列表
redis 127.0.0.1:6379> keys *
# 删除key1,key5
redis 127.0.0.1:6379> del key1
(integer) 1
redis 127.0.0.1:6379> del key5
(integer) 1
# 查看所有的key列表
redis 127.0.0.1:6379> keys *
4. 修改Redis的配置
4.1 使用Redis的访问账号
默认情况下,访问Redis服务器是不需要密码的,为了增加安全性我们需要设置Redis服务器的访问密码。设置访问密码为redisredis。
用vi打开Redis服务器的配置文件redis.conf
~ sudo vi /etc/redis/redis.conf
#取消注释requirepass
requirepass redisredis
4.2 让Redis服务器被远程访问
默认情况下,Redis服务器不允许远程访问,只允许本机访问,所以我们需要设置打开远程访问的功能。
用vi打开Redis服务器的配置文件redis.conf
~ sudo vi /etc/redis/redis.conf
#bind 127.0.0.1
修改后,重启Redis服务器。
~ sudo /etc/init.d/redis-server restart
Stopping redis-server: redis-server.
Starting redis-server: redis-server.
未使用密码登陆Redis服务器
~ redis-cli
redis 127.0.0.1:6379> keys *
(error) ERR operation not permitted
发现可以登陆,但无法执行命令了。
登陆Redis服务器,输入密码
redis-cli -a redisredis
redis 127.0.0.1:6379> keys *
登陆后,一切正常。
我们检查Redis的网络监听端口
检查Redis服务器占用端口
~ netstat -nlt|grep 6379
0 0.0.0.0:6379
我们看到从之间的网络监听从 127.0.0.1:3306 变成 0 0.0.0.0:3306,表示Redis已经允许远程登陆访问。
我们在远程的另一台Linux访问Redis服务器
~ redis-cli -a redisredis -h 192.168.1.199
redis 192.168.1.199:6379> keys *
远程访问正常。通过上面的操作,我们就把Redis数据库服务器,在Linux Ubuntu中的系统安装完成。
转载请注明出处:
This entry was posted in ,
Designed byYou make Ubuntu You use Ubuntu You talk Ubuntu Ubuntu is yours
The Ubuntu Brand Guidelines exist so we can all communicate Ubuntu with the same precision we use to make it.
Why do we need guidelines?
Our values should be evident wherever Ubuntu is encountered, whether online or via traditional marketing material. If we follow these guidelines consistently, the brand will grow strong enough to attract people, encouraging them to look even more positively on the product itself.
These guidelines provide everything you need to create professional communication materials that will build the Ubuntu brand. To help ensure the continued success of Ubuntu, please use them.
Our values
We believe everyone has the right to a great computing experience & and we also believe it should be free. Ubuntu is the result of a growing community, working together to provide just that. As such, the Ubuntu brand embodies four values:
Ubuntu celebrates freedom. Freedom to choose, to change, to participate.
You can depend on Ubuntu. Like the people who make it, it is trustworthy and keeps its promises.
Ubuntu is crisp and clean in engineering and attitude. There is beauty in the precision of the process and product.
Collaborative
Working together is at the heart of Ubuntu. It is the essence of &humanity towards others&.
Find out how to tailor your designs depending on which audience you are catering for, with the help of three handy sliders.
Learn about the elements that constitute the Ubuntu brand and how to use them, such as the Ubuntu and Canonical logos, pictograms, photography, etc.
See how to use the Ubuntu brand on the web, from the logo to the Ubuntu font family, colours, forms, navigation and more design patterns and components.
Quick links
Get inspiredDownload Ubuntu Desktop | Download | Ubuntu
Download Ubuntu Desktop
Ubuntu 14.04.3 LTS
The Long Term Support (LTS) version of the Ubuntu operating system for desktop PCs and laptops, Ubuntu 14.04.3 LTS comes with five years of security and maintenance updates, guaranteed.
Recommended for most users.
Choose your flavour
64-bit & recommended
32-bit & for machines with less than 2GB RAM
Ubuntu 15.10
The latest version of the Ubuntu operating system for desktop PCs and laptops, Ubuntu 15.10 comes with nine months of security and maintenance updates.
Choose your flavour
64-bit & recommended
32-bit & for machines with less than 2GB RAM
Easy ways to switch to Ubuntu
If you&re already running Ubuntu, you can upgrade in a few clicks from .
If you&re using Windows 8 or any computer with a 64-bit processor, we recommend the 64-bit download.
Most Macs with Intel processors will work with either 64-bit or Mac images. If the 64-bit image doesn't work, try the Mac image.
Get the version you need
Ubuntu 14.04 LTS is available for purchase on DVD, from the online Ubuntu Store.
Ubuntu is available via torrent and with more languages. You can also select from a list of older versions.
Ubuntu Kylin is a redesigned version of Ubuntu, created in China with the needs of Chinese users in mind
Try before you install
There&s no need to replace your operating system to try Ubuntu.
Helping hands
If you get stuck, help is always at hand.
& 2016 Canonical Ltd. Ubuntu and Canonical are registered trademarks of Canonical Ltd.

我要回帖

更多关于 linux下安装ubuntu 的文章

 

随机推荐