dd 명령어를 사용해서 다음과 같이 Virtual Image 만들기가 가능하다.
|
1 |
]# dd if=/dev/zero of=/home/systemv/ubuntu.img bs=1G count=10 status=progress |
10GiB 의 용량을 가진 가상 이미지를 만들어 줍니다.
System Software Engineer
dd 명령어를 사용해서 다음과 같이 Virtual Image 만들기가 가능하다.
|
1 |
]# dd if=/dev/zero of=/home/systemv/ubuntu.img bs=1G count=10 status=progress |
10GiB 의 용량을 가진 가상 이미지를 만들어 줍니다.
Ubuntu 18.04 를 사용중인데, 보안 업데이트를 하기 위해서 apt 명령을 입력했더니 다음과 같이 도메인을 찾을 수 없는 이유로 오류가 생긴다.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
root@ubuntu:~# apt update Err:1 http://archive.ubuntu.com/ubuntu bionic InRelease Temporary failure resolving 'archive.ubuntu.com' Err:2 http://security.ubuntu.com/ubuntu bionic-security InRelease Temporary failure resolving 'security.ubuntu.com' Err:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease Temporary failure resolving 'archive.ubuntu.com' Err:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease Temporary failure resolving 'archive.ubuntu.com' Reading package lists... Done Building dependency tree Reading state information... Done All packages are up to date. W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease Temporary failure resolving 'archive.ubuntu.com' W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Temporary failure resolving 'archive.ubuntu.com' W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease Temporary failure resolving 'archive.ubuntu.com' W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease Temporary failure resolving 'security.ubuntu.com' W: Some index files failed to download. They have been ignored, or old ones used instead. |
“Temporary failure resolving” 이게 뭘까 싶어서 알아본 내용을 정리한다. resolve.conf 파일을 열어보면 다음과 같이 되어 있을 것이다.
|
1 2 3 4 5 6 7 |
root@ubuntu:~# cat /etc/resolv.conf # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN # 127.0.0.53 is the systemd-resolved stub resolver. # run "systemd-resolve --status" to see details about the actual nameservers. nameserver 127.0.0.53 |
resolv.conf 파일은 다들 알다시피 도메인 네임 서버를 지정해주는 설정 파일로 이 파일이 잘못되면 도메인을 ip로 변환할 수가 없게되어 결국에는 인터넷 연결을 할 수가 없게 된다. 그런데, 위 내용을 보면 도메인 서버 ip는 로컬 호스트로 보이고 코멘트에 이것을 수동으로 바꾸지 말것을 경고하고 […]
Bash 쉘 스크립트를 작성할때 자주 사용하는 로직인 바로 파일 존재 유무를 체크하는 것이다. 파일 하나만 체크할 수도 있고 여러파일을 체크할 수도 있다. 여러 파일을 체크할때는 다음과 같이 할 것이다.
|
1 2 |
]$ ls *file.txt ls: cannot access *file.txt: 그런 파일이나 디렉터리가 없습니다 |
이것을 Bash 쉘 스크립트에서는 어떻게 리턴을 받아야 하나하는 고민이 생긴다. 가장 쉬운 방법은 stdout, stderror 를 체크하는 방법이다. Bash 에서 이를 exit code 라고 하고 $? 에 세팅이되어 다음과 같은 로직이 가능해진다.
|
1 2 3 4 5 6 7 8 9 10 |
#!/bin/bash ls *file.txt if [ $? -eq 0 ] then echo "file exist!!" else echo "file doesn't exist!!" >&2 fi |
명령어가 성공(stdout)하면 $?에 0, stderr 면 1 이다. 위를 실행하면 다음과 같다.
|
1 2 3 |
]$ ./a.sh ls: cannot access *file.txt: 그런 파일이나 디렉터리가 없습니다 file doesn't exist!! |
위 방법외에도 한줄로 다음과 […]
현재(2018년)에 Trac 을 설치해서 사용하는 사람이 있을지 모르겠지만, 개인적으로 뭔가를 할때 제일 좋은 툴은 것 같다. 그런데, Trac 설치는 가끔 하는거라 할때마다 헤메곤 하는데 기록해두기 위해서 이 글을 작성한다. Python 2.7 Trac 은 현재 Python 2.7 에서 잘 작동한다. Python 2.7 이 설치되어 있어야 한다. 현 시점에서 CentOS 7, Ubuntu 16.04 LTS 에서 기본으로 Python 2.7 이 설치되어 있어 별도로 Python 2.7 을 설치할 필요는 없다. pip, setuptools 설치 Trac 뿐만 아니라 Python 의 라이브러리를 설치하기 위해서 pip 를 이용한다. […]
이 문서는 php7.2 설치 문서 입니다. 1. 준비 CentOS 가 최소설치되었다고 가정하고 시작했기 때문에 컴파일 환경을 구축해야 합니다.
|
1 2 3 |
yum update -y reboot yum install gcc.x86_64 gcc-c++.x86_64 wget.x86_64 bzip2-devel.x86_64 pkgconfig.x86_64 openssl-devel.x86_64 make.x86_64 man.x86_64 nasm.x86_64 gmp.x86_64 gmp-devel.x86_64 curl-devel.x86_64 libicu-devel.x86_64 libsodium-devel.x86_64 gdbm-devel.x86_64 readline-devel.x86_64 compat-readline43.x86_64 ncurses-devel.x86_64 db4-devel.x86_64 automake* autoconf* -y |
Ubuntu16.04 의 경우에는 다음과 같은 프로그램이 설치되어 있어야 합니다.
|
1 2 3 4 5 |
apt clean all apt update apt install build-essential libsystemd-dev pkg-config libxml2-dev libssl-dev libbz2-dev \ libcurl3 libcurl4-openssl-dev libsodium-dev libjpeg9-dev libpng-dev \ libfreetype6-dev libxpm-dev libgmp10-dev libxslt1-dev |
2.Download and Unpack 최신버전을 다운로드 받아야 합니다.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
]# wget http://jp2.php.net/get/php-7.2.1.tar.bz2/from/this/mirror --2018-01-07 00:17:28-- http://jp2.php.net/get/php-7.2.1.tar.bz2/from/this/mirror Resolving jp2.php.net... 49.212.134.217 Connecting to jp2.php.net|49.212.134.217|:80... connected. HTTP request sent, awaiting response... 302 Found Location: http://jp2.php.net/distributions/php-7.2.1.tar.bz2 [following] --2018-01-07 00:17:29-- http://jp2.php.net/distributions/php-7.2.1.tar.bz2 Connecting to jp2.php.net|49.212.134.217|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 14980278 (14M) [application/octet-stream] Saving to: `mirror' 100%[===================================================================================>] 14,980,278 6.55M/s in 2.2s 2018-01-07 00:17:31 (6.55 MB/s) - `mirror' saved [14980278/14980278] ]# tar xvjf mirror |
3. Configure and Compile 이제 PHP에서 사용할 기능들을 결정해야 합니다. PHP에서 제공하는 기능은 아주 많지만 여기서는 다음과 같은 기능들을 사용할 것입니다.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
../configure --prefix=/opt/php-7.2.1 \ --with-config-file-path=/opt/php-7.2.1/etc \ --with-config-file-scan-dir=/opt/php-7.2.1/etc/conf.d \ --with-libdir=lib64 \ --enable-fpm \ --with-fpm-systemd \ --enable-sockets \ --with-gettext \ --with-mhash \ --with-gmp \ --with-gd \ --with-jpeg-dir=/usr \ --with-png-dir=/usr \ --with-zlib-dir=/usr \ --with-freetype-dir=/usr \ --enable-bcmath \ --enable-exif \ --with-zlib \ --with-bz2 \ --enable-calendar \ --enable-mbstring \ --with-mhash \ --enable-intl \ --with-xsl \ --with-sodium \ --with-libxml-dir=/usr \ --with-curl \ --disable-debug \ --with-openssl \ --enable-mysqlnd \ --with-pdo-mysql=mysqlnd \ --with-mysqli=mysqlnd \ --enable-inline-optimization \ --enable-sysvmsg \ --enable-sockets \ --enable-sysvsem \ --enable-sysvshm \ --enable-pcntl \ --enable-mbregex \ --with-mhash \ --enable-zip \ --with-pcre-regex |
아무런 에러없이 끝났다면 다음과 같이 컴파일을 해주고 설치해준다.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
]# make ]# make install Installing shared extensions: /opt/php-7.2.1/lib/php/extensions/no-debug-non-zts-20170718/ Installing PHP CLI binary: /opt/php-7.2.1/bin/ Installing PHP CLI man page: /opt/php-7.2.1/php/man/man1/ Installing PHP FPM binary: /opt/php-7.2.1/sbin/ Installing PHP FPM defconfig: /opt/php-7.2.1/etc/ Installing PHP FPM man page: /opt/php-7.2.1/php/man/man8/ Installing PHP FPM status page: /opt/php-7.2.1/php/php/fpm/ Installing phpdbg binary: /opt/php-7.2.1/bin/ Installing phpdbg man page: /opt/php-7.2.1/php/man/man1/ Installing PHP CGI binary: /opt/php-7.2.1/bin/ Installing PHP CGI man page: /opt/php-7.2.1/php/man/man1/ Installing build environment: /opt/php-7.2.1/lib/php/build/ Installing header files: /opt/php-7.2.1/include/php/ Installing helper programs: /opt/php-7.2.1/bin/ program: phpize program: php-config Installing man pages: /opt/php-7.2.1/php/man/man1/ page: phpize.1 page: php-config.1 Installing PEAR environment: /opt/php-7.2.1/lib/php/ [PEAR] Archive_Tar - installed: 1.4.3 [PEAR] Console_Getopt - installed: 1.4.1 [PEAR] Structures_Graph- installed: 1.1.1 [PEAR] XML_Util - installed: 1.4.2 [PEAR] PEAR - installed: 1.10.5 Wrote PEAR system config file at: /opt/php-7.2.1/etc/pear.conf You may want to add: /opt/php-7.2.1/lib/php to your php.ini include_path /root/php-7.2.1/build/shtool install -c ext/phar/phar.phar /opt/php-7.2.1/bin ln -s -f phar.phar /opt/php-7.2.1/bin/phar Installing PDO headers: /opt/php-7.2.1/include/php/ext/pdo/ |
4. Configure to the installed php7 config-file-scan 디렉토리를 생성해 준다.
|
1 |
]# mkdir /opt/php-7.2.1/etc/conf.d |
[…]
서버를 다루다보면 Python, SaltStack 을 작성해야 하는데 이를 위해서 윈도우즈로 다운로드 받아서 편집기를 열어서 하기가 영 귀찮습니다. 터미널을 이용해기 때문에 vim 를 이용하면 아주 편한데, 이 문서는 Python, SaltStack 편집을 위한 vim 세팅 위한 것입니다. 환경 환경이 중요합니다. 이 문서의 환경은 다음과 같습니다. OS Distro: Ubuntu 16.04 vim version: 7.4 Python Virtualenv: /home/systemv 계정에 Python 가상환경을 만들었으며 여기에 각종 Python 라이브러리가 설치되어 있다. Vundle 플러그인 설치 Vundle 은 vim 플러그인 입니다. 이 플러그인은 vim 의 각종 플러그인을 아주 편하게 설치 […]
시스템을 운영하다 보면 Python 을 많이 사용하게 되는데, 리눅스 시스템의 경우에 기본적으로 Python 이 설치되어 있다. 하지만 pip 는 기본적으로 설치되지 않는데 이것을 설처하기 위해서 리눅스 시스템의 슈퍼유저인 root 사용자 계정을 빌리거나 설치 요청을 하는 경우가 많다. 하지만 일반계정으로 pip 를 사용할 수 있는데 이에 대해 간단히 소개한다. 디렉토리 생성하기 일반계정일 경우에 홈디렉토리에 bin 디렉토리를 생성하고 PATH 쉘 변수를 설정하면 되는데 이럴경우 홈디렉토리에 노출되는데 이를 숨기기 위해서 숨김 디렉토리로 설정한다.
|
1 2 3 |
~$ mkdir -p ~/.local/bin ~$ echo "export PATH=\$PATH:~/.local/bin" >> .bashrc ~$ source .bashrc |
숨김 디렉토리를 생성한 후에 PATH 쉘 변수를 만들고 Bash […]
Database 시스템은 공유메모리 혹은 HugePages 에 매우 의존적입니다. 서버에서 데이터베이스가 가동되면 Database 가 사용하는 메모리는 Database만을 위해서 사용되어 집니다. 대부분의 큰 Database 시스템은 다른 서버 프로그램 없이 단독으로 설치되어 운영되어지기 때문에 얼마만큼 물리적 메모리를 Database 에 할당할지가 Database 시스템 전체에 큰 영향을 미칩니다. 이 글에서 Database 시스템을 위한 공유메모리, HugePages 등을 할당할때에 고려사항은 무엇이며 얼마나 할당하는 것이 좋은지를 살펴보겠습니다. Oracle 11g or 12c 먼저 Oracle 은 물리적 메모리에 약 80% 를 Oracle 이 사용하도록 할당하도록 합니다. 여기서 대략 80% 라고 […]