Install the Redis to the Ubuntu-14.04.1-server

Source: Internet
Author: User
Tags download redis redis redis version

Note: The Ubuntu version used here is 14.04.1-server and installed under Vmware®workstation Pro, Redis for 3.0.7

For Redis installations, if the desktop version of Ubuntu is simple enough, but as a server, we usually choose the server version of Ubuntu, and the server version of the Ubuntu installation Redis is slightly more complex, This will explain the entire installation process (including error resolution).

First we need to download Redis:

wget http://download.redis.io/release/redis-3.0.7.tar.gz

When you download it, unzip it:

Tar-xzf redis-3.0.7.tar.gz

When the decompression is complete, enter the Redis directory:

CD redis-3.0.7

Then we compile with the Make command (error):

Make

Yes, there will be errors, server version Ubuntu does not have make tools, we need to install ourselves, and then we naturally enter the following command to install (if the same VM and Ubuntu with the author will still error):

sudo apt-get install make

Take a few steps to regret the hint: please mount CDROM, because at this time the installation will automatically go to the System installation files (ISO) under/media/cdrom to look for the required content, for VMware, next we need to connect the drive:

(VMware with Chinese) Right-click the current virtual machine-> removable device->cd/dvd-> settings

Select the ISO file to use in the connection, and browse to select the current system corresponding to the ISO file, OK.

Right-click the current virtual machine-> removable device->cd/dvd-> connection

After the desktop version of Ubuntu will automatically mount the optical drive, but the server version also requires us to manually mount, because the make installation is prompted in the/media/cdrom, so we directly use the following command to mount the optical drive to this directory:

Then we can continue to install make.

When the Make tool is installed, you can use the make command to compile the Redis source file.

However, the server version of Ubuntu even GCC is not installed, so please enter the following command to install GCC:

sudo apt-get install gcc

Once installed, we make again. Sorry There may also be an error (if the Redis version used is the same as the author): "Error:jemalloc/jemalloc.h:no such file or directory."

Error Description:

Zmalloc.h:50:31:error:jemalloc/jemalloc.h:no such file or directory
zmalloc.h:55:2: Error: #error "newer version of Jemalloc required "
make[1]: * * * [ADLIST.O] Error 1
make[1]: Leaving directory '/DATA0/SRC/REDIS-2.6.2/SRC ' Make
: * * * [ALL] Error 2

Attentive students may notice that the Readme file mentions the following:

Allocator  
---------  
Selecting a Non-default memory allocator when building redis be done by setting the  
' Mallo C ' environment variable. Redis is compiled and linked against libc malloc  
by default, with the exception of Jemalloc being the default on Linux  
systems. This default is picked because Jemalloc has proven to have fewer fragmentation the problems than libc  
.  
To force compiling against libc malloc, use:  
    % do malloc=libc  
to compile against on Mac OS X jemalloc, u SE:  
    % make Malloc=jemalloc

Say about allocator allocator, if have MALLOC this environment variable, will use this environment variable to build Redis. And libc is not the default allocator, the default is Jemalloc, because Jemalloc is proven to have fewer fragmentation problems than libc. But if you do not have jemalloc and only libc of course make error. So add such a parameter.

You can resolve this by entering the following command:

Make MALLOC=LIBC

OK, finally make it happy.

After make the CD to the SRC directory LS can see the compiled file, and then can start Redis started playing.

For more information please go to:

Analysis of Redis installation and Java client's usage

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.