Skip to content

Instantly share code, notes, and snippets.

@mxrss
Created January 9, 2014 05:19
Show Gist options
  • Save mxrss/8329744 to your computer and use it in GitHub Desktop.
Save mxrss/8329744 to your computer and use it in GitHub Desktop.
Use Vagrant
#!/usr/bin/env bash
apt-get update
# install elasticsearch
cd ~
sudo apt-get update
dpkg --get-selections | grep openjdk-7-jre || sudo apt-get install openjdk-7-jre -y
# download key
if ! grep -q "deb http://packages.elasticsearch.org/elasticsearch/0.90/debian stable main" "/etc/apt/sources.list"; then
wget -O - http://packages.elasticsearch.org/GPG-KEY-elasticsearch | apt-key add -
echo "deb http://packages.elasticsearch.org/elasticsearch/0.90/debian stable main" >> "/etc/apt/sources.list"
apt-get update
fi
if ! dpkg --get-selections | grep -qw elasticsearch; then
sudo apt-get install elasticsearch
sudo /usr/share/elasticsearch/bin/plugin -install mobz/elasticsearch-head
fi
#install memcached admin
if [ ! -d "/var/www/memcached" ]; then
# install memcached DEPENDENCIES And Memcached
sudo apt-get -y install build-essential
sudo apt-get -y install memcached
sudo apt-get install apache2
sudo apt-get -y install php5-memcache
sudo apt-get -y install php5 libapache2-mod-php5
# install admin tool
wget http://phpmemcacheadmin.googlecode.com/files/phpMemcachedAdmin-1.2.2-r262.tar.gz
sudo mkdir -p /var/www/memcached
sudo tar -xvzf phpMemcachedAdmin-1.2.2-r262.tar.gz -C /var/www/memcached/
sudo chmod 0777 /var/www/memcached/Config/Memcache.php
sudo /etc/init.d/apache2 restart
fi
#install redis
if ! grep -q "deb http://archive.ubuntu.com/ubuntu precise main universe" "/etc/apt/sources.list"; then
echo "deb http://archive.ubuntu.com/ubuntu precise main universe" >> "/etc/apt/sources.list"
apt-get update
fi
#redis install
if [ ! -f /etc/redis/6379.conf ] ; then
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
(cd redis-stable && make)
(cd redis-stable && sudo make install)
sudo cp /vagrant/install_server.sh redis-stable/utils
(cd redis-stable/utils && sudo ./install_server.sh)
#sudo apt-get -y install redis-server
#sudo redis-server stop
#sudo cp /vagrant/redis.conf /etc/redis/redis.conf
#sudo redis-server start
fi
# install MYSQL
if ! dpkg --get-selections | grep mysql-server; then
sudo bash -c "DEBIAN_FRONTEND=noninteractive aptitude install -q -y mysql-server"
sudo /etc/init.d/mysql stop
sudo cp /vagrant/my.cnf /etc/mysql/my.cnf
sudo /etc/init.d/mysql start
mysql -uroot -e "CREATE DATABASE IF NOT EXISTS test; GRANT ALL ON test.* TO 'someone'@'%' IDENTIFIED BY 'notapass'; FLUSH PRIVILEGES;"
# advanced configuration of the server
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment