2015년 3월 27일 금요일

How to kill screen

List screens:
screen -list
Output:
There is a screen on:
23536.pts-0.wdzee       (10/04/2012 08:40:45 AM)        (Detached)
1 Socket in /var/run/screen/S-root.
Kill screen session:
screen -S 23536 -X quit

reference link:



2015년 3월 26일 목요일

How to mount qcow2 images

1. install qemu-utils and enable nbd module

sudo apt-get install qemu-utils
sudo modprobe nbd

2. use any qcow2 image

3. connect the image to the first nbd device

sudo qemu-nbd -c /dev/nbd0 xxx.img

4. Mount the image

sudo mount /dev/nbd0p1 /mnt

5. unmount
sudo umount /mnt

6. disconnect the loopback device
sudo qemu-nbd -d /dev/nbd0


2015년 3월 23일 월요일

hostname 변경하기

1. hostname 명령을 사용해 현재 값 확인

2. /etc/hostname의 값을 변경

3. hostname -F /etc/hostname

4. 새로운 터미널을 열어 확인

2015년 3월 21일 토요일

Install Eclipse on Ubuntu

1. download Eclipse
http://www.eclipse.org/downloads/

2. extract download file
$ tar xvfz eclipse-java-luna-SR2-linux-gtk-x86_64.tar.gz

3. move the "eclipse" entire directory to /opt/
  $ sudo mv ~/down/eclipse /opt/

4. make a script for eclipse
  $sudo vi /usr/bin/eclipse
  input followings into the script file
  
    #!/bin/sh
    export ECLIPSE_HOME=/opt/eclipse
    $ECLIPSE_HOME/eclipse $*
5. change permission to execute
  $ sudo chmod 755 /usr/bin/eclipse

6. run eclipse
  $ eclipse

2015년 3월 20일 금요일

putty + Xming 설정

1. Xming 설치 하면서 디폴트 따라가다가 아래화면에서
select "Multiple windows"


2. select "Start no client"

3.

4.  if needed, save configuration

5. putty  또는 kitty  로 리눅스 접속시 SSH >  X11 메뉴에서 아래 그림과 같이 "Enable X11 forwarding" 에  체크, 

X display location 에 localhost:0  입력하고 저장후 접속하면 된다.

6. putty 에서 xterm 등을 실행해서 잘 되는지 확인하면 된다.

7. Xming 에 실행한 프로그램 폰트를 키우고 싶다면
Xming.exe:0 -clipboard -multiwindow -dpi 96 -ac -lesspointer




WSGI 설명

WSGI 는 server 도 아니고, python moduel 도 아니고, fraemwork 도 아니고, API 나 어떤 종류의 소프트웨어도 아니다.
단지 서버와 어플리케이션이 서로 통신하는 방법에 대한 인터페이스 specification 이다.
따라서 서버와 어플리케이션은 둘 다 서로에 대한 인터페이스가 기술되어 있고 이런 내용은 PEP 3333 에 있다.
만약 어플리케이션 또는 프레임웍이 WSGI spec 에 따라 구현되었다면, 이것은 이 spec 에 따라 구현된 어떤 서버에서도 실행된다.

2015년 3월 19일 목요일

How to install Trove(Juno) using devstack and redstack

1. Install Trove Juno version using devstack and redstack
 : overall install using devstack and use redstack to build and register guest image for trove

2. Ubuntu upgrade
2.1 change package repository
if needed, change as follows

$ sudo sed -i s/kr.archive.ubuntu.com/ftp.jaist.ac.jp/g /etc/apt/sources.list

2.2 Ubuntu upgrade
rebooting may be needed

$ sudo apt-get update

$ sudo apt-get upgrade

$ sudo shutdown -ry 0

3. proxy 환경 설정
3. configuration for proxy
If you are using proxy server,
download your proxy certificate and copy it to following directory

/usr/share/ca-certificates/extra/xxx.crt

after copying and register the certificate as follows:

$ sudo dpkg-reconfigure ca-certificates (yes, select xxx.crt)

Edit /etc/environment as follows for using proxy

