pyenv
pyenvのインストール
- ダウンロード
git clone https://github.com/yyuu/pyenv.git ~/.pyenv
- 環境変数設定
echo 'export PYENV_ROOT="~/.pyenv"' >> ~/.zshrc echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
- 初期化
echo 'eval "$(pyenv init -)"' >> ~/.zshrc
pythonインストール
ex. ver3.4.3のインストール
pyenv install 3.4.3
pythonインストールしたら必ず以下を実行する必要あり
pyenv rehash
利用
pyenv global 3.4.3
fluentdインストールと簡単な使い方
fluentdのdocumentはこちら
http://docs.fluentd.org/articles/quickstart
インストール
インストール前の以下の確認が必要。
- NTPの設定(ntpdのセットアップ)
時間は大事。
ulimit -n
の確認
1024では不十分とのこと。65535まではあげて、とのこと。
/etc/sysctl.conf
の確認
複数のfluentdインスタンスがたち、高負荷になることを想定するなら以下の設定を追加。
net.ipv4.tcp_tw_recycle = 1 net.ipv4.tcp_tw_reuse = 1 net.ipv4.ip_local_port_range = 10240 65535
インストールは以下のスクリプトで行うのが、簡単だと思う。
$ curl -L https://toolbelt.treasuredata.com/sh/install-redhat-td-agent2.sh | sh
これより以下は上記でインストールした場合を想定。
- 起動(スクリプトの実行)
$ sudo /etc/init.d/td-agent start
サポートしているコマンドは'start', 'stop', 'restart', 'status'
。
設定
設定ファイルは/etc/td-agent/td-agent.conf
。
設定はviで行う。以下のディレティブがある。
source directives determine the input sources. match directives determine the output destinations. filter directives determine the event processing pipelines. system directives set system wide configuration. label directives group the output and filter for internal routing @include directives include other files.
- プラグインの導入
$ /usr/sbin/td-agent-gem install <plugin name>
様々なプラグイン
工事中。。。
zsh
インストール
$brew install zsh
※mac & homebrewが入っている前提
ログインシェルの変更 (変更対象のユーザでログイン後)
/etc/shells に「/usr/local/bin/zsh」 を追加 ログインシェルとして選択できるようにする
ログインユーザのログインシェルを変更
$chsh -s /usr/local/bin/zsh
- 反映
$source ~/.zshrc
設定(強力補完機能)
~/.zshrc に以下を追記。なかったら作る。
$autoload -U compinit compinit
アップデート
$brew upgrade zsh
コンポーネント情報の確認
$brew info zsh
vertualenv
仮想環境の作成
環境作成ディレクトリで以下を実行。
$ vertualenv [project]
アクティベート
$ source [project]/bin/activate
確認。
$ which python
仮想環境下のbinを指しているはず。
ディアクティベート
$ deactivate
python環境構築
1. Pythonのインストール
pythonのインストール。2系と3系では互換がないので注意が必要。 2系が主流のようだが、今後は3系なのかな?
http://www.python.org/download/ (Windowsでなければ、大体初めから入っていると思われます。まずはご確認を。)
豊富なパッケージの恩恵を受けるなら、まずはpythonパッケージ管理システム(pip)のインストール 以下のスクリプトをダウンロードして実行する。
$ sudo wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py $ sudo python get-pip.py
※pip 1.5.1以前はsetuptoolsのインストールが事前に必要でしたが、 上記スクリプトのおかげで必要なくなったようです。(スクリプトで実施してくれる)
または、ディストリビューションのパッケージ管理システムからインストール
$ sudo yum install python-pip
確認。
$ pip --version
2. パッケージのインストール
vertualenvをインストール
$ sudo pip install vertualenv $ vertualenv
OK!!
リポジトリ作成(リモートとの連動)
ローカルのリポジトリとリモートのリポジトリを連動させる方法について記述
1. リモートリポジトリの作成
以下、リモートサーバで実施。(/organization)
$ mkdir sample-repo.git $ sample-repo.git $ git --bare init --share
※サーバ管理者ではなくて、リポジトリを作成できる権限がある場合はWeb上で実施
2. ローカルリポジトリの作成 以下はローカルで実施。
$ mkdir sample-repo $ cd sample-repo $ git init $ git add . $ git commit -m "initial commit"
3. ローカルリポジトリとリモートリポジトリの連動
$ git remote add origin http://git.remote.host/organization/sample-repo.git $ git config branch.master.remote origin $ git config branch.master.merge refs/heads/master $ git pull $ git push
(ご参考)
4. リモートリポジトリ変更
$ git remote set-url origin git@git.example.com:foo/bar.git
本流リポジトリへの追いつき
本流のリポジトリの変更を取得し、フォーク先を最新化する。
1. 本流リポジトリの追加 (対象ディレクトリで)
$ git remote add upstream http://main.git.local/main/repository.git
2. 本流リポジトリ(upstream)からfetchしてブランチの確認
$ git fetch upstream $ git branch -a
(たとえばこんな表示がされる)
* master remotes/origin/HEAD -> origin/master remotes/origin/master remotes/upstream/master
3. マージ
$ git merge upstream/master
あとはいつも通り、変更をコミット。フォーク先にpushして最新化完了。