리눅스에서 데이터 가공할 때 | 는 아주 많이 쓰입니다. 

금번 예시는 grep -E  옵션으로 정규표현식 확장해서 사용하면 됩니다.

Regexp selection and interpretation:

  -E, --extended-regexp     PATTERN is an extended regular expression (ERE)


| (파이프) 는 or 의 의미인건 잘 아실겁니다.

주의점) 공백의 차이가 있으므로 주의



사용 예시)

#grep -E '//|zone' /etc/named.conf

= // 주석 라인과, zone 으로 시작되는 라인을 순차적으로 출력함.


[ 원본 ] 

// 테스트#1

#cat /etc/named.conf

zone "1111.co.kr" in {

        type master;

        file "1111.co.kr";

};

zone "1234.co.krr" in {

        type master;

        file "1234.co.krr";

};

// 테스트2


zone "2345.co.kr" in {

        type master;

        file "2345.co.kr";

};

zone "2222.com" in {

        type master;

        file "2222.com";

};


#grep -E "//|zone" /etc/named.conf


// 테스트#1

zone "1111.co.kr" in {

zone "1234.co.krr" in {

// 테스트2

zone "2345.co.kr" in {

zone "2222.com" in {


출력값에서 지저분한 { 를 제거하고 싶으면 grep -v 옵션 이나 awk 로..


#grep -E "//|zone" /etc/named.conf | awk -F{ '{ print $1 }'

// 테스트#1

zone "1111.co.kr" in

zone "1234.co.krr" in

// 테스트2

zone "2345.co.kr" in

zone "2222.com" in



깔끔하다.


블로그 이미지

늙은M군

개인 저장공간입니다. 해당 일부 과정들을 공인 인터넷 환경에서 악성적으로 응용할 시 피해가 발생할 수 있으며, 그에 대해 책임은 사용자에게 있습니다!! 주의해주세요.

,

Apache 2.4.39 소스 설치

조건 : CentOS 7.6.1810 (minimal ) 만 설치 

        네트워크 환경 


cd /usr/local/src/

yum -y install wget openssl-devel gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel  ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel libtool  libtool-libs openldap openldap-devel nss_ldap openldap-clients openldap-servers libtool-ltdl libtool-ltdl-devel bison expat-devel

yum -y groupinstall "Development Tools"

yum -y install gd gd2 gd-devel gd2-devel wget pcre* openssl* perl libaio


wget http://apache.tt.co.kr//httpd/httpd-2.4.39.tar.bz2

wget http://apache.tt.co.kr/apr/apr-1.6.5.tar.gz

wget http://apache.tt.co.kr/apr/apr-util-1.6.1.tar.gz


tar jxvf httpd-2.4.39.tar.bz2 

tar xvf apr-1.6.5.tar.gz 

tar xvf apr-util-1.6.1.tar.gz


mv apr-1.6.5 apr

mv apr httpd-2.4.39/srclib/

mv apr-util-1.6.1 apr-util

mv apr-util httpd-2.4.39/srclib/


cd httpd-2.4.39


## 커스텀 튜닝 부분입니다. 최소한의 부분이니 그냥 써도 무방합니다.  

sed -i "s/finished(outctx->filter_ctx->pssl)/finished(outctx->filter_ctx->pssl);/g" ./modules/ssl/ssl_engine_io.c

perl -pi -e "s/LIMIT 256/LIMIT 2048/g" server/mpm/prefork/prefork.c

perl -pi -e "s/LIMIT 16/LIMIT 128/g" server/mpm/worker/worker.c


## 컨피그입니다. ssl과 all-shared 부분만 있으면 보통 큰 문제 없음. 

./configure --prefix=/usr/local/apache2 --enable-module=so --enable-mods-shared=all --enable-so --enable-deflate --enable-rewrite --with-included-apr --enable-module=ssl  --enable-ssl=shared --with-ssl --enable-ssl --with-mpm=prefork

make -j 3

make install


## lib 라이브러리 PATH 설정

echo "/lib" >> /etc/ld.so.conf

echo "/usr/lib" >> /etc/ld.so.conf

echo "/usr/local/lib" >> /etc/ld.so.conf

echo "/usr/local/mysql" >> /etc/ld.so.conf

echo "/usr/local/mysql/lib" >> /etc/ld.so.conf

echo "/usr/local/apache2/lib" >> /etc/ld.so.conf




시작 경로는 컨피그 보면 알겠지만

/usr/local/apache2/bin/apachectl 입니다.

2.4는 SSL 엔진 적용을 하더라도 굳이 -D SSL -k start 옵션 줄 필요가 없음. 


'Linux ( Cent OS ) > Apache' 카테고리의 다른 글

[설치] 3. PHP 7.3.4 Source Install  (0) 2019.04.18
[설치] 2. MySQL 5.7.25 Source Install  (1) 2019.04.18
블로그 이미지

늙은M군

개인 저장공간입니다. 해당 일부 과정들을 공인 인터넷 환경에서 악성적으로 응용할 시 피해가 발생할 수 있으며, 그에 대해 책임은 사용자에게 있습니다!! 주의해주세요.

,