ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Apache 소스(src) 컴파일 설치 및 시작
    WEB/Apache 2026. 1. 9. 08:35

     

     

     

     

    Apache Web Server는 안정성과 유연성을 갖춘 오픈소스 웹 서버

    인터넷 서비스의 기반을 이루는 핵심 기술

     

     

     

     

     

     

    👀 Apache 설치 방식은 ?

    운영 환경에서 Apache HTTP Server(httpd)를 설치할 때 가장 많이 고민하는 것이 패키지 매니저(yum/dnf) 방식과 소스 컴파일(src) 방식입니다. 대다수 편리성으로 패키지 매니저를 통해서 처음 설치를 시작하지만 결국... 보안 패치 정책/버전 통제/모듈 옵션 필요 시 소스 컴파일(src)이 유리하게 됩니다.


     

     

    💡 비교

    항목 yum / dnf (패키지) 소스 컴파일 (src)
    목적 안정성, 표준 경로, 손쉬운 유지보수 최신 버전, 맞춤 빌드, 다중 버전 공존
    버전 배포판 검증 버전(상대적으로 보수적) 공식 최신 버전 선택 가능
    의존성 자동 해결(mod_ssl, apr, pcre 등) 수동 해결 필요(또는 --with-included-apr 활용)
    업데이트 dnf/yum update로 일괄 관리 재빌드 필요(보안패치 시 재컴파일)
    설치 경로 /etc/httpd, /var/log/httpd 등 표준 임의 지정(예: /usr/local/apache2)
    운영/장애 대응 매뉴얼과 사례 풍부, 유지보수 용이 담당자 숙련도 필요, 문서화 필수

    [ 개인적 생각 ]
    대부분 서비스 운영사는 보안취약사항, EOL, 각 표준사항들을 고려해야 함으로 소스 컴파일(src) 방식을 추천합니다.
    소스 컴파일(src) 설치는 어렵다고 하지만 제공되는 SHELL 사용하여 설치하면 보다 편리하게 설치할 수 있습니다.

     

     

     

    ⚙️ Apache(src) 설치

    ✅ 파일 준비하기

    네트워크 환경에 따라 아래의 방법 중 선택하시면 됩니다.

    [인터넷망] wget, curl, git 명령어를 통해서 받습니다.
    [폐쇄망] 로컬PC에 다운로드 후 sftp Upload

     

     

    # SHELL 다운로드

    curl -L -O https://github.com/jo0ozip/kior-system-oss/raw/refs/heads/main/Apache/apache-kior-system_latest.tar.gz
    [kior-oss@89790c086e28 ~]$ curl -L -O https://github.com/jo0ozip/kior-system-oss/raw/refs/heads/main/Apache/apache-kior-system_latest.tar.gz
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
    100  1850  100  1850    0     0   4755      0 --:--:-- --:--:-- --:--:--  4755
    
    
    [kior-oss@89790c086e28 ~]$ ls
    apache-kior-system_latest.tar.gz
    [kior-oss@89790c086e28 ~]$ pwd
    /sw

     

     

    wget https://github.com/jo0ozip/kior-system-oss/raw/refs/heads/main/Apache/apache-kior-system_latest.tar.gz
    [kior-oss@89790c086e28 ~]$ wget https://github.com/jo0ozip/kior-system-oss/raw/refs/heads/main/Apache/apache-kior-system_latest.tar.gz
    --2026-01-05 01:27:53--  https://github.com/jo0ozip/kior-system-oss/raw/refs/heads/main/Apache/apache-kior-system_latest.tar.gz
    Resolving github.com (github.com)... 20.200.245.247
    Connecting to github.com (github.com)|20.200.245.247|:443... connected.
    HTTP request sent, awaiting response... 302 Found
    Location: https://raw.githubusercontent.com/jo0ozip/kior-system-oss/refs/heads/main/Apache/apache-kior-system_latest.tar.gz [following]
    --2026-01-05 01:27:53--  https://raw.githubusercontent.com/jo0ozip/kior-system-oss/refs/heads/main/Apache/apache-kior-system_latest.tar.gz
    Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.111.133, 185.199.108.133, 185.199.109.133, ...
    Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.111.133|:443... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 1850 (1.8K) [application/octet-stream]
    Saving to: ‘apache-kior-system_latest.tar.gz’
    
    apache-kior-system_l 100%[====================>]   1.81K  --.-KB/s    in 0s
    
    2026-01-05 01:27:53 (10.4 MB/s) - ‘apache-kior-system_latest.tar.gz’ saved [1850/1850]
    
    
    [kior-oss@89790c086e28 ~]$ ls
    apache-kior-system_latest.tar.gz

     

     

    🚀 설치 경로 생성

    설치할 경로는 예시로 "/sw/apache" 진행합니다.

    [kior-oss@89790c086e28 ~]$ mkdir -p /sw/apache
    [kior-oss@89790c086e28 ~]$ cd /sw/apache
    [kior-oss@89790c086e28 apache]$ pwd
    /sw/apache

     

    다운받은 TAR 파일을 해제하여 "tarballs" 라는 폴더 안에 필요한 모듈들을 받도록 하겠습니다.

    [kior-oss@89790c086e28 ~]$ ls
    apache-kior-system_latest.tar.gz

    [kior-oss@89790c086e28 ~]$ tar -zxvf apache-kior-system_latest.tar.gz -C /sw/apache
    bash_profile
    shell/
    shell/
    1_install.sh shell/
    0_check_env.sh tarballs/

    [kior-oss@89790c086e28 ~]$ ls /sw/apache
    bash_profile shell tarballs

    [kior-oss@89790c086e28 ~]$ cd /sw/apache/tarballs
    [kior-oss@89790c086e28 tarballs]$

     

    이하 예시 내용은 curl 진행하도록 하겠습니다.

    (당연히 wget으로 됩니다 !!)

     

     

    📌 OpenSSL 다운로드

    curl -L -O https://github.com/openssl/openssl/releases/download/openssl-3.5.4/openssl-3.5.4.tar.gz
    [kior-oss@89790c086e28 tarballs]$ curl -L -O https://github.com/openssl/openssl/releases/download/openssl-3.5.4/openssl-3.5.4.tar.gz
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
    100 50.7M  100 50.7M    0     0  24.3M      0  0:00:02  0:00:02 --:--:-- 28.6M
    [kior-oss@89790c086e28 tarballs]$ ls
    openssl-3.5.4.tar.gz

     

     

    📌 apr 다운로드

    curl -L -O https://dlcdn.apache.org//apr/apr-1.7.6.tar.gz
    [kior-oss@89790c086e28 tarballs]$ curl -L -O https://dlcdn.apache.org//apr/apr-1.7.6.tar.gz
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 1111k  100 1111k    0     0  2162k      0 --:--:-- --:--:-- --:--:-- 2162k
    [kior-oss@89790c086e28 tarballs]$ ls
    apr-1.7.6.tar.gz openssl-3.5.4.tar.gz

     

     

    📌 apr-util 다운로드

    curl -L -O https://dlcdn.apache.org//apr/apr-util-1.6.3.tar.gz
    [kior-oss@89790c086e28 tarballs]$ curl -L -O https://dlcdn.apache.org//apr/apr-util-1.6.3.tar.gz
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  543k  100  543k    0     0   592k      0 --:--:-- --:--:-- --:--:--  592k
    [kior-oss@89790c086e28 tarballs]$ ls
    apr-1.7.6.tar.gz apr-util-1.6.3.tar.gz openssl-3.5.4.tar.gz

     

     

    📌 pcre 다운로드

    curl -L -O https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.47/pcre2-10.47.tar.gz
    [kior-oss@89790c086e28 tarballs]$ curl -L -O https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.47/pcre2-10.47.tar.gz
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
      0     0    0     0    0     0      0      0 --:--:--  0:00:05 --:--:--     0
    100 2727k  100 2727k    0     0   444k      0  0:00:06  0:00:06 --:--:--  444k
    [kior-oss@89790c086e28 tarballs]$ ls
    apr-1.7.6.tar.gz apr-util-1.6.3.tar.gz openssl-3.5.4.tar.gz pcre2-10.47.tar.gz

     

     

    📌 httpd 다운로드

    curl -L -O https://dlcdn.apache.org/httpd/httpd-2.4.66.tar.gz
    [kior-oss@89790c086e28 tarballs]$ curl -L -O https://dlcdn.apache.org/httpd/httpd-2.4.66.tar.gz
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 9597k  100 9597k    0     0  6730k      0  0:00:01  0:00:01 --:--:-- 6725k
    [kior-oss@89790c086e28 tarballs]$ ls
    apr-1.7.6.tar.gz apr-util-1.6.3.tar.gz httpd-2.4.66.tar.gz openssl-3.5.4.tar.gz pcre2-10.47.tar.gz

     

    여기까지가 설치를 위한 파일들을 준비를 완료했습니다.

    2026.01.08 기준으로 파일들은 LTS 또는 최신 버전으로 진행하였습니다.

     

     

     

    ✅ 설치하기

    설치를 진행하기 위해서는 총 4단계로 진행됩니다.

    1. 시스템 환경변수 설정
    2. SHELL 실행

     

     

    🚀 시스템 환경변수 설정

    잘 따라서 오셨으면 "/sw/apache" 하위에 "bash_profile" 이라고 파일이 있습니다. (파일명이 .bash_profile 아님)

    만약 없다면 "apache-kior-system_latest.tar.gz" 풀어서 적용하시면 됩니다.

     

    적용하기 전에 'bash_profile' 파일에서 설정해야하는 부분을 먼저 수정합니다.

    [kior-oss@89790c086e28 apache]$ vi bash_profile
    ...(생략)

    export APACHE_HOME="/sw/apache"
    export APACHE_ENGINE_HOME="/sw/apache/apache2.4"
    export APACHE_LIBS_HOME="${APACHE_HOME}/apache-libs"
    export APACHE_LOG_HOME="/sw/apache/apache2.4/log"

    export VER_OPENSSL="openssl-3.5.4"  //tarballs에 있는 TAR의 버전을 기입 하기 동일.
    export VER_PCRE2="pcre2-10.47"
    export VER_APR="apr-1.7.6"
    export VER_APRUTIL="apr-util-1.6.3"

    (생략)...
    [kior-oss@89790c086e28 apache]$ ls
    bash_profile shell tarballs
    [kior-oss@89790c086e28 apache]$ cp -rp bash_profile ~/.bash_profile
    [kior-oss@89790c086e28 apache]$ source ~/.bash_profile

    [kior-oss@89790c086e28:/sw/apache]$ echo ${APACHE_HOME}
    /sw/apache

     

     

    🚀 SHELL 실행

    설치를 위한 준비는 끝났습니다! SHELL를 실행합니다!

    [kior-oss@89790c086e28:/sw/apache/shell]$ ls
    0_check_env.sh 1_install.sh
    [kior-oss@89790c086e28:/sw/apache/shell]$ sh 0_check_env.sh ######################################################
    # Apache Build Environment Check @BLOG_KIOR ######################################################
    [INFO] Checking build tools
    ✘ gcc: not installed
    ✘ make: not installed
    ✘ perl: not installed
    ✔ tar: installed (/bin/tar)

    [INFO] Checking development library packages
    ✘ expat-devel: not installed
    ✘ zlib-devel: not installed

    [Done] Apache build environment check completed.

    체크 하였을때 필요한 패키지 도구들이 설치 되어 있지 않는 경우가 있습니다.

    yum/dnf 같은 패키지 매니저를 통해서 다운하도록 합니다.

    [Help command: yum install -y gcc make perl expat-devel zlib-devel ]

     

     

    패키지가 설치되면 다시 한번 확인하고 다음으로 넘어갑니다.

    ######################################################
    # Apache Build Environment Check @BLOG_KIOR ######################################################
    [INFO] Checking build tools
    ✔ gcc: installed (/usr/bin/gcc)
    ✔ make: installed (/usr/bin/make)
    ✔ perl: installed (/usr/bin/perl)
    ✔ tar: installed (/usr/bin/tar)

    [INFO] Checking development library packages
    ✔ expat-devel: installed
    ✔ zlib-devel: installed

    [Done] Apache build environment check completed.
    [kior-oss@89790c086e28:/sw/apache/shell]$ ls
    0_check_env.sh 1_install.sh
    [kior-oss@89790c086e28:/sw/apache/shell]$ sh 1_install.sh
    [STEP 0/5] Extracting tarballs...
     ✔ Tarballs extracted.
    [STEP 1/5] Building OpenSSL...
     → \

    ( @분 완료 )

    [kior-oss@89790c086e28:/sw/apache/shell]$ sh 1_install.sh

    [STEP 0/5] Extracting tarballs...
     ✔ Tarballs extracted.
    [STEP 1/5] Building OpenSSL...
     ✔ OpenSSL build completed.
    [STEP 2/5] Building APR...
     ✔ APR build completed.
    [STEP 3/5] Building APR-util...
     ✔ APR-util build completed.
    [STEP 4/5] Building PCRE...
     ✔ PCRE build completed.
    [STEP 5/5] Building Apache HTTPD...
     → /
     ✔ Apache HTTPD build completed.

     

     

     

     

     

    ✅ 설치완료

    설치가 완료되면 우선 버전정보와 load된 모듈을 확인합니다.
    그 후 기동하여 Welcome 페이지를 호출합니다.
    [kior-oss@89790c086e28:/sw/apache/shell]$ httpd -V
    Server version: Apache/2.4.66 (Unix)
    Server built: Jan 8 2026 20:07:47
    Server's Module Magic Number: 20120211:141
    Server loaded: APR 1.7.6, APR-UTIL 1.6.3, PCRE 10.47 2025-10-21
    Compiled using: APR 1.7.6, APR-UTIL 1.6.3, PCRE 10.47 2025-10-21
    Architecture: 64-bit
    Server MPM: worker
    threaded: yes (fixed thread count)
    forked: yes (variable process count)
    Server compiled with....
    -D APR_HAS_SENDFILE
    -D APR_HAS_MMAP
    -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
    -D APR_USE_PROC_PTHREAD_SERIALIZE
    -D APR_USE_PTHREAD_SERIALIZE
    -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
    -D APR_HAS_OTHER_CHILD
    -D AP_HAVE_RELIABLE_PIPED_LOGS
    -D DYNAMIC_MODULE_LIMIT=256
    -D HTTPD_ROOT="/sw/apache/apache2.4"
    -D SUEXEC_BIN="/sw/apache/apache2.4/bin/suexec"
    -D DEFAULT_PIDLOG="logs/httpd.pid"
    -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
    -D DEFAULT_ERRORLOG="logs/error_log"
    -D AP_TYPES_CONFIG_FILE="conf/mime.types"
    -D SERVER_CONFIG_FILE="conf/httpd.conf"
    # 리눅스는 1024이하에서 ROOT 권한이 있어야 바인딩이 가능!(Docker와 같은 환경은 제외)
    [root@89790c086e28 /]# id
    uid=0(root) gid=0(root) groups=0(root)

    [root@89790c086e28 /]# setcap 'cap_net_bind_service=+ep' /sw/apache/apache2.4/bin/httpd
    [kior-oss@89790c086e28:/sw]$ apachectl start
    AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message

    [kior-oss@89790c086e28:/sw]$ ps -ef | grep httpd
    kior-oss 74 1 0 23:13 ? 00:00:00 /run/rosetta/rosetta /sw/apache/apache2.4/bin/httpd /sw/apache/apache2.4/bin/httpd -k start
    kior-oss 75 74 0 23:13 ? 00:00:00 /run/rosetta/rosetta /sw/apache/apache2.4/bin/httpd /sw/apache/apache2.4/bin/httpd -k start
    kior-oss 76 74 0 23:13 ? 00:00:00 /run/rosetta/rosetta /sw/apache/apache2.4/bin/httpd /sw/apache/apache2.4/bin/httpd -k start
    kior-oss 77 74 0 23:13 ? 00:00:00 /run/rosetta/rosetta /sw/apache/apache2.4/bin/httpd /sw/apache/apache2.4/bin/httpd -k start

    [kior-oss@89790c086e28:/sw]$ netstat -an | grep 80
    tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN

     

     

    🚨 apache 기동시 Warning LOG

    AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message

    # 서비스에는 무관합니다
    1. Apache가 자신의 서버의 FQDN(정규 도메인 이름) 찾지 못함
    2. 임시로 IP주소(172.17.0.2)를 부여
    3. 경고를 없애기 위해서는 httpd.conf에 ServerName 명시적으로 설정

     

     

     


    💭 마무리

    apache 설치를 조금 더 편안하게 할 수 있도록 작성한 포스팅입니다.

    아래의 순서를 정리해두도록 하겠습니다.

    + GitHub에서 TAR 다운로드
    + 설치 서버에서 경로생성 및 TAR 묶음 해제
    + tarballs 폴더에 컴파일할 패키지 다운로드
    + 시스템 환경변수 설정
    + SHELL 실행

     

    Apache 설치를 위한 SHELL은 2025년도 부터 준비했던 건데...

    핑계를 두며 미루다 2026년에 되어서 마무리하게 되었습니다...

     

    미루지 말고 바로바로 올리도록!

     

     

     

Designed by Tistory.