깐죽이의 정보 바다

리눅스에 APM을 설치하기 앞서 버전별로 호환하는게 달라 리눅스 명령어로 버전을 확인해보자.

 

1. 현재 설치하고자 하는 OS 와 버전확인 하기

설치 OS 와 버전  Centos 7

 

▶ OS버전확인하기

 

리눅스 OS 버전 확인 명령어

리눅스에서 OS 버전 확인 명령어는 여러개 있습니다. #리눅스 커널정보 확인 [root@localhost /]# uname -a Linux localhost.localdomain 3.10.0-1127.19.1.el7.x86_64 #1 SMP Tue Aug 25 17:23:54 UTC 2020 x86_6..

kimkkanjuk.tistory.com

2. 현재 사용자 권한 확인하기

기본적으로 root 권한에서 설치를 진행 해야 합니다. 

 

[kadmin@localhost ~]$ su
Password:

 

 

3. CentOS를 최신 업데이트 상태로 유지

시간이 약간 오래 걸립니다. 

[root@localhost /]# yum update -y
Loaded plugins: fastestmirror
Determining fastest mirrors
  wpa_supplicant.x86_64 1:2.6-12.el7_9.2
  xfsprogs.x86_64 0:4.5.0-22.el7
  yum.noarch 0:3.4.3-168.el7.centos
  zlib.x86_64 0:1.2.7-19.el7_9
  zlib-devel.x86_64 0:1.2.7-19.el7_9

Complete!

4. yum을 통해서 Apache를 설치합니다.

yum 으로 설치하는게 소스 설치보다 시간적인 여유가 있네요.

[root@localhost /]# yum install httpd -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.kakao.com
 * extras: mirror.kakao.com
 * updates: mirror.kakao.com
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-97.el7.centos.2 will be installed
--> Processing Dependency: httpd-tools = 2.4.6-97.el7.centos.2 for package: httpd-2.4.6-       97.el7.centos.2.x86_64
--> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-97.el7.centos.2.x86_       64
--> Running transaction check
---> Package httpd-tools.x86_64 0:2.4.6-97.el7.centos.2 will be installed
---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================
 Package             Arch           Version                       Repository       Size
========================================================================================
Installing:
 httpd               x86_64         2.4.6-97.el7.centos.2         updates         2.7 M
Installing for dependencies:
 httpd-tools         x86_64         2.4.6-97.el7.centos.2         updates          94 k
 mailcap             noarch         2.1.41-2.el7                  base             31 k

Transaction Summary
========================================================================================
Install  1 Package (+2 Dependent packages)

Total download size: 2.8 M
Installed size: 9.6 M
Downloading packages:
(1/3): mailcap-2.1.41-2.el7.noarch.rpm                           |  31 kB  00:00:00
(2/3): httpd-tools-2.4.6-97.el7.centos.2.x86_64.rpm              |  94 kB  00:00:00
(3/3): httpd-2.4.6-97.el7.centos.2.x86_64.rpm                    | 2.7 MB  00:00:00
----------------------------------------------------------------------------------------
Total                                                       13 MB/s | 2.8 MB  00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : httpd-tools-2.4.6-97.el7.centos.2.x86_64                             1/3
  Installing : mailcap-2.1.41-2.el7.noarch                                          2/3
  Installing : httpd-2.4.6-97.el7.centos.2.x86_64                                   3/3
  Verifying  : httpd-2.4.6-97.el7.centos.2.x86_64                                   1/3
  Verifying  : mailcap-2.1.41-2.el7.noarch                                          2/3
  Verifying  : httpd-tools-2.4.6-97.el7.centos.2.x86_64                             3/3

Installed:
  httpd.x86_64 0:2.4.6-97.el7.centos.2

Dependency Installed:
  httpd-tools.x86_64 0:2.4.6-97.el7.centos.2        mailcap.noarch 0:2.1.41-2.el7

Complete!

 

 

5. 이제 웹서버가 잘 설치되어 있는지 확인해봅니다. 

 

아파치 데몬을 띄우고 해당 아이피를 주소창에 치면 

[root@localhost /]# service httpd start
Redirecting to /bin/systemctl start httpd.service
[root@localhost /]# ps -ef | grep httpd
root      1000     1  0 12:53 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    1001  1000  0 12:53 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    1002  1000  0 12:53 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    1003  1000  0 12:53 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    1004  1000  0 12:53 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    1005  1000  0 12:53 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
root      1010 24044  0 12:55 pts/0    00:00:00 grep --color=auto httpd

 

웹서버 초기 접속화면

아이피를 인터넷 주소창에 넣으면 위에 이미지가 떠야 합니다. 간혹 80포트가 막혀있어 안뜰경우 아래 명령어로 포트를 열어주셔야 합니다. 

 

