151 lines
3.9 KiB
Markdown
151 lines
3.9 KiB
Markdown
# FHS CentOS 6 빌드와 Apache 실행
|
|
|
|
## 0. 실행 준비
|
|
|
|
모든 명령은 같은 셸 세션에서 저장소 루트 디렉터리로 이동한 뒤 실행한다.
|
|
|
|
```bash
|
|
cd "$(git rev-parse --show-toplevel)"
|
|
|
|
RUN_ID="$(date +%Y%m%d%H%M%S)-$$"
|
|
FHS_CONTAINER="interactive-fhs-centos6-${RUN_ID}"
|
|
APACHE_CONTAINER="interactive-apache-2.4.68-${RUN_ID}"
|
|
|
|
free_port() {
|
|
local port=$1
|
|
while (echo >/dev/tcp/127.0.0.1/"$port") 2>/dev/null; do
|
|
port=$((port + 1))
|
|
done
|
|
printf '%s\n' "$port"
|
|
}
|
|
|
|
APACHE_PORT="$(free_port 18068)"
|
|
```
|
|
|
|
## 1. CentOS 6 빌드 컨테이너
|
|
|
|
```bash
|
|
podman pull docker.io/library/centos:centos6
|
|
podman run -d \
|
|
--name "$FHS_CONTAINER" \
|
|
--volume "$PWD:/workspace:Z" \
|
|
--workdir /workspace/fhs \
|
|
docker.io/library/centos:centos6 \
|
|
sleep infinity
|
|
```
|
|
|
|
## 2. CentOS 6 저장소와 빌드 의존성
|
|
|
|
CentOS 6 종료 후 저장소를 vault로 변경한다.
|
|
|
|
```bash
|
|
podman exec "$FHS_CONTAINER" cp -p \
|
|
/etc/yum.repos.d/CentOS-Base.repo \
|
|
/etc/yum.repos.d/CentOS-Base.repo.before-vault
|
|
|
|
centos_base='^#baseurl=.*\$releasever'
|
|
centos_vault='baseurl=http://vault.centos.org/6.10'
|
|
|
|
podman exec "$FHS_CONTAINER" sed -i \
|
|
-e 's|^mirrorlist=|#mirrorlist=|' \
|
|
-e "s|${centos_base}|${centos_vault}|" \
|
|
/etc/yum.repos.d/CentOS-Base.repo
|
|
```
|
|
|
|
```bash
|
|
podman exec "$FHS_CONTAINER" yum install -y \
|
|
gcc gcc-c++ make pkgconfig
|
|
|
|
podman exec "$FHS_CONTAINER" yum install -y \
|
|
boost-devel openssl-devel sqlite-devel openldap-devel
|
|
|
|
epel_base=http://archives.fedoraproject.org/pub/archive/epel/6
|
|
|
|
podman exec "$FHS_CONTAINER" yum install -y \
|
|
"${epel_base}/x86_64/epel-release-6-8.noarch.rpm"
|
|
|
|
epel_old='^#baseurl=.*\$basearch$'
|
|
epel_new='baseurl='"${epel_base}"'/$basearch'
|
|
podman exec "$FHS_CONTAINER" sed -i \
|
|
-e 's|^mirrorlist=|#mirrorlist=|' \
|
|
-e "s|${epel_old}|${epel_new}|" \
|
|
/etc/yum.repos.d/epel.repo
|
|
|
|
podman exec "$FHS_CONTAINER" yum install -y libxml++-devel
|
|
```
|
|
|
|
PostgreSQL 9.3 경로와 FHS Makefile에서 사용하는 추가 도구를 준비한다.
|
|
|
|
```bash
|
|
PG93_BASE=http://download.postgresql.org/pub/repos/yum/9.3/redhat/rhel-6-x86_64
|
|
|
|
podman exec "$FHS_CONTAINER" yum install -y \
|
|
${PG93_BASE}/postgresql93-9.3.25-1PGDG.rhel6.x86_64.rpm \
|
|
${PG93_BASE}/postgresql93-libs-9.3.25-1PGDG.rhel6.x86_64.rpm \
|
|
${PG93_BASE}/postgresql93-devel-9.3.25-1PGDG.rhel6.x86_64.rpm
|
|
|
|
podman exec "$FHS_CONTAINER" mkdir -p /user/db
|
|
podman exec "$FHS_CONTAINER" ln -s /usr/pgsql-9.3 /user/db/pgsql
|
|
podman exec "$FHS_CONTAINER" yum install -y libmcrypt-devel bc
|
|
```
|
|
|
|
## 3. FHS 빌드
|
|
|
|
`podman exec -w`로 FHS 작업 디렉터리를 지정해 구성요소를 빌드한다.
|
|
|
|
```bash
|
|
podman exec -w /workspace/fhs "$FHS_CONTAINER" bash -lc '
|
|
for component in arcmond2 cls csagentd fimngd ftsd sh-opendav; do
|
|
echo "===== BUILD ${component} ====="
|
|
make all -C "${component}"
|
|
echo "===== STATUS ${component} $? ====="
|
|
done
|
|
'
|
|
```
|
|
|
|
빌드 결과:
|
|
|
|
```text
|
|
ftsd 성공
|
|
arcmond2 실패: 제공된 정적 라이브러리의 __inet_addr, __error 심볼
|
|
cls 실패: CentOS 6에 setproctitle 없음
|
|
csagentd 실패: ShmDefine.h의 uint64_t 미정의 및 연쇄 컴파일 오류
|
|
fimngd 실패: /user/service/httpd/include의 Apache APR 헤더 없음
|
|
sh-opendav 실패: Makefile에 all target 없음
|
|
```
|
|
|
|
## 4. 빌드 산출물 확인
|
|
|
|
```bash
|
|
file fhs/ftsd/src/ftsd
|
|
file fhs/ftsd/interface/sample/ftsd_test
|
|
file fhs/ftsd/lib/libInterCommon.a
|
|
```
|
|
|
|
## 5. Apache 실행 테스트
|
|
|
|
Apache 최신 버전 2.4.68을 실행하고 HTTP 응답을 확인한다.
|
|
|
|
### Apache 2.4.68
|
|
|
|
```bash
|
|
podman pull docker.io/library/httpd:2.4.68
|
|
podman run -d \
|
|
--name "$APACHE_CONTAINER" \
|
|
-p "${APACHE_PORT}:80" \
|
|
docker.io/library/httpd:2.4.68
|
|
|
|
podman exec "$APACHE_CONTAINER" httpd -v
|
|
curl -sS -D - "http://127.0.0.1:${APACHE_PORT}/" \
|
|
-o /tmp/apache-2.4.68-body
|
|
```
|
|
|
|
검증 결과: `HTTP/1.1 200 OK`, `Server: Apache/2.4.68 (Unix)`.
|
|
|
|
현재 실행 중인 컨테이너 확인:
|
|
|
|
```bash
|
|
podman ps --filter "name=${FHS_CONTAINER}" \
|
|
--filter "name=${APACHE_CONTAINER}"
|
|
```
|