Skip to content

Instantly share code, notes, and snippets.

@Technoboggle
Forked from nghuuphuoc/1) Install
Last active January 16, 2018 17:53
Show Gist options
  • Save Technoboggle/da962f266d6ad25a85933f77e94430cf to your computer and use it in GitHub Desktop.
Save Technoboggle/da962f266d6ad25a85933f77e94430cf to your computer and use it in GitHub Desktop.
Install Redis on Centos 6
// Prerequisites - overkill I know but gets the job done!
$ sudo yum -y groupinstall 'Development Tools'
$ sudo yum -y install tcl wget zip unzip
// --- Compiling ---
$ wget http://download.redis.io/releases/redis-4.0.6.tar.gz
$ tar xzvf redis-*.tar.gz
$ cd redis-*
$ make distclean
$ cd deps
$ make hiredis lua jemalloc linenoise
$ make geohash-int
$ cd ../
$ make
$ make test
$ sudo make install
// --- or using yum --- I wouldn't it's simply not needed
$ rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
$ rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
$ yum --enablerepo=remi,remi-test install redis
// Edit sysctl and append the vm.overcommit_memory flag
$ sudo nano /etc/sysctl.conf
vm.overcommit_memory=1
$ sudo sysctl vm.overcommit_memory=1
$ sudo sysctl -w fs.file-max=100000
// Redis also strongly recommends transparent_hugepage being disabled (and tells you so in the logs on startup if it's not)
$ sudo sh -c "echo 'never' > /sys/kernel/mm/redhat_transparent_hugepage/enabled"
$ cd utils
$ install_server.sh
// You will be prompt for some configuration you can hit “Enter” to accept all the default values or you can set yours.
// When prompted for the executable path enter /usr/local/bin/redis-server
// Following two lines are for reminder only
//$ chkconfig --add redis
//$ chkconfig --level 345 redis on
$ service redis_6379 start/stop/restart
// Disable IP6v Networking and IPTables
// Before continuing disable IP6v as this is insecure for this application
$ sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
$ sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
// As 'root' user update /etc/sysctl.conf to make these changes persistent after reboots
$ echo "sysctl -w net.ipv6.conf.default.disable_ipv6=1" >> /etc/sysctl.conf
$ echo "sysctl -w net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf
// By default the package IPTABLES in installed, but because all our containers will be in a private network we can disable it here.
$ sudo service iptables save
$ sudo service iptables stop
$ sudo service ip6tables save
$ sudo service ip6tables stop
$ sudo chkconfig iptables off
$ sudo chkconfig ip6tables off
$ sudo setenforce 0
// Install php-redis extension - Only on servers where php will run, not on dedicated redis nodes
$ cd ~/
$ wget https://github.com/phpredis/phpredis/zipball/master -O phpredis.zip
$ unzip phpredis.zip
$ cd phpredis-*
$ phpize
$ ./configure
$ make
$ make install
Installing shared extensions: /usr/lib64/php/modules/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment