CentOS7 yum APM 설치 / Laravel 사용을 위한 최신 release 버전 서버 세팅

CentOS7 yum APM 설치 / Laravel 사용을 위한 최신 release 버전 서버 세팅

Stack

CentOS 7.6, Apache 2.4.39, PHP 7.3.6, MariaDB 10.3, Git 2.18.0, Composer 1.8.5, Laravel 5.8

# Etc

- 리부팅시 자동실행 여부 확인

systemctl list-unit-files --type=service | grep service name

ex) systemctl list-unit-files --type=service | grep httpd

# 추가 패키지 설치

1. yum install epel-release

2. yum install http://rpms.famillecollet.com/enterprise/remi-release-7vi.rpm

# 패키지 유틸리티 설치

yum install epel-release yum-util

# Apache

- repo 등록

cd /etc/yum.repos.d && wget https://repo.codeit.guru/codeit.el7.repo

- 설치

yum install httpd -y

- 버전확인

httpd -v

- apachectl 명령어

start

stop

status

configtest or -t (httpd.conf 문법 검사)

graceful (프로세스만 재시작 하여 커넥션 유지되어 운영중 httpd.conf 변경시 사용)

ex) apachectl start

- PHP index 파일인식 / httpd.conf

DirectoryIndex index.html index.php

- mime-type 추가 / httpd.conf

# If the AddEncoding directives above are commented-out, then you

# probably should define those extensions to indicate media types:

#

AddType application/x-compress .Z

AddType application/x-gzip .gz .tgz

AddType application/x-httpd-php .php .html .htm .inc

AddType application/x-httpd-php-source .phps

- 아파치 보안 권장설정 헤더 와 404 페이지에서 OS, 아파치 버전 정보를 숨김 / httpd.conf

ServerTokens Prod

ServerSignature Off

- .htaccess 파일 허용

AllowOverride All

- 리부팅시 자동실행

systemctl enable httpd.service

# PHP

- 설치

1. yum-config-manager --enable remi-php73

2. yum install php -y

- 버전확인

php -v

- Modules 목록

php -m

-- 구성파일 목록

php --ini

- 확장모듈 설치

yum install zip unzip php-mysqlnd php-bcmath php-xml php-mbstring php-pdo php-pecl-zip php-opcache -y

- 헤더 php 정보 미노출 / php.ini

expose_php = Off

# MariaDB

- repo 등록

cd /etc/yum.repos.d && vi /etc/yum.repos.d/MariaDB.repo

[mariadb]

name = MariaDB

baseurl = http://yum.mariadb.org/10.3/centos7-amd64

gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

gpgcheck=1

- 설치

yum install MariaDB-server

- 시작

systemctl start mariadb

- 패스워드 변경

/usr/bin/mysqladmin -u root password 'password'

ex) /usr/bin/mysqladmin -u root password '1234'

- mariadb 접속

mysql -u user -p

ex) mysql -u root -p

- 리부팅시 자동실행

systemctl enable mariadb.service

- 참고자료

https://zetawiki.com/wiki/CentOS7_MariaDB_%EC%84%A4%EC%B9%98

# Composer

- 설치

curl -sS https://getcomposer.org/installer | php

- 전역 명령어로 등록

mv composer.phar /usr/local/bin/composer

- 버전확인

composer -v

- 참고자료

https://zetawiki.com/wiki/%EB%A6%AC%EB%88%85%EC%8A%A4_composer_%EC%84%A4%EC%B9%98

# Git

- repo 등록

rpm -ivh http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-2.noarch.rpm

- 설치

yum install git -y

# Laraval

- 설치

composer create-project --prefer-dist laravel/laravel blog

- timezone 수정 / config/app.php

'timezone' => 'Asia/Seoul',

# firewalld (방화벽)

- 방화벽 시작

systemctl start firewalld

- 서비스 등록

firewall-cmd --permanent --zone=public --add-service=http

firewall-cmd --permanent --zone=public --add-service=mysql

firewall-cmd --reload

- 리부팅시 자동실행

systemctl enable firewalld

from http://kuku1198.tistory.com/5 by ccl(A) rewrite - 2021-10-27 20:26:14