Skip to content

Instantly share code, notes, and snippets.

@lfbittencourt
Created July 21, 2015 18:35
Show Gist options
  • Save lfbittencourt/3216a540833827b1fd8a to your computer and use it in GitHub Desktop.
Save lfbittencourt/3216a540833827b1fd8a to your computer and use it in GitHub Desktop.
Install Redis and Redis PHP extension on Ubuntu
# Installs extra packages
sudo apt-get update
sudo apt-get -y install build-essential tcl8.5
# Installs Redis
# http://redis.io/topics/quickstart
# https://www.digitalocean.com/community/tutorials/how-to-install-and-use-redis
# https://realguess.net/2014/07/19/non-interactive-redis-install/
PORT=6379
CONFIG_FILE=/etc/redis/6379.conf
LOG_FILE=/var/log/redis_6379.log
DATA_DIR=/var/lib/redis/6379
EXECUTABLE=/usr/local/bin/redis-server
cd ~
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
make
sudo make install
cd utils
echo -e \
"${PORT}\n${CONFIG_FILE}\n${LOG_FILE}\n${DATA_DIR}\n${EXECUTABLE}\n" | \
sudo ./install_server.sh
sudo update-rc.d redis_6379 defaults
# Installs Redis PHP extension
cd ~
git clone https://github.com/phpredis/phpredis.git
cd phpredis
git checkout 2.2.7
phpize
./configure
make
sudo make install
sudo sh -c 'echo "extension=redis.so" >> /etc/php5/mods-available/redis.ini'
sudo ln -s /etc/php5/mods-available/redis.ini /etc/php5/apache2/conf.d/30-redis.ini
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment