글쓴이 보관물: totoli78

virtual box vdi 용량 늘리기

windows 7에 virtual box를 설치하고 xubuntu를 guest os로 설치했다고 가정한다.
저장소는 vmdk일 경우 먼저 vdi로 변경 후 사이즈를 조절하도록 한다.

vdi 용량 늘리기
1) vmdk를 vdi로 변경

cmd를 열고 vmdk 파일이 있는 곳으로 이동한다.

VBoxManage.exe의 clonehd 기능으로 vmdk파일을 vdi로 변경한다.

1
> “C:Program FilesOracleVirtualBoxVBoxManage.exe” clonehd server1-disk1.vmdk server1-disk1.vdi –format vdi
2) vdi 사이즈 수정

vdi의 사이즈를 변경하기 위해서 VBoxManage.exe의 modifyhd 기능으로 사이즈를 변경한다. –resize 매개변수의 값은 단위가 MB이며 30GB를 원할 경우 30 * 1024 = 31744를 입력하도록 한다.

1
> “C:\Program Files\Oracle\VirtualBox\VBoxManage.exe” modifyhd backup_volume.vdi –resize 31744
3) VirtualBox GUI 관리자에서 설정>저장소를 선택 후 기존 vmdk 연결을 제거하고 새로운 vdi 파일을 추가해 준다.

우분투 파티션 변경
gparted를 사용해서 파티션을 변경한다.

1) gparted 설치

1
sudo apt-get install gparted
2) gparted 실행

1
sudo gparted
3) 파티션 합치기

디스크 사이즈를 조정했다면 할당되지 않은 새로운 공간이 보일 것이다.
주의할 것은 원래 파티션과 새로운 할당되지 않은 빈 공간 사이에 다른 파티션이 있으면 안된다.

만약, 있다면 해당 파티션을 제거해야 한다.

원래의 파티션(합칠 대상)에서 크기조정/이동 메뉴를 선택한 후 원하는 크기만큼 변경하고 v 체크 버튼을 클릭해 변경된 내용을 적용하면 끝이다.

VirtualBox_Physical_Drive_Mount

diskpart로 디스크 번호 확인

DISKPART> list disk

디스크 ###  상태           크기     사용 가능     Dyn  Gpt
———-  ————-  ——-  ————  —  —
디스크 0    온라인       2048 MB           0 B
디스크 1    온라인        238 GB           0 B        *
디스크 2    온라인        447 GB           0 B        *
디스크 3    온라인        931 GB           0 B        *
디스크 4    온라인       3726 GB           0 B

select disk 1
list partition

— 드라이브 통으로 생성
“C:\Program Files\Oracle\VirtualBox\VBoxManage” internalcommands createrawvmdk -filename “D:\SubStorage\VirtualBox VMs\Xpenology_x64\PhysicalDriveSSD.vmdk” -rawdisk \\.\PhysicalDrive6

— 드라이브의 특정 파티션 생성
“C:\Program Files\Oracle\VirtualBox\VBoxManage” internalcommands createrawvmdk -filename “D:\SubStorage\VirtualBox VMs\Xpenology_x64\PhysicalDrive1_Pt5.vmdk” -rawdisk \\.\PhysicalDrive1 -partitions 5

RAW host disk access VMDK file d:\SubStorage\VirtualBox VMs\Xpenology_x64\PhysicalDrive3p2.vmdk created successfully.

VMDK 2 VDI

VMDK 2 VDI

“C:\Program Files\Oracle\VirtualBox\VBoxManage” clonehd photo_backup.vmdk backup_volume.vdi –format VDI

ubuntu 업그레이드

Ubuntu 17.04 Zesty Zapus로 업그레이드하기 전에 다음 명령을 사용하여 현재 Ubuntu 릴리스를 업데이트하고 업그레이드하십시오.

sudo apt update
sudo apt upgrade
sudo apt dist-upgrade

이제 update-manager-core 패키지를 설치하려면 다음 명령을 실행하십시오.

sudo apt install update-manager-core

update-manager-core 패키지가 설치되면 / etc / update-manager / release-upgrades 파일을 편집하고 프롬프트 값을 normal로 설정하십시오. 프롬프트 = 정상

sudo vi /etc/update-manager/release-upgrades

이제 마침내 do-release-upgrade 명령을 실행하여 우분투 17.04로 업그레이드하십시오. Zesty Zapus :

sudo do-release-upgrade -d  <–(안되면 -d 빼고 실행)

업그레이드 프로세스가 완료되면 시스템을 다시 시작하고 다음 명령을 사용하여 Ubuntu 버전을 확인하십시오.

lsb_release -a

출력은 다음과 같아야한다.

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu zesty zapus (development branch)
Release: 17.04
Codename: zesty

portproxy_set

netsh -> interface -> portproxy

add v4tov4 listenport=5122 connectaddress=192.168.100.170 connectport=5122

commit

add v4tov4 listenport=5110 connectaddress=127.0.0.1 connectport=80
delete v4tov4 listenaddress=112.220.221.117 listenport=9515

show all

owncloud DB file 정보 동기화

-. owncloud 유저 / 특정 폴더 동기화

sudo -u www-data php /var/www/owncloud/console.php files:scan totoli

sudo -u www-data php /var/www/owncloud/console.php files:scan –path “totoli/files/private”

 

-. 유저 모두

sudo -u www-data php /var/www/owncloud/console.php files:scan –all

image optimization

image optimization

 

–PNG

optipng -o6 -strip all *.png

–JPG

jpegoptim –strip-all *.jpg

ANSI(EUC-KR) 2 UTF-8

-. 파일명 한글 교정

find . -exec convmv -r –notest -f euc-kr -t utf-8 {} \;

 

-. 특정 폴더 및 하위 파일 중 txt 파일만 한정하여 인코딩 변환

find / -name *.txt -execdir iconv -f EUC-KR -t UTF-8 {} -o {}.tmp \; -execdir mv -f {}.tmp {} \;

 

-. 음원파일 한글 교정

find -type f -iregex “.*/.*\.\(ogg\|mp3\|flac\)” -print0 | xargs -0 mid3iconv -e cp949

 

vim sh. config

“””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””
” General
“””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””
” Sets how many lines of history VIM has to remember
” VIM에서 기억할 히스토리 라인수
set history=1000

” Set to auto read when a file is changed from the outside
” 현재 사용하고 있는 파일이 외부에서 수정된 경우 자동으로 읽기
set autoread

” Set to auto write on opening an other file.
” 다른 파일을 읽게 되는 경우 현재 파일을 자동으로 저장하기
” 현재 파일을 저장하지 않으면 “:e” 등으로 다른 파일을 열 수 없음.
set autowrite

” Use mouse or not
” 마우스로 클릭한 위치에 커서 놓기
” 마우스로 드래그한 영역은 비쥬얼 모드로 복사준비하기
” 단 마우스를 사용하면, 마우스 오른 버튼을 눌러 나오는 복사를 선택할 수 없음.
” 마우스를 사용하지 않으려면, “:set mouse-=a”를 치기
“set mouse=a

“””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””
” VIM user interface
“””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””
” Always show current position
” 오른편 하단에 현재 위치의 (행, 렬)을 표시
set ruler

” Highlight search results
” 검색결과에 하이라이트 표시하기
set hlsearch

” Makes search act like search in modern browsers
” 한글자 입력할때마다 매치되는 부분 표시하기
set incsearch

” Show matching brackets when text indicator is over them
” 현재 커서가 놓여진 괄호의 짝을 표시하기
set showmatch

” line number
” 라인넘버 표시하기
set number

“””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””
” Colors and Fonts
“””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””
” syntax highlight
” 언어 syntax에 하이라이트표시
syntax on

” color scheme
” 컬러스킴
colorscheme desert
set background=dark

” Set utf8 as standard encoding
” utf8을 표준 인코딩으로 사용하기
set encoding=utf8

“””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””
” Text, tab and indent related
“””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””
” auto indent’s tab size
” 자동탭 사이즈를 4칸으로 하기
set shiftwidth=4

” 1 tab == 4 spaces
” 탭을 4칸으로 하기
set tabstop=4

” c style auto indent
” c언어 스타일로 indentation하기
set cindent

” #if has to be first on the line
” #if 문을 라인의 시작에 배치하기
set smartindent

“””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””
” Coding
“””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””
” fold functions by indent or syntax.
” open a folded function using ‘zo’
” clase a function using ‘zc’
” syntax에 따라 접어두기
” 접은 것을 열려면, zo를 누르기
” 연 것을 다시 접으려면, zc를 누르기
“set foldmethod=indent
” 최대 깊이는 1개로 고정
“set foldnestmax=1

openssl 인증서 발급

<< CA root 인증서 생성 >>

# openssl 로 root ca 의 개인키와 인증서 생성

**. CA가 사용할 RSA  key pair(public, private key) 생성 (2048bit 개인키 생성)
openssl genrsa -aes256 -out rootCA.key 2048

**. CSR(Certificate Signing Request) 생성을 위한 rootCA_openssl.cfg 로 저장
rootCA_openssl.cfg
—————————————————————————————————
[ req ]
default_bits            = 2048
default_md              = sha1
default_keyfile         = rootCA.key
distinguished_name      = req_distinguished_name
extensions             = v3_ca
req_extensions = v3_ca

