From 3fc788461bacbec1627a07d6069ca6f4cbc715c8 Mon Sep 17 00:00:00 2001 From: logwang Date: Tue, 2 May 2017 18:04:26 +0800 Subject: [PATCH] Add doc: Launch F-Stack on AWS EC2. --- ...Launch_F-Stack_on_AWS_EC2_in_one_minute.md | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 doc/Launch_F-Stack_on_AWS_EC2_in_one_minute.md diff --git a/doc/Launch_F-Stack_on_AWS_EC2_in_one_minute.md b/doc/Launch_F-Stack_on_AWS_EC2_in_one_minute.md new file mode 100644 index 00000000..4fc1b245 --- /dev/null +++ b/doc/Launch_F-Stack_on_AWS_EC2_in_one_minute.md @@ -0,0 +1,77 @@ +# Launch F-Stack on AWS EC2 in one minute + + If you have a Redhat7.3 EC2 instance,and then execute the following cmds, you will get the F-Stack server in one minute + + sudo -i + yum install -y git gcc openssl-devel kernel-devel-$(uname -r) bc + + mkdir /data/f-stack + git clone https://github.com/F-Stack/f-stack.git /data/f-stack + + # Compile DPDK + cd /data/f-stack/dpdk + make config T=x86_64-native-linuxapp-gcc + make + + # set hugepage + echo 1024 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages + mkdir /mnt/huge + mount -t hugetlbfs nodev /mnt/huge + + # insmod ko + modprobe uio + modprobe hwmon + insmod build/kmod/igb_uio.ko + insmod build/kmod/rte_kni.ko + + # set ip address + #redhat7.3 + export myaddr=`ifconfig eth0 | grep "inet" | grep -v ":" | awk -F ' ' '{print $2}'` + export mymask=`ifconfig eth0 | grep "netmask" | awk -F ' ' '{print $4}'` + export mybc=`ifconfig eth0 | grep "broadcast" | awk -F ' ' '{print $6}'` + export myhw=`ifconfig eth0 | grep "ether" | awk -F ' ' '{print $2}'` + export mygw=`route -n | grep 0.0.0.0 | grep eth0 | grep UG | awk -F ' ' '{print $2}'` + #Amazon Linux AMI 2017.03 + #export myaddr=`ifconfig eth0 | grep "inet addr" | awk -F ' ' '{print $2}' | awk -F ':' '{print $2}'` + #export mymask=`ifconfig eth0 | grep "Mask" | awk -F ' ' '{print $4}' | awk -F ':' '{print $2}'` + #export mybc=`ifconfig eth0 | grep "Bcast" | awk -F ' ' '{print $3}' | awk -F ':' '{print $2}'` + #export myhw=`ifconfig eth0 | grep "HWaddr" | awk -F ' ' '{print $5}'` + #export mygw=`route -n | grep 0.0.0.0 | grep eth0 | grep UG | awk -F ' ' '{print $2}' + + sed "s/addr=192.168.1.2/addr=${myaddr}/" -i /data/f-stack/config.ini + sed "s/netmask=255.255.255.0/netmask=${mymask}/" -i /data/f-stack/config.ini + sed "s/broadcast=192.168.1.255/broadcast=${mybc}/" -i /data/f-stack/config.ini + sed "s/gateway=192.168.1.1/gateway=${mygw}/" -i /data/f-stack/config.ini + + # enable kni + sed "s/#\[kni\]/\[kni\]/" -i /data/f-stack/config.ini + sed "s/#enable=1/enable=1/" -i /data/f-stack/config.ini + sed "s/#method=reject/method=reject/" -i /data/f-stack/config.ini + sed "s/#tcp_port=80/tcp_port=80/" -i /data/f-stack/config.ini + sed "s/#vlanstrip=1/vlanstrip=1/" -i /data/f-stack/config.ini + + + # Compile F-Stack lib + export FF_PATH=/data/f-stack + export FF_DPDK=/data/f-stack/dpdk/build + cd /data/f-stack/lib + make + + # Compile Nginx +   cd ../app/nginx-1.11.10 + ./configure --prefix=/usr/local/nginx_fstack --with-ff_module + make + make install + + # offload NIC + ifconfig eth0 down + python /data/f-stack/dpdk/tools/dpdk-devbind.py --bind=igb_uio eth0 + + # start Nginx + cd ../.. + ./start.sh -b /usr/local/nginx_fstack/sbin/nginx -c config.ini + + # start kni + sleep 30 + ifconfig veth0 ${myaddr} netmask ${mymask} broadcast ${mybc} hw ether ${myhw} + route add -net 0.0.0.0 gw ${mygw} dev veth0 \ No newline at end of file