æ¬çªç°å¢ã«perlã¨ãrubyã¨ãnodeãå
¥ãããã ãã©ããã¡ãã system perl ãããã£ã¦ãããªãã®ã§æå®ãããã¼ã¸ã§ã³ã®ãã®ãä¸è¬ã¦ã¼ã¶ã®ç®¡çä¸ã«çªã£è¾¼ã¿ããã
ã§ãããããã®ãããã¾ã§ perlbrew ã¨ã rvm ã¨ã rbenv ã¨ã nvm ã¨ã nodebrew ã¨ãã§ãã£ã¦ããã ãã©ããããã«è²ã
çåã湧ãã¦ããããããã§åçºå®è¡ããããã« eval "$(rbenv init -)" ã¨ããããã«ãããããï¼ ã¿ãããªã
ã¨ãããã¨ã§ tokuhirom method çã«ã¤ã³ã¹ãã¼ã«ç¨ã®ç°¡åã³ãã³ãã使ã£ã¦å®è¡ããã¨ã¯ãã¹ãéãã°ããããããã¨ãããã¨ã«ããããã¨æãã
åè: サーバーのセットアップは perlbrew とかじゃなくてよくね? という時のライフハック - blog.64p.org
ãããä»æã¾ã§ã¯ Perl::Build ãã©ãã«ããã¦CPANããã¨ã£ã¦ãã¦ã¤ã³ã¹ãã¼ã«ããªãã¨ãããªãã£ãã®ãããã¯ã§ã©ãããããã¨æã£ã¦ããã ãã©ããªãããé¡ãããã perl-build ã¹ã¯ãªããåä½ã§å®è¡å¯è½ãªããã«ããã±ã¼ã¸ã³ã°ãã¦ãããã®ã§è¶ ç°¡åã«ãªã£ããtokuhirom++
ããã ãã§ãããã£ããã ãã© cpanm ã¨ã carton ã¯ç¢ºå®ã«ä½¿ã + ãããããã°ã©ã³ã¿ã¤ã ã°ãã¼ãã«ã«ã¢ã¸ã¥ã¼ã«ãå ¥ããªãã¦ããããªãããæåããå ¥ã£ã¦ã¦ã»ããããã£ã¦ãã¨ã§ããã®ãããã®ã»ããã¢ãããã¤ãã§ã«ãã£ã¦ããããããªã¹ã¯ãªãããé©å½ã«æ¸ããã
(3/28追è¨: githubã«ä¸ãã https://github.com/tagomoris/xbuild )
ãããªæãã§ä½¿ãã
xbuild/perl-install 5.16.3 ~/local/perl-5.16 xbuild/ruby-install 2.0.0-p0 ~/local/ruby-2.0.0 xbuild/node-install v0.10.1 ~/local/node-v0.10 export PATH=$HOME/local/perl-5.16/bin:$PATH cd myproject1 cpanm -Lextlib -n --installdeps . # or carton install ... perl -Iextlib/lib/perl5 -Ilib my_script.pl # carton exec ... export PATH=$HOME/local/ruby-2.0.0/bin:$PATH cd myproject2 bundle install --path vendor bundel exec ruby my_script.rb
ãªã以ä¸ã®ã¹ã¯ãªããã¯ãã¹ã¦ã¹ã¯ãªããèªèº«ããããã£ã¬ã¯ããªã« bin/ ã var/ ãæã£ã¦ä½¿ãã®ã§ xbuild/ 以ä¸ã«éé¢ãã¦ç½®ãã¦ããã®ããããã³ã¼ãã®ææ°çã«ã¤ãã¦ã¯ github ãåç §ã®ãã¨ã
#!/bin/bash TARGET_VERSION=$1 LOCATION=$2 if [ "x"$TARGET_VERSION = "x-h" -o "x"$TARGET_VERSION = "x--help" -o "x"$LOCATION = "x" ]; then echo "[usage] perl-install VERSION LOCATION" echo " ex: perl-install 5.16.3 ~/local/perl-5.16" exit 0 fi cd $(dirname $0) mkdir -p ./bin curl -s https://raw.github.com/tokuhirom/Perl-Build/master/perl-build > ./bin/perl-build curl -s -L http://cpanmin.us/ > ./bin/fatpack_cpanm perl ./bin/perl-build $TARGET_VERSION $LOCATION > /tmp/perl-install.log 2>&1 RETVAL=$? if [ $RETVAL != 0 ]; then echo "perl-build failed. see log: /tmp/perl-install.log" exit 1 fi $LOCATION/bin/perl ./bin/fatpack_cpanm --notest App::cpanminus Carton App::pmuninstall > /tmp/perl-install-cpanm.log 2>&1 RETVAL=$? if [ $RETVAL != 0 ]; then echo "failed to install cpanm/carton. see log: /tmp/perl-install-cpanm.log" exit 2 fi echo "perl $TARGET_VERSION (and cpanm/carton) successfully installed on $LOCATION" echo "To use this perl, do 'export PATH=$LOCATION/bin:\$PATH'."
rubyã«ã¤ãã¦ãrbenvã¨ããããã¼ããruby-buildã§ãããã ãã©ruby-buildã®ã¤ã³ã¹ãã¼ã«ããã¡ãã¡ããã®ãããã©ãããããã¨ãããã¨ã§å®å ¨ã«åãã¤ã³ã¿ã¼ãã§ã¤ã¹ã§ãããã¨æ¸ããã
#!/bin/bash TARGET_VERSION=$1 LOCATION=$2 if [ "x"$TARGET_VERSION = "x-h" -o "x"$TARGET_VERSION = "x--help" -o "x"$LOCATION = "x" ]; then echo "[usage] ruby-install VERSION LOCATION" echo " ex: ruby-install 1.9.3-p392 ~/local/ruby-1.9.3" exit 0 fi cd $(dirname $0) XBUILD_PATH=$(pwd) if [ ! -d ./var/ruby-build ]; then ( set -e mkdir -p var cd var git clone -q git://github.com/sstephenson/ruby-build.git ruby-build-repo cd ruby-build-repo PREFIX=$XBUILD_PATH/var/ruby-build ./install.sh >/dev/null 2>&1 ) || (echo "failed to download ruby-build" && exit 1) fi ./var/ruby-build/bin/ruby-build $TARGET_VERSION $LOCATION > /tmp/ruby-install.log 2>&1 RETVAL=$? if [ $RETVAL != 0 ]; then echo "ruby-build failed. see log: /tmp/ruby-install.log" exit 1 fi $LOCATION/bin/gem install --no-rdoc --no-ri bundler pry > /tmp/ruby-install-bundler.log 2>&1 RETVAL=$? if [ $RETVAL != 0 ]; then echo "gem install failed. see log /tmp/ruby-install-bundler.log" exit 2 fi echo "ruby $TARGET_VERSION successfully installed on $LOCATION" echo "To use this ruby, do 'export PATH=$LOCATION/bin:\$PATH'."
node.jsã®å ´åã¯åOSããã³CPUã¢ã¼ããã¯ãã£ãã¨ã«ãã¤ããªãç´°ããç¨æããã¦ã¦ããã¤ãè½ã¨ãã¦ãã¦å±éããã ãã§ãããã ãã©ãã¾ãã¤ãã§ãªã®ã§ãããããªãããããå½¢ã«ãã¦ããã° v0.10.0 -> v0.10.1 ã¸ã®ã¢ãããã¼ããåã ~/local/node-v0.10/ ã¨ãããã¹ä¸ã§è¡ããã¨ãããããªç¨éã®ã¨ãã«ã¤ã³ã¹ãã¼ã«ã³ãã³ããå©ãç´ãã ãã§å®è¡ã§ãããã¨ããã¡ãªãããããã(ããã¯perl/rubyãåã)
#!/bin/bash TARGET_VERSION=$1 LOCATION=$2 ARCH=$3 if [ "x"$TARGET_VERSION = "x-h" -o "x"$TARGET_VERSION = "x--help" -o "x"$LOCATION = "x" ]; then echo "[usage] node-install VERSION LOCATION [arch]" echo " ex: node-install v0.10.1 ~/local/node-v0.10" echo " ex: node-install v0.10.1 ~/local/node-v0.10 darwin-x86" echo " default arch is 'linux-x64'" exit 0 fi if [ "x"$ARCH = "x" ]; then ARCH="linux-x64" fi cd $(dirname $0) ARCHIVE_FILENAME="node-"$TARGET_VERSION"-"$ARCH".tar.gz" ARCHIVE_DIRNAME="node-"$TARGET_VERSION"-"$ARCH set -e mkdir -p var/node-archive cd var/node-archive curl -s -O http://nodejs.org/dist/$TARGET_VERSION/$ARCHIVE_FILENAME cd .. tar xzf node-archive/$ARCHIVE_FILENAME if [ -d $LOCATION ]; then [[ -d $LOCATION.replaced ]] && rm -rf $LOCATION.replaced mv $LOCATION $LOCATION.replaced else mkdir -p $LOCATION && rmdir $LOCATION fi mv $ARCHIVE_DIRNAME $LOCATION echo "node $TARGET_VERSION successfully installed on $LOCATION" echo "To use this node, do 'export PATH=$LOCATION/bin:\$PATH'."
ãããã®ãããã·ã³ãã«ã§ããããããã使ãã¨ãã¯PATHãéãã以ä¸ã