httpd를 이용한 local repository 구축(feat. Centos 8)

Seung·2022년 2월 14일
0

1. local repository 구축하기
2. httpd 세팅
3. client 구축하기
4. httpd repo test하기


1. local repository 구축하기

  • /home/centos 경로에 local repo를 구축

local repository 구축하기


  • repository 권한 설정하기

# chcon -R -t httpd_user_content_t /home/centos/files_repo

# chmod 711 /home/centos/files_repo

이 때 home/, entos/, files_repo/ 디렉터리 모두 최소 711의 권한을 가져야 한다.


  • 로컬 레포지토리 구축이 완료 확인
[root@localhost ~]# yum repolist
repo id                        repo name
var_www_html_files_repo        created by dnf config-manager from file:///var/www/html/files_repo

참고로 httpd repository로 사용할 것이므로, repo가 비활성 상태(enabled=0)이여도 무관하다.


2. httpd 세팅

  • httpd 설치

# yum install httpd -y


  • 방화벽 해제

# firewall-cmd --add-service={http,https} --permanent
# firewall-cmd --reload

또는 방화벽을 꺼두자
# systemctl stop firewalld


  • selinux 해제
    (단, 이 방식은 재부팅 후, 원래대로 돌아온다)
[root@localhost ~]# getenforce
Enforcing
[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce
Permissive

  • httpd.conf 세팅
    /etc/httpd/conf/httpd.conf를 다음과 같이 수정한다.

# vi /etc/httpd/conf/httpd.conf

<Directory />
   AllowOverride All
   Require all granted
   Order deny,allow
</Directory>

DocumentRoot "/home/centos/files-repo"

<Directory "/home/centos/files-repo">
   AllowOverride None
   Require all granted
</Directory>

  • http 재시작

# systemctl restart httpd


3. client 구축하기

httpd repo의 클라이언트가 될 서버에서 repository를 구축한다


  • client에서 사용할 repo setting
[root@localhost ~]# cat /etc/yum.repos.d/my-repo.repo 
[repo-server]
name=Repository server   
baseurl=http://192.168.9.237/  #httpd가 있는 서버의 IP
enabled=1
gpgcheck=0

  • Repo 설정이 잘 되었는지 확인
[root@localhost ~]# yum repolist
repo id                                          repo name
repo-server                                      Repository server

4. httpd repo test하기

  • local repo에 있는 패키지를 하나 골라 client에서 설치가 잘 되는지 확인
[root@localhost ~]# yum install sshpass
마지막 메타 데이터 만료 확인 : 0:10:41 전에 2022년 02월 13일 (일) 오후 07시 43분 21초.
Dependencies resolved.
========================================================================================================
 Package               Architecture         Version                     Repository                 Size
========================================================================================================
Installing:
 sshpass               x86_64               1.06-9.el8                  repo-server                27 k

Transaction Summary
========================================================================================================
설치  1 Package

Total download size: 27 k
Installed size: 40 k
Is this ok [y/N]: 
profile
인프라 마스터가 되고 싶어요

0개의 댓글