$ sudo vi /etc/environment
...
http_proxy="http://a.b.c.d:8080/"
https_proxy="https://a.b.c.d:8080/"
no_proxy="localhost,127.0.0.1,127.0.0.0/8,127.0.1.1,10.0.0.0/8"

4. Install devstack
* If you have ever installed devstack, it would be better to cleanup devstack related files.

$ ./unstack.sh
$ ./clean.sh
$ sudo rm -rf /opt/stack

4.1 git, pip install/config

$ sudo apt-get install git python-pip
$ sudo vi ~/.pip/pip.conf

[global]
cert = /usr/share/ca-certificates/extra/xxx.crt

4.2 devstack download

$ git clone http://github.com/openstack-dev/devstack
$ cd ~/devstack
$ git checkout stable/juno

4.3 Edit local.conf 

[[local|localrc]]

# Credentials
DATABASE_PASSWORD=openstack
ADMIN_PASSWORD=openstack
SERVICE_PASSWORD=openstack
SERVICE_TOKEN=openstack
RABBIT_PASSWORD=openstack

# Services
ENABLED_SERVICES=rabbit,mysql,key
ENABLED_SERVICES+=,n-api,n-crt,n-obj,n-cpu,n-cond,n-sch,n-novnc,n-cauth
ENABLED_SERVICES+=,n-net
#ENABLED_SERVICES+=,neutron,q-svc,q-agt,q-dhcp,q-l3,q-meta,q-lbaas
#ENABLED_SERVICES+=,q-svc,q-agt,q-dhcp,q-l3,q-meta,q-lbaas
ENABLED_SERVICES+=,s-proxy,s-object,s-container,s-account
ENABLED_SERVICES+=,g-api,g-reg
ENABLED_SERVICES+=,cinder,c-api,c-vol,c-sch,c-bak
ENABLED_SERVICES+=,heat,h-api,h-api-cfn,h-api-cw,h-eng
ENABLED_SERVICES+=,trove,tr-api,tr-tmgr,tr-cond
ENABLED_SERVICES+=,horizon

# Images
# Use this image when creating test instances
#IMAGE_URLS+=",http://cdn.download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-disk.img"
# Use this image when working with Orchestration (Heat)
#IMAGE_URLS+=",http://fedorapeople.org/groups/heat/prebuilt-jeos-images/F17-x86_64-cfntools.qcow2"
#IMAGE_URLS+=",http://download.fedoraproject.org/pub/fedora/linux/releases/21/Cloud/Images/x86_64/Fedora-Cloud-Base-20141203-21.x86_64.qcow2"

# Branches
KEYSTONE_BRANCH=stable/juno
NOVA_BRANCH=stable/juno
NEUTRON_BRANCH=stable/juno
SWIFT_BRANCH=stable/juno
GLANCE_BRANCH=stable/juno
CINDER_BRANCH=stable/juno
HEAT_BRANCH=stable/juno
TROVE_BRANCH=stable/juno
HORIZON_BRANCH=stable/juno

# Swift Configuration
SWIFT_REPLICAS=1
SWIFT_HASH=66a3d6b56c1f479c8b4e70ab5c2000f5

#[[post-config|$GLANCE_API_CONF]]
#[DEFAULT]
#default_store=file

# Enable Logging
LOGFILE=/opt/stack/logs/stack.sh.log
VERBOSE=True
LOG_COLOR=True
SCREEN_LOGDIR=/opt/stack/logs

4.4 Run stack.sh
$ ./stack.sh

Check whether each service is running properly using "screen -x stack"
You can access Horizon through web browser and test openstack

5. Install redstack
5.1 clone trove-integration

$ git clone https://github.com/openstack/trove-integration.git
$ cd trove-integration/scripts/

change strange passwords to "openstack" in "redstack.rc"
confirm that passwords in ~/devstck/local.conf are already same
(Do NOT run "redstack install")
$./redstack kick-start mysql

or
./redstack test-init
./redstack build-image mysql
./redstack kick-start mysql

5.2 Using postgresql
./redstack kick-start postgresql
or

./redstack build-image postgresql
./redstack kick-start postgresql

6. Trove test
Try to create DB instance using horizon or console


* Troubleshooting

1) Error occurred when redstack build-image mysql

