Installation and simple test of Redis in openSUSE-11.1 linux environment

Source: Internet
Author: User
Tags install redis

 

1. Create a virtual machine and install openSUSE-11.1

2. After installation, close the firewall so that SSH can be connected.

Susefirewall2 stop

3. Install redis after the SSH connection

Enter the directory:

CD/opt/

Follow the official instructions as follows:

$ Wget http://redis.googlecode.com/files/redis-2.4.8.tar.gz
$ Tar xzf redis-2.4.8.tar.gz
$ Redis-2.4.8 CD
$ Make

 

The following error is reported during direct installation.

Linux-1dw5:/opt/redis-2.4.8 # Make
Cd src & make all
Make [1]: Entering directory '/opt/redis-2.4.8/src'
Make hiredis
Make [2]: Entering directory '/opt/redis-2.4.8/deps/hiredis'
Gcc-STD = c99-pedantic-C-O3-FPIC-wall-w-wstrict-prototypes-wwrite-strings-g-ggdb net. c
Make [2]: GCC: Command not found
Make [2]: *** [net. O] Error 127
Make [2]: Leaving directory '/opt/redis-2.4.8/deps/hiredis'
Make [1]: *** [dependencies] Error 2
Make [1]: Leaving directory '/opt/redis-2.4.8/src'
Make: *** [all] Error 2

Gcc is not installed.

Find the information and find the command zypper install gcc.

4. Install gcc

Run the following command:

Zypper install gcc

Download the relevant files, install them, and follow these steps.

After installation, run the following command:

Which gcc

Check whether gcc is successfully installed.

Run the command: which gcc
The returned result is as follows:
/Usr/bin/gcc

Gcc is successfully installed.

5. Go to the redis directory and execute make

It may take several minutes to start installation,

Prompt that the installation is successful.

 

6. Start the redis Service

Src/redis-server

 

7. Open the official Client

Src/redis-cli

Run
Set foo bar
Get foo

By now, the simplest redis environment has been set up.

Java client Test

 

Package com. yanek. study. redis;

Import redis. clients. jedis. Jedis;

Public class Test {

/**
*
* @ Author Administrator/2012-2-22/10:48:03 AM
*/
Public static void main (String [] args ){

Jedis jedis = new Jedis ("192.168.195.130 ");
Jedis. set ("id", "10000 ");
String id = jedis. get ("id ");
Jedis. set ("name", "javaboy2012 ");
String name = jedis. get ("name ");
System. out. println ("id =" + id );
System. out. println ("name =" + name );

}

}

 

Output:

 

Id = 10000
Name = javaboy2012

 

 

 

 

 

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.