Skip to content

Instantly share code, notes, and snippets.

@oknoorap
Last active August 1, 2016 09:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oknoorap/17b9a2d576a5d8009928 to your computer and use it in GitHub Desktop.
Save oknoorap/17b9a2d576a5d8009928 to your computer and use it in GitHub Desktop.
Install Golang 1.4.2, NodeJS, MongoDB, PM2, Nginx in Ubuntu
#!/bin/bash
wget https://storage.googleapis.com/golang/go1.6.3.linux-386.tar.gz
tar go1.6.3.linux-386.tar.gz
sudo rm -rf /opt/go
sudo rm -rf /opt/gopkg
sudo mv go /opt/
sudo mkdir -p /opt/gopkg
export GOPATH="/opt/gopkg"
export GOROOT="/opt/go"
export GOBIN=$GOPATH/bin
sudo echo export GOPATH=/opt/gopkg >> ~/.bashrc
sudo echo export GOROOT=/opt/go >> ~/.bashrc
sudo echo export GOBIN=$GOPATH/bin >> ~/.bashrc
sudo echo export PATH=$PATH:$GOROOT/bin:$GOPATH/bin:$GOBIN >> ~/.bashrc
export PATH=$PATH:$GOPATH/bin:$GOROOT/bin:$GOBIN
#!/bin/bash
wget https://storage.googleapis.com/golang/go1.6.3.linux-amd64.tar.gz
tar -zxvf go1.6.3.linux-amd64.tar.gz
sudo rm -rf /opt/go
sudo rm -rf /opt/gopkg
sudo mv go /opt/
sudo mkdir -p /opt/gopkg
export GOPATH="/opt/gopkg"
export GOROOT="/opt/go"
export GOBIN=$GOPATH/bin
sudo echo export GOPATH=/opt/gopkg >> ~/.bashrc
sudo echo export GOROOT=/opt/go >> ~/.bashrc
sudo echo export GOBIN=$GOPATH/bin >> ~/.bashrc
sudo echo export PATH=$PATH:$GOROOT/bin:$GOPATH/bin:$GOBIN >> ~/.bashrc
export PATH=$PATH:$GOPATH/bin:$GOROOT/bin:$GOBIN
#!/bin/bash
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org
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
#!/bin/bash
curl https://raw.githubusercontent.com/creationix/nvm/v0.11.1/install.sh | bash
source ~/.profile
nvm ls-remote
sudo apt-get install git
nvm install 0.10.39
n=$(which node);n=${n%/bin/node}; chmod -R 755 $n/bin/*; sudo cp -r $n/{bin,lib,share} /usr/local
#!/bin/bash
if [ $(dpkg-query -W -f='${Status}' go 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
echo "Install Golang..."
wget -q https://gist.github.com/oknoorap/17b9a2d576a5d8009928/raw/a63e691753aec15de7f54b3d2742e16e15b12983/install-64.sh
chmod +x install-64.sh
sudo ./install-64.sh
fi
if [ $(dpkg-query -W -f='${Status}' mongo 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
echo "Install MongoDB..."
wget https://gist.github.com/oknoorap/17b9a2d576a5d8009928/raw/9f4b877bfd9e2e692f4f7bf540ef3c5a190e71af/install-mongodb.sh
chmod +x install-mongodb.sh
sudo ./install-mongodb.sh
fi
if [ $(dpkg-query -W -f='${Status}' nvm 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
echo "Install NVM..."
wget https://gist.github.com/oknoorap/17b9a2d576a5d8009928/raw/3b7cc4e4fb8372febdd3986ee6c5182e209558aa/install-nvm.sh
chmod +x install-nvm.sh
sudo ./install-nvm.sh
npm install pm2 -g
fi
if [ $(dpkg-query -W -f='${Status}' nginx 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
echo "Installing Nginx..."
sudo apt-get install nginx -y >/dev/null
fi
sudo reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment