LAMPUbuntu12.04LTS installation --- With memcacheredis installation (source code)

Source: Internet
Author: User
Tags install redis

LAMPUbuntu12.04LTS installation --- With memcacheredis installation (source code)
Install the basic components of LAMP Ubuntu 12.04 LTS

#!/bin/env bash#updatesudo apt-get updateecho "********************LAMP*****************************"apt-get install install apache2 php5 mysql-server php5-mysqlecho "********************php5-extend gd curl******************************"apt-get install php5-gd curl libcurl3 libcurl3-dev php5-curl
Test script

Location in/var/www

<? Php echo mysql_connect ('127. 0.0.1 ', 'root', 'Enter the password you set for MYSQL during installation ')? "Mysql OK": "database connection failed"; phpinfo ();?>

Retrieve GD curl mysql

Common php5 extensions

Sudo apt-get install php5-gd curl libcurl3 libcurl3-dev php5-curl

Mysql remote access

/Etc/mysql/my. cnf comment out bind_address = 127.0.0.1

Install memcache

Sudo apt-get instal memcached

Sudo apt-get instal php5-memcache

Apt installation is recommended.

Sudo vi/etc/php5/conf. d/memcache. ini
; Uncomment the next line to enable the module
Extension = memcache. so

[Memcache]
Memcache. dbpath = "/var/lib/memcache"
Memcache. maxreclevel = 0
Memcache. maxfiles = 0
Memcache. archivememlim = 0
Memcache. maxfilesize = 0
Memcache. maxratio = 0

Continue to open the previous test page to search for memcache source code Installation

Dependent

Http://www.monkey.org /~ Provos/libevent-2.0.13-stable.tar.gz

Http://www.danga.com/memcached/dist/memcached-1.4.0.tar.gz

It is best to switch to root/tmp

Download

tar xzvf libevent-2.0.21-stable.tar.gzcd libevent-2.0.21-stable./configure make install

After installation, check whether/usr/lib has libevent and other files (ls-al/usr/lib | grep libevent)

tar xzvf memcached-1.4.15.tar.gzcd memcached-1.4.15./configure --with-libevent=/usrmakemake install

Ls-al/usr/local/bin/memcached

/Usr/local/bin/memcached-d-m 1024-u root-p 11211

# Telnet 127.0.0.1 11211
If: Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'

OK to install redis

Sudo apt-get install redis-server

Note: make test. If sudo apt-get install tcl8.5 is not installed

Ps-aux | grep redis

Redis-cliredis 127.0.0.1: 6379>

Redis 127.0.0.1: 6379> set key1 "hello"

OK

Redis 127.0.0.1: 6379> get key1 "hello"

Sudo vi/etc/redis. conf

# Uncomment requirepass

Requirepass Password

Set Password

Sudo vi/etc/redis. conf # comment bind # bind 127.0.0.1 Remote Access



Install Extension

wget https://github.com/nicolasff/phpredis/zipball/master -O php-redis.zip
unzip php-redis.zip
Go to the directory: cd php-redis
Phpize (ps: This is the compilation extension tool under php-dev, if not, run sudo apt-get install php5-dev installation)
If libssl lacks security first

Apt-get install libssl

Remember to select n y in aptitude install libssl ..

./configure
Make

Make install

Modify the php. ini file (/etc/php5/apache2/php. ini or/etc/php5/fpm/php. ini)
Extension = redis. so

Or in/etc/php5/conf. d.

Run extension = redis. so in vim redis. ini.

Restart apache

Return to the test page again and search for redis

$redis = new Redis();$redis->connect('127.0.0.1',6379);$redis->set('name','jigsaw');echo $redis->get('name')

Finished

The following is the source code for installing redis

cd /tmp  wget http://download.redis.io/releases/redis-2.8.8.tar.gz  cd redis-2.8.8  make  make install  

sudo mkdir /etc/redis  sudo cp redis.conf /etc/redis/6379.conf  cd utils  sudo cp redis_init_script /etc/init.d/redis_6379   

After opening
redis_6379 
Modify

$ {REDISPORT}. pid

Remove $ {REDISPORT}

Sudo mkdir-p/var/apsaradb for redis/6379
Sudo vim/etc/redis/6379. conf
The items to be modified are as follows:

Set the service as a background program: daemonize yes
Set the log file path: logfile "/var/log/redis_62.16.log"
Set the database file path: dir "/var/redis/6379"

Sudo service redis_6379 start
Redis-cli
> Set key "hello"
> OK
> Get key
"Hello"

Check whether/var/redis/6379/dump. rdb exists
Check whether/var/log/redis_62.16.log has content.
OK!

<?$redis = new Redis();$redis->connect(‘127.0.0.1′,6379);$redis->set(‘test’,'hello world!’);echo $redis->get(‘test’);?>


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.