Centos6.5でrbenvとphantomjsを構築したメモ

依存ライブラリをインストール

sudo yum -y install git gcc gcc-c++ make flex bison gperf ruby \
  openssl-devel freetype-devel fontconfig-devel libicu-devel sqlite-devel \
  libpng-devel libjpeg-devel readline-devel

日本語のフォントをインストール

sudo yum -y groupinstall "Japanese Support"

rbenvをインストール

git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
git clone https://github.com/jamis/rbenv-gemset.git ~/.rbenv/plugins/rbenv-gemset
git clone https://github.com/sstephenson/rbenv-gem-rehash.git ~/.rbenv/plugins/rbenv-gem-rehash

rbenvのパスを設定

echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc

rubyをインストール

rbenv install 2.2.4
rbenv rehash
rbenv versions
rbenv global 2.2.4
rbenv rehash
rbenv versions

bundlerをインストール

gem install bundler

rubyバージョン確認

ruby -v 

pipインストール

cd /usr/local/src
sudo wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
pip install argparse

ソースチェックアウトしてからインストール

cd /usr/local/src
sudo git clone git://github.com/ariya/phantomjs.git
cd phantomjs/
sudo git checkout 2.1.1
sudo git submodule init
sudo git submodule update
## build開始(少し時間が掛かる)
sudo python build.py

PATH直下に移動

sudo cp /usr/local/src/phantomjs/bin/phantomjs /usr/local/bin/
phantomjs --version
2.1.1

qmake配置

sudo cp -a /usr/local/src/phantomjs/src/qt/qtbase/bin/qmake /usr/local/bin/

git変更は敢えて変更無視

=================================================================
git変更は敢えて変更無視するように変更する
=================================================================
# assume-unchangedに追加
git update-index --assume-unchanged [ファイル名]
# assume-unchangedから削除
git update-index --no-assume-unchanged [ファイル名]
# 一覧を確認
git ls-files -v | grep '^[[:lower:]]'

xprofのインストールメモ


xhprof

参考 http://qiita.com/w_cota/items/48667a845cd06d969d4a

vi newrelic.ini [xhprof] extension=xhprof.so xhprof.output_dir=“/var/log/xhprof/”


mongo

// mongo php install http://qiita.com/nownabe/items/123a8fd04ff5252b3036

sudo service mongod start 下記のエラー発生した場合、空き容量が足りないため、configを修正 ERROR: Insufficient free space for journal files http://qiita.com/dice-k/items/d7e56e8ad788d7150090

pecl install mongo

vi /etc/php.d/mongo.ini [mongo] extension=mongo.so

mcryptはなかったら、インストールが必要

yum install php-mcrypt

github https://github.com/preinheimer/xhprof https://github.com/perftools/xhgui

https://www.digitalocean.com/community/tutorials/how-to-set-up-xhprof-and-xhgui-for-profiling-php-applications-on-ubuntu-14-04

https://github.com/preinheimer/xhprof https://github.com/perftools/xhgui

centos6.2 -> centos7 バージョンアップ

### 念のため、chkconfig --listを取っておきましょう!
$ yum update -y
$ reboot

$ vim /etc/yum.repos.d/CentOS-Base.repo
### 下記を追加
[upg]
name=CentOS-$releasever - Upgrade Tool
baseurl=http://dev.centos.org/centos/6/upg/x86_64/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

$ yum install -y openscap pcre-devel libxml2-devel libxslt-devel m2crypto python-simplejson
$ yum install -y mod_wsgi redhat-upgrade-tool preupgrade-assistant-contents

### 一覧を確認し、対象にアップグレード
$ preupg --list
$ rpm -qa | grep openscap
openscap-1.2.8-2.el6.centos.x86_64
# rpm -Uhv --oldpackage http://dev.centos.org/centos/6/upg/x86_64/Packages/openscap-1.0.8-1.0.1.el6.centos.x86_64.rpm

$ preupg -s CentOS6_7
Do you want to continue? y/n  ###y

$ rpm --import http://ftp.plusline.de/centos/7/os/x86_64/RPM-GPG-KEY-CentOS-7
### ⬆を行わないと、下記のように怒られる
### Downloading failed:The GPG keys listed for the "CentOS-7.0 - Base" repository are already installed but they are not correct for this package. 

$ redhat-upgrade-tool-cli --network 7.0 --instrepo http://mirror.centos.org/centos/7/os/x86_64/ --force
Continue with the upgrade [Y/N]?  ### y