Last active
June 24, 2016 18:41
-
-
Save thosakwe/daa3b19150c15cf81fb48d9171c2bea8 to your computer and use it in GitHub Desktop.
MEAN Setup Script, feat. Mongo 3.2.7, Node 6, PM2, Nginx, also includes an FFMPEG install script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env | |
# Run this in project root (/home/inet/app) | |
cd client && npm run build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Credit: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu | |
# WARNING: This will take a while... | |
# Deps | |
sudo apt-get update | |
sudo apt-get -y install autoconf automake build-essential libass-dev libfreetype6-dev libsdl1.2-dev libtheora-dev libtool libva-dev | |
sudo apt-get -y install libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev pkg-config texinfo zlib1g-dev | |
# Source Dir | |
mkdir -p ~/ffmpeg_sources | |
# YASM, libx264 | |
sudo apt-get install -y yasm | |
sudo apt-get install -y libx264-dev | |
# libx265 | |
sudo apt-get install cmake mercurial | |
cd ~/ffmpeg_sources | |
hg clone https://bitbucket.org/multicoreware/x265 | |
cd ~/ffmpeg_sources/x265/build/linux | |
PATH="$HOME/bin:$PATH" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off ../../source | |
make | |
make install | |
make distclean | |
# libfdk-aac | |
cd ~/ffmpeg_sources | |
wget -O fdk-aac.tar.gz https://github.com/mstorsjo/fdk-aac/tarball/master | |
tar xzvf fdk-aac.tar.gz | |
cd mstorsjo-fdk-aac* | |
autoreconf -fiv | |
./configure --prefix="$HOME/ffmpeg_build" --disable-shared | |
make | |
make install | |
make distclean | |
# libmp3lame | |
sudo apt-get install -y libmp3lame-dev | |
# libopus | |
sudo apt-get install -y libopus-dev | |
# libvpx | |
cd ~/ffmpeg_sources | |
wget http://storage.googleapis.com/downloads.webmproject.org/releases/webm/libvpx-1.5.0.tar.bz2 | |
tar xjvf libvpx-1.5.0.tar.bz2 | |
cd libvpx-1.5.0 | |
PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests | |
PATH="$HOME/bin:$PATH" make | |
make install | |
make clean | |
# Build FFMPEG | |
cd ~/ffmpeg_sources | |
wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 | |
tar xjvf ffmpeg-snapshot.tar.bz2 | |
cd ffmpeg | |
PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \ | |
--prefix="$HOME/ffmpeg_build" \ | |
--pkg-config-flags="--static" \ | |
--extra-cflags="-I$HOME/ffmpeg_build/include" \ | |
--extra-ldflags="-L$HOME/ffmpeg_build/lib" \ | |
--bindir="$HOME/bin" \ | |
--enable-gpl \ | |
--enable-libass \ | |
--enable-libfdk-aac \ | |
--enable-libfreetype \ | |
--enable-libmp3lame \ | |
--enable-libopus \ | |
--enable-libtheora \ | |
--enable-libvorbis \ | |
--enable-libvpx \ | |
--enable-libx264 \ | |
--enable-libx265 \ | |
--enable-nonfree | |
PATH="$HOME/bin:$PATH" make | |
make install | |
make distclean | |
hash -r | |
# Add to PATH | |
source ~/.profile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name _; | |
location / { | |
# Change port, depending on where your actual app runs | |
proxy_pass http://localhost:3000; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection 'upgrade'; | |
proxy_set_header Host $host; | |
proxy_cache_bypass $http_upgrade; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# For Ubuntu 14.04 | |
# Git | |
sudo apt-get -y install git | |
# Install Mongo | |
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927 | |
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list | |
sudo apt-get update | |
sudo apt-get install -y mongodb-org=3.2.7 mongodb-org-server=3.2.7 mongodb-org-shell=3.2.7 mongodb-org-mongos=3.2.7 mongodb-org-tools=3.2.7 | |
echo "mongodb-org hold" | sudo dpkg --set-selections | |
echo "mongodb-org-server hold" | sudo dpkg --set-selections | |
echo "mongodb-org-shell hold" | sudo dpkg --set-selections | |
echo "mongodb-org-mongos hold" | sudo dpkg --set-selections | |
echo "mongodb-org-tools hold" | sudo dpkg --set-selections | |
sudo service mongod start | |
echo ">>> Mongo. CHECK" | |
# Node 6 | |
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - | |
sudo apt-get install -y nodejs | |
sudo apt-get install -y build-essential | |
echo ">>> Node. CHECK" | |
# PM2 | |
sudo npm install -g pm2 | |
sudo pm2 startup ubuntu | |
echo ">>> PM2. CHECK" | |
# Nginx | |
sudo apt-get update | |
sudo apt-get install -y nginx | |
sudo service nginx restart | |
echo ">>> Nginx. CHECK" | |
echo "Congrats, your system is ready to run the high-powered MEAN stack." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Last script to run, just create an unprivileged web user | |
sudo adduser inet | |
# Copy FFMPEG to inet | |
# If you didn't install FFMPEG, you can run this script just fine | |
sudo mkdir -p /root/bin | |
# Copy bin | |
sudo mkdir -p /home/inet/bin | |
sudo cp /root/bin/* /home/inet/bin | |
# Edit Path | |
sudo echo -e "PATH=\"\$PATH:/home/inet/bin\"" >> /home/inet/.bashrc | |
# Log in as inet | |
su inet | |
source ~/.bashrc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment