Skip to content

Instantly share code, notes, and snippets.

@yoursunny
Last active December 10, 2015 23:19
Show Gist options
  • Save yoursunny/4508674 to your computer and use it in GitHub Desktop.
Save yoursunny/4508674 to your computer and use it in GitHub Desktop.
NDN platform easy installer
#!/bin/bash
# NDN platform easy installer for Ubuntu 12.04
# programs included:
# NDNx (with ndnd /robots.txt patch)
# CCNx shim for NDNx
# NDNLP
# ndnping
# PyNDN
# updated: 2013-09-02
#
# 1. create a 'ndn' user
# 2. download this script to /home/ndn/ndn-install.sh and make executable
# 3. if you want Java API support
# sudo apt-get install default-jdk ant
# 4. cd /home/ndn/
# sudo ./ndn-install.sh 0 # apt-get dependency
# sudo -u ndn ./ndn-install.sh 1 # download and compile NDNx and CCNx shim
# sudo ./ndn-install.sh 2 # install NDNx and CCNx shim
# sudo -u ndn ./ndn-install.sh 3 # download and compile apps
# sudo ./ndn-install.sh 4 # install other programs
step=$1
if [ ''$step == '' ]
then
echo USAGE
echo 'root# ndn-install.sh 0'
echo 'ndn $ ndn-install.sh 1'
echo 'root# ndn-install.sh 2'
echo 'ndn $ ndn-install.sh 3'
echo 'root# ndn-install.sh 4'
exit 1
fi
if [ $step -eq 0 ]
then
if [ `whoami` != 'root' ]; then echo PLEASE RUN UNDER \'root\'; exit 2; fi
apt-get update
apt-get dist-upgrade -y
apt-get install -y build-essential libpcap-dev libexpat1-dev libssl-dev libxml2-dev autoconf libtool python-all-dev
fi
if [ $step -eq 1 ]
then
if [ `whoami` != 'ndn' ]; then echo PLEASE RUN UNDER \'ndn\'; exit 2; fi
mkdir -p /home/ndn/src/
cd /home/ndn/src/
rm -rf ndnx ndnld ndnping PyNDN
wget https://gist.github.com/yoursunny/6186715/download -O ndnd_stats_robotstxt_patch.tar.gz
tar xzf ndnd_stats_robotstxt_patch.tar.gz --strip-components=1
wget https://github.com/named-data/ndnx/archive/master.tar.gz -Ondnx.tar.gz
mkdir ndnx
cd ndnx
tar xzf ../ndnx.tar.gz --strip-components=1
patch csrc/ndnd/ndnd_stats.c < ../ndnd_stats_robotstxt.patch
make
cd ..
wget https://gist.github.com/yoursunny/6186598/download -Ondnx-ccnx-shim.tar.gz
tar xzf ndnx-ccnx-shim.tar.gz --strip-components=1
fi
if [ $step -eq 2 ]
then
if [ `whoami` != 'root' ]; then echo PLEASE RUN UNDER \'root\'; exit 2; fi
cd /home/ndn/src/
cd ndnx/
make install
cd ..
bash ndnx-ccnx-shim.sh
fi
if [ $step -eq 3 ]
then
if [ `whoami` != 'ndn' ]; then echo PLEASE RUN UNDER \'ndn\'; exit 2; fi
cd /home/ndn/src/
wget https://github.com/NDN-Routing/NDNLP/archive/master.tar.gz -ONDNLP.tar.gz
mkdir ndnld
cd ndnld
tar xzf ../NDNLP.tar.gz --strip-components=1
./waf configure
./waf
cd ..
wget https://github.com/NDN-Routing/ndnping/archive/master.tar.gz -Ondnping.tar.gz
mkdir ndnping
cd ndnping
tar xzf ../ndnping.tar.gz --strip-components=1
./bootstrap.sh
./configure
make
cd ..
wget https://github.com/named-data/PyNDN/archive/master.tar.gz -OPyNDN.tar.gz
mkdir PyNDN
cd PyNDN
tar xzf ../PyNDN.tar.gz --strip-components=1
./bootstrap
./configure
make
cd ..
fi
if [ $step -eq 4 ]
then
if [ `whoami` != 'root' ]; then echo PLEASE RUN UNDER \'root\'; exit 2; fi
cd /home/ndn/src/
cd ndnld/
./waf install
cd ..
cd ndnping/
make install
cd ..
cd PyNDN/
make install
cd ..
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment