SSH鍵交換メモ ssh-copy-id使う
// 鍵生成 $ ssh-keygen -t dsa -N '' -f ~/.ssh/id_dsa $ ls .ssh/ id_rsa id_rsa.pub // リモートマシンに登録 $ ssh-copy-id -i ~/.ssh/id_dsa.pub ymko@192.168.1.10 26 The authenticity of host '192.168.1.10 (192.168.1.10)' can't be established. RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.1.10' (RSA) to the list of known hosts. ymko@192.168.1.10's password: Now try logging into the machine, with "ssh 'ymko@192.168.1.10'", and check in: .ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting. // 通る! $ ssh 192.168.1.8 ls .ssh/authorized_keys .ssh/authorized_keys
$ ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa Permission denied, please try again. // パスワード認証を許可していないとか、パスワードが間違っているとか。確認。
ゲストの時計設定
- KVMゲストOSの時刻合わせ - 銀の鍵
- おお、これでホストの時計から取ってくれるらしい。
# diff -Naur /etc/libvirt/qemu/arestrea.xml{.o,} --- /etc/libvirt/qemu/arestrea.xml.o 2010-10-23 23:29:07.808356536 +0900 +++ /etc/libvirt/qemu/arestrea.xml 2010-10-24 01:48:04.080512727 +0900 @@ -13,7 +13,7 @@ <apic/> <pae/> </features> - <clock offset='utc'/> + <clock offset='localtime'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> # virsh define /etc/libvirt/qemu/arestrea.xml # ゲスト起動
再再々度入門
// gcc と zlib-devel が必要 $ wget http://kernel.org/pub/software/scm/git/git-1.7.3.2.tar.bz2 $ tar xvfj git-1.7.3.2.tar.bz2 $ cd git-1.7.3.2 $ mkdir -p ~/usr/local $ ./configure --prefix=$HOME/usr/local $ make $ make install $ echo "PATH=\$PATH:\$HOME/usr/local/bin" >> ~/.bashrc // 上記の.gitconfigをおもむろに貼りつけ(nameとmailは書き換える) $ vi ~/.gitconfig
-
- アプリ作成開始
$ mkdir remote_inst $ cd !$ $ cat >test.pl #!/usr/bin/perl use strict; use warnings; print "hello world!\n"; exit 0; // ローカルリポジトリ $ git init $ git add test.pl $ git ci -m "first commit" // リモートリポジトリ $ ssh 192.168.1.8 mkdir -p git/remote_inst.git $ ssh 192.168.1.8 git --bare init git/remote_inst.git Initialized empty Git repository in /home/nymph/git/remote_inst.git/ // リモートリポジトリはどこか登録 $ git remote add origin ssh://nymph@192.168.1.8/home/nymph/git/remote_inst.git fatal: remote origin already exists. // もう既に登録済みエラー。実験で作成したのが残っていたので削除する $ git config -l | grep origin.url remote.origin.url=ssh://nymph@192.168.1.8/tmp/remote_inst $ git remote rm origin // 改めて $ git remote add origin ssh://nymph@192.168.1.8/home/nymph/git/remote_inst.git // 送信! $ git push origin master Counting objects: 3, done. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 273 bytes, done. Total 3 (delta 0), reused 0 (delta 0) To ssh://nymph@192.168.1.8/home/nymph/git/remote_inst.git * [new branch] master -> master // できたかな? $ mkdir ../tmp $ cd !$ $ git clone ssh://nymph@192.168.1.8/home/nymph/git/remote_inst.git Cloning into remote_inst... remote: Counting objects: 3, done. remote: Compressing objects: 100% (2/2), done. remote: Total 3 (delta 0), reused 0 (delta 0) Receiving objects: 100% (3/3), done.
- まとめ
- 追記 リモートリポジトリはこんな風にしてみた
# mkdir /var/git/ # chown root.users !$ # chmod 2770!$ $ ssh 192.168.1.8 mkdir /var/git/remote_inst.git $ ssh 192.168.1.8 git init --bare --shared /var/git/remote_inst.git $ git remote add origin ssh://192.168.1.8/var/git/remote_inst.git $ git push origin master Counting objects: 3, done. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 273 bytes, done. Total 3 (delta 0), reused 0 (delta 0) To ssh://192.168.1.8/var/git/remote_inst.git * [new branch] master -> master
-
- さくらインターネットをgitの共用リポジトリにする方法 - Dive into the Tech World!
- gitの中央repos運用時のパーミッションの調整 - (ひ)メモ
- Gitを使いこなすための20のコマンド - SourceForge.JP Magazine : オープンソースの話題満載
- Pro Git - Pro Git 4.2 Git サーバー サーバー用の Git の取得
- Gitを使いこなすための20のコマンド - SourceForge.JP Magazine : オープンソースの話題満載
- git/git rebaseを元に戻す方法 - TOBY SOFT wiki
- -> なんかわからんようになったら git reset
virt-clone試してみた
先日作ったikaros(CentOS5.5)をコピー
# virt-clone --original ikaros --name nymph --file nymph.img Cloning ikaros.img 100% |=========================| 2.0 GB 01:01 Clone 'nymph' created successfully. // VM設定ファイルも出来てる # diff -Naur /etc/libvirt/qemu/{ikaros.xml,nymph.xml} --- /etc/libvirt/qemu/ikaros.xml 2010-10-23 01:24:34.527172445 +0900 +++ /etc/libvirt/qemu/nymph.xml 2010-10-23 21:35:02.843401503 +0900 @@ -1,6 +1,6 @@ <domain type='kvm'> - <name>ikaros</name> - <uuid>4f83ff72-9f49-b76b-0415-e2fe12bbc6e7</uuid> + <name>nymph</name> + <uuid>22ad5503-5075-692d-b309-821d12237f2f</uuid> <memory>524288</memory> <currentMemory>524288</currentMemory> <vcpu>1</vcpu> @@ -21,12 +21,12 @@ <emulator>/usr/bin/kvm</emulator> <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> - <source file='/home2/ikaros.img'/> + <source file='/home2/nymph.img'/> <target dev='vda' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </disk> <interface type='bridge'> - <mac address='52:54:00:e6:cf:b4'/> + <mac address='00:16:36:f7:93:36'/> <source bridge='br0'/> <model type='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> //変更すべきところ /etc/hosts /etc/sysconfig/network /etc/sysconfig/network/ifcfg-eth0 //あとユーザーを作るとか、rootのパスワード変えるとか・・ macアドレスは上記のVM設定ファイルから取ってVMのifcfg-eth0につける useradd nymph -g users
Bringing up interface eth0: Device eth0 has different MAC address than expected, ignoring. [FAILED] # ifconfig eth0 | grep HWaddr | awk '{print $5}' 00:16:36:FC:F5:6C # ifconfig eth0 | grep HWaddr | perl -ane 'print pop(@F), "\n"' 00:16:36:FC:F5:6C ↑perldoc perlrun の -a の説明参照
-
- 追記こんなのもあるとか
- kvmclone.plで楽々仮想マシン作成 - kj-kiのはてなダイアリー