Skip to content

Instantly share code, notes, and snippets.

@plasticut
Last active December 31, 2015 09:59
Show Gist options
  • Save plasticut/7970006 to your computer and use it in GitHub Desktop.
Save plasticut/7970006 to your computer and use it in GitHub Desktop.
Ubuntu 13.10 in VirtualBox Install nodejs, redis, mongodb, git, mc Mount virtualbox shared folder
#!/bin/sh
## login: uuser
## passw: 1234567
## Install nodejs, mongodb and deps
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo add-apt-repository -y ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install -y python-software-properties python g++ make nodejs mongodb-10gen git mc
## Download and install redis
wget http://download.redis.io/releases/redis-2.6.16.tar.gz
tar xzf redis-2.6.16.tar.gz
cd redis-2.6.16
make
sudo make install
sudo mkdir /etc/redis
sudo mv redis.conf /etc/redis/redis.conf
cd ..
rm redis-2.6.16.tar.gz
## Configure redis as service
sudo cat <<EOT > /etc/init.d/redis-service
#!/bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
# Description: redis-server - Persistent key-value db
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/bin/redis-server
DAEMON_ARGS=/etc/redis/redis.conf
NAME=redis-server
DESC=redis-server
PIDFILE=/etc/redis/redis.pid
test -x $DAEMON || exit 0
test -x $DAEMONBOOTSTRAP || exit 0
set -e
case "$1" in
start)
echo -n "Starting $DESC: "
touch $PIDFILE
chown redis:redis $PIDFILE
if start-stop-daemon --start --quiet --umask 007 --pidfile $PIDFILE --chuid redis:redis --exec $DAEMON -- $DAEMON_ARGS
then
echo "$NAME."
else
echo "failed"
fi
;;
stop)
echo -n "Stopping $DESC: "
if start-stop-daemon --stop --retry 10 --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON
then
echo "$NAME."
else
echo "failed"
fi
rm -f $PIDFILE
;;
restart|force-reload)
${0} stop
${0} start
;;
*)
echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
EOT
sudo chmod +x /etc/init.d/redis-service
mkdir /home/uuser/work
mkdir /home/uuser/host
sudo cat <<EOT > /etc/rc.local
mount -t vboxsf share /home/uuser/host
/etc/init.d/redis-service start
exit 0
EOT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment