CentOS 7 간단 웹서버 구축 APM - yum 설치

CentOS 7 간단 웹서버 구축 APM – yum 설치

안녕하세요.

JP-Hosting 입니다.

오늘은 yum을통해 간단 웹서버 구축을 하려고합니다.

  • 테스트환경은 Centos 7.8 버전입니다.

[root@localhost ~]# rpm -qa *-release centos-release-7-8.2003.0.el7.centos.x86_64

  • 의존성 라이브러리 설치

yum으로 필요한 라이브러리를 한번에 전부 설치합니다. (한번에 관련된 의존성도 같이 설치가 됩니다.)


[root@localhost ~]# yum install libjpeg* libpng* freetype* gd-* gcc gcc-c++ gdbm-devel libtermcap-develLoaded plugins: fastestmirror, langpacksLoading mirror speeds from cached hostfile* base: ty1.mirror.newmediaexpress.com* extras: ty1.mirror.newmediaexpress.com* updates: ty1.mirror.newmediaexpress.com...Installed:gcc.x86_64 0:4.8.5-39.el7 gcc-c++.x86_64 0:4.8.5-39.el7 ncurses-devel.x86_64 0:5.9-14.20130511.el7_4Dependency Installed:cpp.x86_64 0:4.8.5-39.el7 glibc-devel.x86_64 0:2.17-307.el7.1 glibc-headers.x86_64 0:2.17-307.el7.1 kernel-headers.x86_64 0:3.10.0-1127.8.2.el7libmpc.x86_64 0:1.0.1-3.el7 libstdc++-devel.x86_64 0:4.8.5-39.el7 mpfr.x86_64 0:3.1.1-4.el7Complete!

  • [APM] : Apache, PHP, MariaDB (설치 순서는 Apache, MariaDB, PHP)

1. Apache 설치

[root@localhost ~]# yum install httpdLoaded plugins: fastestmirror, langpacksLoading mirror speeds from cached hostfile* base: ty1.mirror.newmediaexpress.com* extras: ty1.mirror.newmediaexpress.com* updates: ty1.mirror.newmediaexpress.comResolving Dependencies--> Running transaction check---> Package httpd.x86_64 0:2.4.6-93.el7.centos will be installed--> Finished Dependency ResolutionDependencies Resolved==============================================================================================================================================================Package Arch Version Repository Size==============================================================================================================================================================Installing:httpd x86_64 2.4.6-93.el7.centos base 2.7 MTransaction Summary==============================================================================================================================================================Install 1 PackageRunning transactionInstalling : httpd-2.4.6-93.el7.centos.x86_64 1/1Verifying : httpd-2.4.6-93.el7.centos.x86_64 1/1Installed:httpd.x86_64 0:2.4.6-93.el7.centosComplete!


2.MariaDB 설치

[root@localhost ~]# yum install mariadb mariadb-serverLoaded plugins: fastestmirror, langpacksLoading mirror speeds from cached hostfile* base: ty1.mirror.newmediaexpress.com* extras: ty1.mirror.newmediaexpress.com* updates: ty1.mirror.newmediaexpress.comResolving Dependencies--> Running transaction check---> Package mariadb.x86_64 1:5.5.65-1.el7 will be installed--> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.65-1.el7 for package: 1:mariadb-5.5.65-1.el7.x86_64---> Package mariadb-server.x86_64 1:5.5.65-1.el7 will be installed--> Processing Dependency: perl-DBD-MySQL for package: 1:mariadb-server-5.5.65-1.el7.x86_64--> Running transaction check---> Package mariadb-libs.x86_64 1:5.5.65-1.el7 will be installed---> Package perl-DBD-MySQL.x86_64 0:4.023-6.el7 will be installed--> Finished Dependency ResolutionDependencies Resolved==============================================================================================================================================================Package Arch Version Repository Size==============================================================================================================================================================Installing:mariadb x86_64 1:5.5.65-1.el7 base 8.7 Mmariadb-server x86_64 1:5.5.65-1.el7 base 11 MInstalling for dependencies:mariadb-libs x86_64 1:5.5.65-1.el7 base 759 kperl-DBD-MySQL x86_64 4.023-6.el7 base 140 kTransaction Summary==============================================================================================================================================================Install 2 Packages (+2 Dependent packages)Total download size: 21 MInstalled size: 112 MIs this ok [y/d/N]:YInstalled:mariadb.x86_64 1:5.5.65-1.el7 mariadb-server.x86_64 1:5.5.65-1.el7Dependency Installed:mariadb-libs.x86_64 1:5.5.65-1.el7 perl-DBD-MySQL.x86_64 0:4.023-6.el7Complete!


3. PHP 설치

[root@localhost ~]# yum install php php-mysqlLoaded plugins: fastestmirror, langpacksLoading mirror speeds from cached hostfile* base: ty1.mirror.newmediaexpress.com* extras: ty1.mirror.newmediaexpress.com* updates: ty1.mirror.newmediaexpress.comResolving Dependencies--> Running transaction check---> Package php.x86_64 0:5.4.16-48.el7 will be installed---> Package php-mysql.x86_64 0:5.4.16-48.el7 will be installed--> Finished Dependency ResolutionDependencies Resolved==============================================================================================================================================================Package Arch Version Repository Size==============================================================================================================================================================Installing:php x86_64 5.4.16-48.el7 base 1.4 Mphp-mysql x86_64 5.4.16-48.el7 base 102 kTransaction Summary==============================================================================================================================================================Install 2 PackagesTotal download size: 1.5 MInstalled size: 4.6 MIs this ok [y/d/N]:YRunning transactionInstalling : php-mysql-5.4.16-48.el7.x86_64 1/2Installing : php-5.4.16-48.el7.x86_64 2/2Verifying : php-5.4.16-48.el7.x86_64 1/2Verifying : php-mysql-5.4.16-48.el7.x86_64 2/2Installed:php.x86_64 0:5.4.16-48.el7 php-mysql.x86_64 0:5.4.16-48.el7Complete!

  • 방화벽 포트허용

여기서는 Iptables를 사용하였습니다.

Centos7 Iptables를 사용하는 방법으로 바로가기


[root@localhost ~]# vi /etc/sysconfig/iptables# sample configuration for iptables service# you can edit this manually or use system-config-firewall# please do not ask us to add additional ports/services to this default configuration*filter:INPUT ACCEPT [0:0]:FORWARD ACCEPT [0:0]:OUTPUT ACCEPT [0:0]-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT-A INPUT -p icmp -j ACCEPT-A INPUT -i lo -j ACCEPT-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT           # 80 포트 추가-A INPUT -j REJECT --reject-with icmp-host-prohibited-A FORWARD -j REJECT --reject-with icmp-host-prohibitedCOMMIT[root@localhost ~]# systemctl restart iptables        [root@localhost ~]# systemctl restart httpd.service  

  • 기본웹페이지 화면 및 phpinfo()확인

기본페이지 확인

phpinfo 확인

유익한 정보가되었을지 모르겠네요

서버관련 문의는 텔레그램으로 연락 주시면 감사하겠습니다.

댓글 없음:

참고: 블로그의 회원만 댓글을 작성할 수 있습니다.

Powered by Blogger.