firewall-cmd --permanet --zone=public --add-port=80/tcp
firewall-cmd --reload

 

아파치 버전 확인 

[root@localhost conf.d]# httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built:   Nov 10 2021 14:26:31

설치후 버전과 설치 경로가 어디에 됐는지 확인하자.

 

아파치 httpd.conf 확인 난중에 설정할려면 중요합니다.

[root@localhost conf]# pwd
/etc/httpd/conf

6. PHP 설치하기

아파치 설치와 마찬가지로 PHP도 yum 으로 설치를 해줍니다. 

[root@localhost /]# yum install php -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.kakao.com
 * extras: mirror.kakao.com
 * updates: mirror.kakao.com
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:5.4.16-48.el7 will be installed
--> Processing Dependency: php-common(x86-64) = 5.4.16-48.el7 for package: p         hp-5.4.16-48.el7.x86_64
--> Processing Dependency: php-cli(x86-64) = 5.4.16-48.el7 for package: php-         5.4.16-48.el7.x86_64
--> Running transaction check
---> Package php-cli.x86_64 0:5.4.16-48.el7 will be installed
---> Package php-common.x86_64 0:5.4.16-48.el7 will be installed
--> Processing Dependency: libzip.so.2()(64bit) for package: php-common-5.4.         16-48.el7.x86_64
--> Running transaction check
---> Package libzip.x86_64 0:0.10.1-8.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================
 Package            Arch           Version               Repository    Size
============================================================================
Installing:
 php                x86_64         5.4.16-48.el7         base         1.4 M
Installing for dependencies:
 libzip             x86_64         0.10.1-8.el7          base          48 k
 php-cli            x86_64         5.4.16-48.el7         base         2.7 M
 php-common         x86_64         5.4.16-48.el7         base         565 k

Transaction Summary
============================================================================
Install  1 Package (+3 Dependent packages)

Total download size: 4.7 M
Installed size: 17 M
Downloading packages:
(1/4): libzip-0.10.1-8.el7.x86_64.rpm                  |  48 kB   00:00
(2/4): php-5.4.16-48.el7.x86_64.rpm                    | 1.4 MB   00:00
(3/4): php-common-5.4.16-48.el7.x86_64.rpm             | 565 kB   00:00
(4/4): php-cli-5.4.16-48.el7.x86_64.rpm                | 2.7 MB   00:00
----------------------------------------------------------------------------
Total                                           20 MB/s | 4.7 MB  00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libzip-0.10.1-8.el7.x86_64                               1/4
  Installing : php-common-5.4.16-48.el7.x86_64                          2/4
  Installing : php-cli-5.4.16-48.el7.x86_64                             3/4
  Installing : php-5.4.16-48.el7.x86_64                                 4/4
  Verifying  : php-5.4.16-48.el7.x86_64                                 1/4
  Verifying  : libzip-0.10.1-8.el7.x86_64                               2/4
  Verifying  : php-cli-5.4.16-48.el7.x86_64                             3/4
  Verifying  : php-common-5.4.16-48.el7.x86_64                          4/4

Installed:
  php.x86_64 0:5.4.16-48.el7

Dependency Installed:
  libzip.x86_64 0:0.10.1-8.el7           php-cli.x86_64 0:5.4.16-48.el7
  php-common.x86_64 0:5.4.16-48.el7

Complete!

 

php가 설치됐으면 아파치를 재시작

[root@localhost /]# service httpd restart
Redirecting to /bin/systemctl restart httpd.service

php 버전 확인

[root@localhost /]# php -v
PHP 5.4.16 (cli) (built: Apr  1 2020 04:07:17)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

 

이제 인덱스 파일을 수정해서 php가 제대로 뜨는지 확인해봅시다. 

[root@localhost html]# vi index.php

Shift + i 를 눌러 편집을 해줍니다. 

인덱스 파일에 입력하기

 

:wq 를 입력해서 저장하고 빠져나와줍니다. 

 

다시 주소창에 아이피를 입력하면 다음과 같은 화면이 나와야 합니다. 

phpinfo

7. mysql 설치합니다. 

mysql 도 마찬가지 yum 으로 설치를 해줍니다. 

 

# MySql 5.6버전

[root@localhost /]# yum -y install http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
Loaded plugins: fastestmirror
mysql-community-release-el7-5.noarch.rpm                                                                             | 6.0 kB  00:00:00
Examining /var/tmp/yum-root-w9MTlQ/mysql-community-release-el7-5.noarch.rpm: mysql-community-release-el7-5.noarch
Marking /var/tmp/yum-root-w9MTlQ/mysql-community-release-el7-5.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-release.noarch 0:el7-5 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================
 Package                               Arch                 Version               Repository                                           Size
============================================================================================================================================
Installing:
 mysql-community-release               noarch               el7-5                 /mysql-community-release-el7-5.noarch               4.3 k

Transaction Summary
============================================================================================================================================
Install  1 Package

Total size: 4.3 k
Installed size: 4.3 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : mysql-community-release-el7-5.noarch                                                                                     1/1
  Verifying  : mysql-community-release-el7-5.noarch                                                                                     1/1

Installed:
  mysql-community-release.noarch 0:el7-5

Complete!

[root@localhost /]# yum install mysql-community-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.kakao.com
 * extras: mirror.kakao.com
 * updates: mirror.kakao.com
mysql-connectors-community                                                                                           | 2.6 kB  00:00:00
mysql-tools-community                                                                                                | 2.6 kB  00:00:00
mysql56-community                                                                                                    | 2.6 kB  00:00:00
(1/3): mysql-connectors-community/x86_64/primary_db                                                                  |  87 kB  00:00:00
(2/3): mysql-tools-community/x86_64/primary_db                                                                       |  92 kB  00:00:00
(3/3): mysql56-community/x86_64/primary_db                                                                           | 297 kB  00:00:00
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:5.6.51-2.el7 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 5.6.51-2.el7 for package: mysql-community-server-5.6.51-2.el7.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 5.6.10 for package: mysql-community-server-5.6.51-2.el7.x86_64
--> Processing Dependency: libaio.so.1(LIBAIO_0.1)(64bit) for package: mysql-community-server-5.6.51-2.el7.x86_64
--> Processing Dependency: libaio.so.1(LIBAIO_0.4)(64bit) for package: mysql-community-server-5.6.51-2.el7.x86_64
--> Processing Dependency: perl(DBI) for package: mysql-community-server-5.6.51-2.el7.x86_64
--> Processing Dependency: libaio.so.1()(64bit) for package: mysql-community-server-5.6.51-2.el7.x86_64
--> Running transaction check
---> Package libaio.x86_64 0:0.3.109-13.el7 will be installed
---> Package mysql-community-client.x86_64 0:5.6.51-2.el7 will be installed
--> Processing Dependency: mysql-community-libs(x86-64) >= 5.6.10 for package: mysql-community-client-5.6.51-2.el7.x86_64
---> Package mysql-community-common.x86_64 0:5.6.51-2.el7 will be installed
---> Package perl-DBI.x86_64 0:1.627-4.el7 will be installed
--> Processing Dependency: perl(RPC::PlServer) >= 0.2001 for package: perl-DBI-1.627-4.el7.x86_64
--> Processing Dependency: perl(RPC::PlClient) >= 0.2000 for package: perl-DBI-1.627-4.el7.x86_64
--> Running transaction check
---> Package mysql-community-libs.x86_64 0:5.6.51-2.el7 will be installed
---> Package perl-PlRPC.noarch 0:0.2020-14.el7 will be installed
--> Processing Dependency: perl(Net::Daemon) >= 0.13 for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Net::Daemon::Test) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Net::Daemon::Log) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Compress::Zlib) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Running transaction check
---> Package perl-IO-Compress.noarch 0:2.061-2.el7 will be installed
--> Processing Dependency: perl(Compress::Raw::Zlib) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
--> Processing Dependency: perl(Compress::Raw::Bzip2) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
---> Package perl-Net-Daemon.noarch 0:0.48-5.el7 will be installed
--> Running transaction check
---> Package perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 will be installed
---> Package perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 will be installed
--> Finished Dependency Resolution


Total download size: 91 M
Installed size: 365 M
Is this ok [y/d/N]: Y

사이즈 365M 설치 할거냐고 묻는데 "y" 눌러줍니다.  GPM-KEY 다시 'y" 눌러줍니다.

 

[root@localhost lib]# systemctl enable mysqld
[root@localhost lib]# systemctl start mysqld

 

시작프로그램 등록해주고 /var/lib/mysql 파일이 생겼는지 확인하고 데몬이 떳는지 확인해줍니다. 

 

[root@localhost lib]# ps -ef | grep mysqld
mysql     6126     1  0 17:04 ?        00:00:00 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
mysql     6292  6126  0 17:04 ?        00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
root      6323  5788  0 17:05 pts/0    00:00:00 grep --color=auto mysqld

 

 

이것으로 설치 완료 이제는 웹호스팅을 위해서 가상호스트, mysql 어드민 설정하는법 보겠습니다. 

반응형

공유하기

facebook twitter kakaoTalk kakaostory naver band shouturl