Skip to content

Instantly share code, notes, and snippets.

@tkuchiki
tkuchiki / gist:9347861
Created Mar 4, 2014
Vagrant で Centos6.5 を立てて Docker を install
View gist:9347861
# http://www.1x1.jp/blog/2013/12/docker_on_centos65.html
# Mac
vagrant init opscode-centos65 http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-6.5_chef-provisionerless.box
vagrant up
vagrant ssh
# CentOS 6.5
sudo rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
yum -y install docker-io
View gist:9388153
# ローカルファイルを圧縮したものを、リモートサーバに直接送る
tar -cz /path/to/{dir,file} | ssh your_server "cat /path/to/file.tar.gz"
# ローカルのシェルスクリプトをリモートサーバで実行
cat << EOF | ssh REMOTE_HOST "bash"
hostname
/sbin/ifconfig
EOF
@tkuchiki
tkuchiki / create_user.sh
Last active Aug 29, 2015
linux のリモートサーバにユーザを作成する
View create_user.sh
#!/bin/bash
_HOST=""
_USER=""
_PUBKEY=""
_UID=""
_GROUP=""
SHADOW=""
SSH_OPTIONS=""
View gist:9458536
getent passwd | awk -F':' '{ print $1}' | grep -w USERNAME
View gist:9543025
# rpm をダウンロードするだけ
yum install --downloadonly --downloaddir=/path/to/dir
# 依存関係を考慮して削除
yum install yum-plugin-remove-with-leaves
yum remove --remove-leaves PACKAGE
@tkuchiki
tkuchiki / gist:9971439
Last active Aug 29, 2015
ssh 多段ポートフォワーディング
View gist:9971439
# sshを実行するマシンの localhost:5900 -> remote1:5900, remote1 の localhost:5900 -> remote2:5900
## -f をつければバックグラウンドで実行
ssh -t -L 5900:localhost:5900 user@remote1 ssh -t -N -L 5900:localhost:5900 user@remote2
View gist:10014084
yum install -y kvm libvirt virt-install
@tkuchiki
tkuchiki / varnish-release.spec
Last active Aug 29, 2015
varnish-release 4.0 rpm
View varnish-release.spec
Name: varnish-release
Version: 4.0
Release: 1%{?dist}
Summary: Varnish 4.0 package repository configuration
Group: System Environment/Base
License: BSD
URL: http://www.varnish-software.com/installation/redhat
View gist:10447527
# 証明書アップロード
# http://docs.aws.amazon.com/cli/latest/reference/iam/upload-server-certificate.html
$ aws iam upload-server-certificate --server-certificate-name example.com --certificate-body file:///path/to/example.com.crt --private-key file:///path/to/example.com.key --certificate-chain file:///path/to/example.com.ca
SERVERCERTIFICATEMETADATA arn:aws:iam::123456789012:server-certificate/example.com / XXXXXXXXXXXXXXXXXXXXX example.com 2014-04-11T07:43:32.214Z
# Listener 作成
# http://docs.aws.amazon.com/cli/latest/reference/elb/create-load-balancer-listeners.html
$ aws elb create-load-balancer-listeners --load-balancer-name test-elb --listeners "Protocol=https,LoadBalancerPort=443,InstanceProtocol=http,InstancePort=80,SSLCertificateId=arn:aws:iam::123456789012:server-certificate/example.com"
# Listener の証明書変更
@tkuchiki
tkuchiki / gist:10477692
Created Apr 11, 2014
install cpanm for CentOS 6
View gist:10477692
yum install -y perl-ExtUtils-MakeMaker perl-Module-Build perl-CPAN
curl -L http://cpanmin.us/ | perl - App::cpanminus