+ mkdir -p /home/ubuntu/.gnupg
+ apt-key adv --keyserver hkp://keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.mcS9MWYPD8 --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver hkp://keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A
gpg: requesting key CD2EFD2A from hkp server keys.gnupg.net
gpg: keyserver timed out
gpg: keyserver receive failed: keyserver error
++ check_break after-error run_in_target bash
++ echo ''
++ egrep -e '(,|^)after-error(,|$)' -q
+ trap_cleanup
+ exitval=2
+ cleanup
+ unmount_image
+ sync
+ unmount_dir /tmp/image.37GDumKD/mnt
+ local pattern=/tmp/image.37GDumKD/mnt mnts=
+ '[' -n /tmp/image.37GDumKD/mnt ']'
++ awk '{print $2}'
++ sort -r
++ grep '^/tmp/image.37GDumKD/mnt'
+ mnts='/tmp/image.37GDumKD/mnt/var/cache/apt/archives
/tmp/image.37GDumKD/mnt/tmp/in_target.d
/tmp/image.37GDumKD/mnt/tmp/ccache
/tmp/image.37GDumKD/mnt/sys
/tmp/image.37GDumKD/mnt/proc
/tmp/image.37GDumKD/mnt/dev/pts
/tmp/image.37GDumKD/mnt/dev'
+ '[' -n '/tmp/image.37GDumKD/mnt/var/cache/apt/archives
/tmp/image.37GDumKD/mnt/tmp/in_target.d
/tmp/image.37GDumKD/mnt/tmp/ccache
/tmp/image.37GDumKD/mnt/sys
/tmp/image.37GDumKD/mnt/proc
/tmp/image.37GDumKD/mnt/dev/pts
/tmp/image.37GDumKD/mnt/dev' ']'
+ sudo umount -fl /tmp/image.37GDumKD/mnt/var/cache/apt/archives /tmp/image.37GDumKD/mnt/tmp/in_target.d /tmp/image.37GDumKD/mnt/tmp/ccache /tmp/image.37GDumKD/mnt/sys /tmp/image.37GDumKD/mnt/proc /tmp/image.37GDumKD/mnt/dev/pts /tmp/image.37GDumKD/mnt/dev
+ '[' -n '' ']'
+ cleanup_dirs
+ sudo rm -rf /tmp/image.37GDumKD/built
+ sudo rm -rf /tmp/image.37GDumKD/mnt
+ sudo umount -f /tmp/image.37GDumKD /tmp/image.N9h32DDz
+ rm -rf --one-file-system /tmp/image.37GDumKD /tmp/image.N9h32DDz
+ exit 2

-> refer to following link
http://unix.stackexchange.com/questions/138517/debian-gpg-cannot-fetch-linux-kernel-key
-> It seems that hkp port 11371 is blocked.
-> Due to googling, it could be resolved using 80 port.
-> grep -R "keys.gnupg.net" ~/trove-integration/scripts and in the result files, specify 80 port
-> When retrying, following error maybe occurs, but continue to retry, finally resolved.
+ apt-key adv --keyserver hkp://keys.gnupg.net:80 --recv-keys 1C4CBDCDCD2EFD2A
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.nMgJNOMIVX --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver hkp://keys.gnupg.net:80 --recv-keys 1C4CBDCDCD2EFD2A
gpg: requesting key CD2EFD2A from hkp server keys.gnupg.net
gpgkeys: key 1C4CBDCDCD2EFD2A not found on keyserver
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0

2) Error occurred when creating DB instance
ERROR trove.instance.models [-] An error occurred communicating with the guest: Timeout while waiting on RPC response - topic: "guestagent.8024bcd5-3192-40eb-8d60-249767338375", RPC method: "get_filesystem_stats" info: "<unknown>".

-> DB 인스턴스가 생성되는 VM 에 trove-guestagent 데몬에 에러가 발생한 경우이므로, 직접 VM 에 접속해서 아래 명령어를 실행해서 소스 레벨에서 원인 파악한다.

/usr/bin/python /home/ubuntu/trove/contrib/trove-guestagent --config-file=/etc/guest_info --config-file=/etc/trove/trove-guestagent.conf