Linux

사이트이전 1) Centos 7 / Apache 2 설치.

ravon 2024. 7. 15. 10:22

설치후 yum update 에러 방화벽 설정 확인.

 

# systemctl status firewalld

# systemctl stop firewalld
# systemctl disable firewalld

 

-----------------------------------------------------------

Azure 에 이미 설정되 ISO 이미지로 하다보니. yum 이 업데이트 되지 않는다.

 

1) 기존 Repo 파일 백업

먼저 기존 repo 설정 파일 들을 백업 합니다.

cd /etc/yum.repos.d

mkdir bk

mv *.repo ./bk/

 

 

 

2) Base Repo 설정 파일 생성

새로운 Yum Repository 생성을 위해 'CentOS-Base.repo' 파일을 열어 내용을 입력합니다.

vi /etc/yum.repos.d/CenOS-Base.repo

 

[base]
name=CentOS-$releasever - Base
baseurl=http://mirror.kakao.com/centos/$releasever/os/$basearch/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates
# kakao
baseurl=http://mirror.kakao.com/centos/$releasever/updates/$basearch
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=http://centos.mirror.cdnetworks.com/$releasever/extras/$basearch
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://centos.mirror.cdnetworks.com/$releasever/centosplus/$basearch
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
baseurl=http://centos.mirror.cdnetworks.com/$releasever/contrib/$basearch
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

 

 

3) 적용

새로운 Repo 설정을 위해 기존 Repo 정보를 초기화 해주세요.

yum clean all

yum repolist

 

 

4) Kakao 서버 DNS 확인

만약 'Could not resolve host: mirror.kakao.com; 알 수 없는 오류' 발생 시

'mirror.kakao.com' 서버의 DNS 조회가 안되는 상황일 수 있으니 DNS 설정을 해주시면 됩니다.

 

DNS 설정 방법은 2가지로 나뉩니다.

  • 인터페이스 파일에 지정
# vi /etc/sysconfig/network-scripts/ifcfg-[NIC명]

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.111.180
GATEWAY=192.168.111.2
DNS1=8.8.8.8
  • /etc/resolv.conf 파일에 지정
# vi /etc/resolv.conf

nameserver 8.8.8.8

 

이후 네트워크 재시작 이후 다시 3번을 진행하시면 됩니다.

 

 

--------------------------------------------------------------------------------------------------------------------------

 

 

YUM 리포지토리에서 httpd 패키지 정보 확인하기

# yum info httpd
Loaded plugins: fastestmirror, langpacks
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Loading mirror speeds from cached hostfile
Available Packages
Name        : httpd
Arch        : x86_64
Version     : 2.4.6
Release     : 99.el7.centos.1
Size        : 2.7 M
Repo        : updates/7/x86_64
Summary     : Apache HTTP Server
URL         : http://httpd.apache.org/
License     : ASL 2.0
Description : The Apache HTTP Server is a powerful, efficient, and extensible
            : web server.

 

다음 명령을 실행하여  설치할 수 있는 httpd 패키지 정보를 확인합니다.

 

Apache HTTP Server 설치하기

 

# yum install -y httpd

 

 

위에서 확인한 httpd-2.4.6 패키지를 설치합니다.

 

 

httpd 서비스 자동 시작 등록하기

#systemctl enable httpd