2015년 9월 4일 금요일

Ubuntu 12.04 / turning Numlock on at Login screen


*Version
Ubuntu 12.04

$sudo apt-get install numlockx
$sudo vi /etc/lightdm/lightdm.conf
add line
greeter-setup-script=/usr/bin/numlockx on

from
http://askubuntu.com/questions/155679/how-to-enable-numlock-at-boot-time-for-login-screen
2nd answer

2015년 5월 27일 수요일

MySQL / InnoDB Log File size 변경


버전
CentOS 6.6
MySQL 5.6 (Percona server)

참고 링크
https://www.percona.com/blog/2011/07/09/how-to-change-innodb_log_file_size-safely/
http://dev.mysql.com/doc/refman/5.5/en/innodb-data-log-reconfiguration.html

my.cnf 에서 innodb_log_file_size 를 변경 후 재시작하면 에러가 나고 서버가 올라오지 않는 경우가 생깁니다

ERROR 1033 (HY000): Incorrect information in file ...

해당 로그파일은 ib_logfile0 ib_logfile1 과 같은 형식으로

설정을 변경하려면 먼저 정상 종료를 하고
(에러로그 확인해서 종료시 문제가 없었는지 확인도)
로그 파일들을 다른 곳으로 옮긴 후 설정을 변경하고 재시작합니다
(서버가 정상적으로 잘 올라오면 새로운 로그파일이 생성됨)
문제없이 재시작되는 걸 확인했다면 옮겨뒀던 이전의 로그 파일을 정리해도 됩니다

2015년 5월 16일 토요일

TexturePacker / unity3d 2d sprite tool


버전
Unity3d 5
TexturePacker 3.7.1

참고 링크 및 다운로드
www.codeandweb.com/texturepacker/tutorials

2d 게임 스프라이트 작업을 한번에 할 수 있도록 도와주는 툴
이 툴을 사용하기 전에는 이미지툴에서 큰 아틀라스를 만든 다음
스프라이트를 하나 하나 배치하는 수작업을 했는데... 별로 계속 하고 싶은 일은 아니었음
역시나 툴이 있으면 좋다

사용법은
1. 사용할 스프라이트 타입을 선택 (여기서는 unity3d)


2. 하나의 아틀라스 뭉쳐둘 스프라이트 개별 이미지들를 드래그해서 놓는다


3. 출력할 아틀라스 경로 및 파일명을 설정한다


4. 유니티 에셋 스토어에서 임포터 플러그인을 설치하고 재시작한다
https://www.assetstore.unity3d.com/kr/#!/content/16641

임포터 설치 후 자동으로 유니티에서 자동으로 인식하고 스프라이트로 사용할 수 있다
* 단 유니티 자체 스프라이트 에디터 처럼 개별 pivot point 설정은 지원하지 않는다


2015년 4월 30일 목요일

TestFlight beta testing


작업 후 간단한 정리 내용

버전
Xcode 6.3
iOS 8.x

테스트 시 어플 배포할 수 있는 여러가지 방법 중 하나
(usb 연결을 통한 배포가 가장 흔한 방법이지만 내부에 여러명의 테스터에게 배포할 때는 좋지 않은 방법이다)

iOS 8 이상 부터 지원하는 테스트 배포 시스템이다

1. Apple 개발자 콘솔에서 (itunes connect) 내부 테스트 추가하기
https://itunesconnect.apple.com/
멤버 관리를 하는데 앱개발자로 등록되지 않았더라도 멤버로 초대할 수가 있다
app id로 초대 메일을 보내고 당사자가 메일에서 수락 링크를 클릭하면 초대가 완료된다

2. 나의 App으로 등록하기
참고
https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/UploadingBinariesforanApp.html

등록은 비교적 간단한 입력으로 수월하게 진행가능했다
하지만 xcode로 업로드를 하라는 부분에서 막혔는데...

우선 bundle id 와 app name 등이 개발자 센터에서 정식 등록되어야 한다
https://developer.apple.com/membercenter/index.action