[ v3_ca ]
basicConstraints       = critical, CA:TRUE, pathlen:0
subjectKeyIdentifier   = hash
##authorityKeyIdentifier = keyid:always, issuer:always
keyUsage               = keyCertSign, cRLSign
nsCertType             = sslCA, emailCA, objCA
[req_distinguished_name ]
countryName                     = Country Name (2 letter code)
countryName_default             = KR
countryName_min                 = 2
countryName_max                 = 2

# 회사명 입력
organizationName              = Organization Name (eg, system)
organizationName_default      = totoli Inc.

# 부서 입력
#organizationalUnitName          = Organizational Unit Name (eg, section)
#organizationalUnitName_default  = totoli

# SSL 서비스할 domain 명 입력
commonName                      = Common Name (eg, your name or your server’s hostname)
commonName_default             = totoli’s Self Signed CA
commonName_max                  = 64
—————————————————————————————————

**. 인증서 요청 생성
openssl req -new -key rootCA.key -out rootCA.csr -config rootCA_openssl.cfg

**. 10년짜리 self-signed 인증서 생성
openssl x509 -req -days 3650 -extensions v3_ca -set_serial 1 -in rootCA.csr -signkey rootCA.key -out rootCA.crt -extfile rootCA_openssl.cfg

**. 제대로 생성되었는지 확인
openssl x509 -text -in rootCA.crt

<< Host 인증서 생성 >>

#  root ca 서명키로 host SSL 인증서를 발급

**. SSL 호스트에서 사용할 RSA  key pair(public, private key) 생성
openssl genrsa -aes256 -out totoli.key 2048

**. 암호가 걸려있으면 httpd 구동때마다 pass phrase(암호) 를 입력해야 함으로 암호를 제거
copy totoli.key totoli.key.enc
openssl rsa -in totoli.key.enc -out totoli.key

**. CSR(Certificate Signing Request) 생성을 위한 host_openssl.cfg 로 저장
host_openssl.cfg
—————————————————————————————————
[ req ]
default_bits            = 2048
default_md              = sha1
default_keyfile         = rootCA.key
distinguished_name      = req_distinguished_name
extensions             = v3_user
## 인증서 요청시에도 extension 이 들어가면 authorityKeyIdentifier 를 찾지 못해 에러가 나므로 막아둔다.
## req_extensions = v3_user

[ v3_user ]
# Extensions to add to a certificate request
basicConstraints = CA:FALSE
authorityKeyIdentifier = keyid,issuer
subjectKeyIdentifier = hash
keyUsage = nonRepudiation, digitalSignature, keyEncipherment

## SSL 용 확장키 필드
extendedKeyUsage = serverAuth,clientAuth
subjectAltName          = @alt_names
[ alt_names]
## Subject AltName의 DNSName field에 SSL Host 의 도메인 이름을 적어준다.
## 멀티 도메인일 경우 *.totoli.com 처럼 쓸 수 있다.
DNS.1   = totoli.us.to
DNS.2   = *.totoli.us.to
## DNS.3   = subdomain.totoli.us.to

[req_distinguished_name ]
countryName                     = Country Name (2 letter code)
countryName_default             = KR
countryName_min                 = 2
countryName_max                 = 2

# 회사명 입력
organizationName              = Organization Name (eg, system)
organizationName_default      = totoli Inc.

# 부서 입력
organizationalUnitName          = Organizational Unit Name (eg, section)
organizationalUnitName_default  = Media Division

# SSL 서비스할 domain 명 입력
commonName                      = Common Name (eg, your name or your server’s hostname)
commonName_default             = totoli.us.to
commonName_max                  = 64
—————————————————————————————————

**. SSL 인증서 요청 CSR 생성
openssl req -new -key totoli.key -out totoli.csr -config host_openssl.cfg

**. 5년짜리 totoli.us.to 용 SSL 인증서 발급 (서명시 ROOT CA 개인키로 서명)
openssl x509 -req -days 1825 -extensions v3_user -in totoli.csr -CA rootCA.crt -CAcreateserial -CAkey rootCA.key -out totoli.crt -extfile host_openssl.cfg

**. 제대로 생성되었는지 확인
openssl x509 -text -in totoli.crt
<< Cleent에 RootCA 등록 >>
**. rootCA.crt 파일을 client PC로 복사 후 CA 인증서를 해당 Client에 신용할 수 있는 인증서로 등록 해야 함. (귀찮으면 돈주고 신용할 수 있는 인증서를 사던가 ㅋㅋ)