2017-05-02 10:04:26 +00:00
# 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
2019-10-31 07:58:26 +00:00
yum install -y git gcc openssl-devel kernel-devel-$(uname -r) bc numactl-devel mkdir make net-tools vim pciutils iproute pcre-devel zlib-devel elfutils-libelf-devel vim
2018-05-15 09:49:22 +00:00
2017-05-02 10:04:26 +00:00
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
2018-05-15 09:49:22 +00:00
2017-08-07 02:49:11 +00:00
# close ASLR; it is necessary in multiple process
2017-08-03 08:06:25 +00:00
echo 0 > /proc/sys/kernel/randomize_va_space
2017-05-02 10:04:26 +00:00
# insmod ko
modprobe uio
modprobe hwmon
insmod build/kmod/igb_uio.ko
2019-06-26 10:37:55 +00:00
insmod build/kmod/rte_kni.ko carrier=on
2017-05-02 10:04:26 +00:00
# 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}'
2018-05-15 09:49:22 +00:00
2017-05-02 10:04:26 +00:00
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
2021-02-05 08:42:07 +00:00
# Upgrade pkg-config while version < 0.28
cd /data/
wget https://pkg-config.freedesktop.org/releases/pkg-config-0.29.2.tar.gz
tar xzvf pkg-config-0.29.2.tar.gz
cd pkg-config-0.29.2
./configure --with-internal-glib
make
make install
mv /usr/bin/pkg-config /usr/bin/pkg-config.bak
ln -s /usr/local/bin/pkg-config /usr/bin/pkg-config
2017-05-02 10:04:26 +00:00
# Compile F-Stack lib
export FF_PATH=/data/f-stack
2021-02-05 08:42:07 +00:00
export PKG_CONFIG_PATH=/usr/lib64/pkgconfig:/usr/local/lib64/pkgconfig:/usr/lib/pkgconfig
2017-05-02 10:04:26 +00:00
cd /data/f-stack/lib
make
# Compile Nginx
2019-10-31 08:35:06 +00:00
cd ../app/nginx-1.16.1
2017-05-02 10:04:26 +00:00
./configure --prefix=/usr/local/nginx_fstack --with-ff_module
make
make install
2017-07-11 03:36:28 +00:00
# offload NIC( if there is only one NIC, the follow commands must run in a script)
2017-05-02 10:04:26 +00:00
ifconfig eth0 down
2018-05-15 09:49:22 +00:00
python /data/f-stack/dpdk/usertools/dpdk-devbind.py --bind=igb_uio eth0
2017-05-02 10:04:26 +00:00
2017-09-04 08:31:00 +00:00
# copy config.ini to $NGX_PREFIX/conf/f-stack.conf
cp /data/f-stack/config.ini /usr/local/nginx_fstack/conf/f-stack.conf
2017-05-02 10:04:26 +00:00
# start Nginx
2017-08-23 08:54:32 +00:00
/usr/local/nginx_fstack/sbin/nginx
2017-05-02 10:04:26 +00:00
# start kni
2017-09-11 03:04:19 +00:00
sleep 10
2017-05-02 10:04:26 +00:00
ifconfig veth0 ${myaddr} netmask ${mymask} broadcast ${mybc} hw ether ${myhw}
2017-07-11 03:36:28 +00:00
route add -net 0.0.0.0 gw ${mygw} dev veth0
2019-07-29 13:38:10 +00:00
echo 1 > /sys/class/net/veth0/carrier # if `carrier=on` not set while `insmod rte_kni.ko` .