빌드 바이너리 업로드를 하는데
xcode 메뉴 중에 Product->scheme->Edit 로 배포정보를 정확히 하고
Product->Archive 해서 Organizer 창에서 빌드를 itunes connect 서버로 업로드 할 수 있다
# 등록 후 웹콘솔에서 빌드 정보가 업데이트 되기까지는 시간이 좀 더 걸린다

빌드가 웹콘솔에 업데이트 된 이후 버전 정보 리스트 화면 오른쪽 상단에 TestFlight 베타 테스트 스위치를 On시키면 테스트 가능한 상태가 된다

3. 테스트 계정을 선택하기
itunes connect 에서 나의 App 하위 메뉴에 [사전 출시] -> [내부 테스터] 를 통해서 테스터를 등록할 수 있다
그리고 테스터 계정으로 디바이스에서 TestFlight 앱을 설치하고 테스트 초대 메일에서 링크를 클릭해야 비로소 테스트앱을 설치하고 테스트를 할 수 있게 된다!


2015년 4월 14일 화요일

Centos 6 / yum error PYCURL ERROR 7 with ipv6 address right after minimal installation


Version
CentOS 6.6 minimal install

Error
Loaded plugins: fastestmirror
Setting up Update Process
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os&infra=stock error was
14: PYCURL ERROR 7 - "Failed to connect to 2a02:2498:1:3d:5054:ff:fed3:e91a: 네트워크가 접근 불가능합니다"
Error: Cannot find a valid baseurl for repo: base
Ref
https://www.centos.org/forums/viewtopic.php?t=4122 

Solved
It's because that gateway wasn't set 
I modified /etc/sysconfig/network-scripts/ifcfg-eth0
added "GATEWAY=(x.x.x.x)"
or it's also possible that modify /etc/sysconfig/network



2015년 4월 12일 일요일

chef - solo


버전
chef server 12, CentOS 6.5

참고 링크
http://gettingstartedwithchef.com/first-steps-with-chef.html
https://docs.chef.io/chef_solo.html
http://docs.chef.io/ctl_chef_client.html#run-in-local-mode

chef-solo 혹은 chef-client -z (or --local-mode)
레시피를 만들고 테스트를 할 때 유용함

-c, --config (파일경로)
configuration 파일, 내용은 다음처럼
(https://docs.chef.io/config_rb_client.html 참고)
file_cache_path "/home/vagrant/chef-solo-repo"
cookbook_path "/home/vagrant/chef-solo-repo/cookbooks"
-j, --json-attributes (파일경로)
사용할 레시피를 설정하는 JSON 데이타 파일, 내용은 다음처럼
{
  "run_list": [ "recipe[basic-packages]", "recipe[hello]" ]
}

테스트 실행
$ chef-client -z -c client.rb -j sample1.json

만들어진 cookbooks 를 git, svn을 통해서 커밋하거나
같은 장비에서 knife로 작업이 가능하다면 서버로 업로드

2015년 4월 6일 월요일

chef - server



설치 버전
chef server 12 / CentOS 6.5

참고 링크
http://docs.chef.io/server/install_server.html
[Standalone] 단락
http://www.joinc.co.kr/modules/moniwiki/wiki.php/Site/cloud/automation/chefInstall

## VM사양
메모리 사용량이 이전 버전에 비해 많이 늘어난 듯 함 (1.5G 이상 되어야 쓸만함)

설치 이미지 다운로드
https://downloads.chef.io/chef-server/

다운로드 후 rpm 설치
$ yum install chef-server-core-{version}.rpm
설치 후 실행
$ chef-server-ctl reconfigure

계정 만들기
$ chef-server-ctl user-create (user_id) (first_name) (last_name) (email) (password) --filename pem_filename
조직(organization) 만들기
$ chef-server-ctl org-create (org_short_name) (full_organization_name) --association_user user_name (user_id list) --filename org_short_name.pem
## 계정이나 조직을 만들면서 생성한 pem (private key) 파일들은 이후에 필요할 때가 있다

웹관리콘솔 설치
$ chef-server-ctl install opscode-manage
$ opscode-manage-ctl reconfigure
$ chef-server-ctl reconfigure

설치 후 https://chef-server-ip 로 접속해서 콘솔 로그인을 해보자

## 참고로 hostname FQDN 설정하기는
https://github.com/DigitalOcean-User-Projects/Articles-and-Tutorials/blob/master/set_hostname_fqdn_on_ubuntu_centos.md#setting-the-hostname

chef - workstation


버전
chef server 12, CentOS 6.5

참고 링크
http://docs.chef.io/client/

Chef-repo 만들기
설명은 git으로 하라고 되어 있지만
$ git clone git://github.com/chef/chef-repo.git
해당 git 페이지에 가보면 deprecated 라고 함
ChefDK 설치 후 chef generate repo 를 사용하라고 함

ChefDK 설치 참조
https://docs.chef.io/#chef-dk-title
$ chef generate repo (repo폴더명)

.chef 폴더 만들기
이 폴더에는 chef 서버 연결과 관련한 3개의 파일이 있어야 하는데
1.knife.rb
2.ORGANIZATION-validator.pem
3.USER.pem
* knife 설정파일 -- 웹콘솔의 Organizations 메뉴에서 다운로드 한다
* 인증키는 서버에서 유저 및 그룹 계정을 생성하면서 만들어 둔 파일을 가져와서 사용하거나
웹콘솔에서 Organizations->private key와 Account Management->Change password에서 초기화 및 다운로드하면 된다

knife 설정 중
ssl 인증서 가져오기
$ knife ssl fetch

Chef-repo 는 svn이나 git 같은 버전 관리 시스템으로 관리하는 것을 권장함
git으로 할 때 .gitignore 에는 다음과 같이 했다
# Chef
.chef/*.pem
.chef/encrypted_data_bag_secret

# Ruby
.rake_test_cache

client 설치
$ knife bootstrap node_hostname -x [account] -P [password] --sudo --run-list "recipes"



2015년 4월 5일 일요일

chef cookbook recipe


설치 버전
chef 12 / CentOS 6.5

새로운 요리책 (레서피) 만들기
(workstation 에서 ChefDK 설치했다는 전제에서 설명)
$ knife cookbook create (요리책이름)

cookbooks/some-chapter/
├── attributes
├── CHANGELOG.md
├── definitions
├── files
│   └── default
├── libraries
├── metadata.rb
├── providers
├── README.md
├── recipes
│   └── default.rb
├── resources
└── templates
    └── default

위와 같은 형태로 폴더 구조 및 파일이 생성이 된다

recipe나 template, attribute, metadata 작업을 한 후에 간단한 검증을 하려면
$ knife cookbook test (요리명) [-o (cookbooks 경로)]
$ foodcritic (요리책경로)

참고 링크
https://docs.chef.io/foodcritic.html
http://neverstopbuilding.com/chef-broiler-plate

요리책을 서버에 등록
$ knife upload cookbooks

참고 링크
https://docs.chef.io/knife_upload.html

client를 요리하기
client에 요리목록 추가/제거하기
$ knife node run_list add (node name) 'recipe[요리명]'
$ knife node run_list remove (node name) 'recipe[요리명]'
전체 수정도 가능
$ knife node edit (node name)
(에디터가 설정되지 않았다는 에러가 뜬다면 [$ export EDITOR=vi] 정도로 해결) 
edit 화면에서 
run-list 부분에 요리책이름을 추가/수정한다
"run_list": [
  "recipe[요리명]"
]

노드에 run_list 작업 지시
$ knife ssh 'name:(node name)' 'sudo chef-client --server https://chef-server [-N (node name)]'




2015년 3월 31일 화요일

how to change dns server, reslove.conf (permanent) / CentOS 6.5


버전
CentOS 6.5

참고한 링크
http://www.cyberciti.biz/faq/dhclient-etcresolvconf-hooks/

적용한 방법
dhclient.conf 수정
dhclient-뒷부분(eth0)은 네트워크 인터페이스에 따라 이름이 달라질 듯
# vi /etc/dhcp/dhclient-eth0.conf

supersede domain-search 와
prepend domain-name-server 항목을 추가
supersede domain-search "MY_DOMAIN";
prepend domain-name-servers IP_OF_LOCAL_NAMED;
적용 및 확인
# service network restart
# cat /etc/resolv.conf


dns, named, bind / CentOS 6.5


버전
CentOS 6.5

그밖에 작업환경
Virtualbox v4.3.26
with vagrant

참고한 링크
https://www.digitalocean.com/community/tutorials/how-to-install-the-bind-dns-server-on-centos-6
https://www.digitalocean.com/community/tutorials/how-to-configure-bind-as-a-private-network-dns-server-on-ubuntu-14-04
https://www.howtoforge.com/bind-installation-on-centos
https://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-bind-namedconf.html

설치
# yum install -y bind bind-utils

설정
# vi /etc/named.conf

//dns서버 ip는 192.168.30.10 네트워크 대역은 192.168.30.x
//사설 대역에서만 사용하기 위한 준비
acl restaurant {
        10.0.2.0/24; //virtualbox nat network
        192.168.30.0/24; //virtualbox host-only network
};

options {
        listen-on port 53 { IP_OF_NAMED; };
        listen-on-v6 port 53 { ::1; };
        directory       "/var/named";
        dump-file       "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
        allow-query     { restaurant; };
        recursion yes;
        allow-recursion { restaurant; };
        allow-transfer { none; };
        //먼저 forward dns에 쿼리를 하고 확인이 안되면 사용하겠다는 옵션
        forwarders {
                10.0.2.3; //virtualbox nat default dns
                8.8.8.8;
                8.8.4.4;
        };

        dnssec-enable yes;
        dnssec-validation yes;
        dnssec-lookaside auto;

        /* Path to ISC DLV key */
        bindkeys-file "/etc/named.iscdlv.key";

        managed-keys-directory "/var/named/dynamic";
};

logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};

zone "." IN {
        type hint;
        file "named.ca";
};

//domain 내에 ip 설정 파일
zone "MY_DOMAIN" IN {
        type master;
        file "MY_DOMAIN.zone";
        allow-update { none; };
        allow-transfer { none; };
};

//ip-domain recursion에 사용할 파일 설정
zone "30.168.192.in-addr.arpa" IN {
        type master;
        file "30.168.192.re";
        allow-update { none; };
        allow-transfer { none; };
};

include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";

/var/named/MY_DOMAIN.zone
$TTL 86400
@   IN  SOA     ns1.MY_DOMAIN. root.MY_DOMAIN. (
        2015040101  ;Serial
        3600        ;Refresh
        1800        ;Retry
        604800      ;Expire
        86400       ;Minimum TTL
)
; Specify our two nameservers
                IN      NS              ns1.MY_DOMAIN.
                IN      NS              ns1.MY_DOMAIN.
; Resolve nameserver hostnames to IP, replace with your two droplet IP addresses.
ns1             IN      A               192.168.30.10
ns2             IN      A               192.168.30.10

; Define hostname -> IP pairs which you wish to resolve
@               IN      A               192.168.30.10
www             IN      A               192.168.30.10
chef-server     IN      A               192.168.30.10
workstation     IN      A               192.168.30.20
node01          IN      A               192.168.30.21
node02          IN      A               192.168.30.22


/var/named/30.168.192.re
$TTL    86400
@       IN      SOA     MY_DOMAIN. root.MY_DOMAIN. (
                     2015040101         ; Serial
                             1H         ; Refresh
                             1M         ; Retry
                             1W         ; Expire
                             1D )       ; Negative Cache TTL
;
@       IN      NS      ns1.MY_DOMAIN.
; PTR Records
10      IN      PTR     chef-server.MY_DOMAIN.
20      IN      PTR     workstation.MY_DOMAIN.
21      IN      PTR     node01.MY_DOMAIN.
22      IN      PTR     node02.MY_DOMAIN.
23      IN      PTR     node03.MY_DOMAIN.

확인
# yum install -y bind-utils
$ dig -x 192.168.30.10
$ dig chef-server

2015년 3월 30일 월요일

vagrant & chef


버전
vagrant v2

가상머신 설정 및 실행을 커맨드라인 명령어로 처리할 수 있도록 한 프로그램
VirtualBox / VMware 등을 지원

VirtualBox 기준으로 설명

설치는 공식 사이트에서 다운로드
https://www.vagrantup.com/

기본 이미지 (box) 가져오기
http://docs.vagrantup.com/v2/getting-started/boxes.html
$ vagrant box add chef/centos-6.5

공홈에 있는 box 이미지들 링크
https://atlas.hashicorp.com/boxes/search

vagrant 로 vm(그룹) 설정하기
Vagrant 파일 생성 및 수정

vagrant plugin 설치 (hostmanager)
$ vagrant plugin install vagrant-hostmanager

chef 테스트를 위해 설정한 Vagrantfile 내용
hosts = {
  "chef-server" => { ip: "192.168.30.10", ssh_forward: 11022, mem: 1600 },
  "workstation" => { ip: "192.168.30.20", ssh_forward: 12022, mem: 640 },
  "node01" => { ip: "192.168.30.21", ssh_forward: 12122, mem: 512 },
  "node02" => { ip: "192.168.30.22", ssh_forward: 12222, mem: 512 },
  "node03" => { ip: "192.168.30.23", ssh_forward: 12322, mem: 512 }
}

Vagrant.configure(2) do |config|

  # Define base image
  config.vm.box = "chef/centos-6.5"

  config.ssh.insert_key = false
  config.ssh.private_key_path = "~\\.vagrant.d\\insecure_private_key"

  # Manage /etc/hosts on host and VMs
  config.hostmanager.enabled = false
  config.hostmanager.manage_host = true
  config.hostmanager.include_offline = true
  config.hostmanager.ignore_private_ip = false

  hosts.each do |name, prop|
    config.vm.define name do |machine|
      machine.vm.provider :virtualbox do |v|
        v.name = name
        v.customize ["modifyvm", :id, "--memory", prop[:mem] ]
      end
      machine.vm.network :private_network, ip: prop[:ip]
      machine.vm.network "forwarded_port", guest: 22, host: prop[:ssh_forward], id: "ssh"
      machine.vm.hostname = "%s.localdomain" % name
      machine.vm.provision :hostmanager
    end
  end

end

2015년 3월 16일 월요일

Setting svn:externals with TortoiseSVN



http://justaddwater.dk/2007/10/23/setting-up-subversion-externals-with-tortoisesvn/

1. TortoiseSVN -> Properties

외부 링크를 가져와서 사용할 svn 프로젝트 폴더에서 Properties를 선택



2. Add New Properties (Externals)

 svn:externals 설정을 추가합니다


3. Commit changes and update Externals

 추가/변경된 설정에 대해서 commit을 하고 업데이트를 받습니다
 잘 적용되었는지는 repo browser를 통해서 확인할 수 있습니다

http://stackoverflow.com/questions/12861082/setting-up-svnexternals-with-tortoisesvn-in-windows


4. command

svn propset svn:externals '[directory name] [svn externals url]' .
-> property 'svn:externals' set on '.'

이후
svn commit

http://beerpla.net/2009/06/20/how-to-properly-set-svn-svnexternals-property-in-svn-command-line/



2015년 3월 15일 일요일

TortoiseGit + Github / push


1. github에 repo 생성하기


생성 후 화면에서 git URL을 확인할 수 있음



2. TortoiseGit에 remote 등록하기





생성된 repo url 및 이름을 설정/저장

3. push 하기


저장했던 remote 설정을 선택하고 OK 버튼을 누르면
이후 계정(email)과 비번을 물어보고 push가 진행됩니다