Skip to content

Instantly share code, notes, and snippets.

@oranie
Created June 27, 2018 09:19
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 oranie/6b8345ced4bd665b0e941b55981411b7 to your computer and use it in GitHub Desktop.
Save oranie/6b8345ced4bd665b0e941b55981411b7 to your computer and use it in GitHub Desktop.
build.sh
[ec2-user@ip-172-31-0-174 ~]$ cat ./build.sh
VERSION="3.2.0"
CPU=`grep processor /proc/cpuinfo | wc -l`
sudo yum -y install openssl-devel libxml2-devel gcc gcc-c++ ruby22-devel git patch vim readline-devel rpm-build autoconf htop
sudo update-alternatives --set ruby /usr/bin/ruby2.2
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
source .bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
source ~/.bash_profile
MAKE_OPTS="-j $CPU" rbenv install 2.4.2
rbenv global 2.4.2
git clone https://github.com/treasure-data/omnibus-td-agent.git
cd ./omnibus-td-agent/
git branch -m master remotes/origin/td-agent-$VERSION
git checkout -b refs/tags/td-agent-$VERSION
git pull origin td-agent-$VERSION
echo "gem 'ohai', '8.24.0'" >> Gemfile
mv ./Gemfile.lock ./Gemfile.lock_old
gem install bundle
bundle install --binstubs --jobs=$CPU
BUILD_TD_AGENT_VERSION=3 bin/gem_downloader core_gems.rb
BUILD_TD_AGENT_VERSION=3 bin/gem_downloader plugin_gems.rb
sudo mkdir -p /opt/td-agent /var/cache/omnibus && sudo chown ec2-user /opt/td-agent && sudo chown ec2-user /var/cache/omnibus
bin/omnibus build td-agent3
echo "end"
[ec2-user@ip-172-31-0-174 ~]$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment