본문 바로가기
Web/자잘한거

CentOs 7.1v / APM(php 7) install

by juein 2018. 2. 26.

centos 7.1 v 에서 apm 설치


[기존 설치파일 삭제]
yum remove -y httpd*
yum remove -y php*
yum remove -y mysql*

 

[yum 업데이트]
yum -y update

 

[아파치 설치]
yum install httpd

 

[실행설정]
systemctl enable httpd
systemctl start httpd

 

[설치확인]
rpm -qa | egrep "^(httpd*|mariadb*|mysql*|php*)"

 

[방화벽 등록]
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --reload

 

[마리아db 설치]
yum install mariadb-*

 

[실행설정]
systemctl enable mariadb
systemctl start mariadb

 

[루트비번설정]
mysql_secure_installation

 

[저장소 활용]
yum install epel-release
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

 

[php7설치]
yum install php70w

 

[버전확인]
php -v

 

[mysql,php 패키지설치]
yum install php70w-xml php70w-xmlrpc php70w-soap php70w-mbstring php70w-json php70w-gd php70w-mcrypt php70w-mysql

 

[아파치 재시작]
systemctl restart httpd

 

[phpinfo 작성으로 확인]
vi /var/www/html/test.php
내용 <?php phpinfo(); ?>

 

[아파치 설정]

vi /etc/httpd/conf/httpd.conf
====

#User apache /*User nobody 변경 */
#Group apache /*Group nobody 변경 */

User nobody
Group nobody

 

ServerName 도메인:80
DocumentRoot "/var/www/html" /* 경로 변경 시 해당 경로 755 변경 및 Selinux 보안 기능(?)을 중지하고 아파치 서버를 재 가동 */
< Directory "/var/www/html"> /* DocumentRoot와 동일하게 */
<IfModule dir_module>
DirectoryIndex index.html index.php index.htm
</IfModule>
AddDefaultCharset UTF-8 /* 기본 인코딩 설정 */

====

 

[방화벽 상태 확인 ]

systemctl status firewalld

 

[방화벽에 port 추가]

vi /etc/firewalld/zones/public.xml

====
<?xml version="1.0" encoding="utf-8"?>
<zone>
<short>Public</short>
<description>For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description>
<service name="dhcpv6-client"/>
<service name="ssh"/>
<port protocol="tcp" port="80"/>
<port protocol="tcp" port="3306"/>
</zone>

====

systemctl reload firewalld /* 방화벽 적용 */
systemctl start firewalld /* 방화벽 시작 */

 

[mysql 로컬로그인]

mysql -u root -p

INSERT INTO mysql.user (host,user,password) VALUES ('%','root',password('비밀번호'));
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';
FLUSH PRIVILEGES;
quit;

 

netstat -ntlp | grep mysqld
/* 확인 --- tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 18055/mysqld */

 

rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
rpm -Uvh mysql-community-release-el7-5.noarch.rpm
yum repolist

yum -y install mysql-community-server

 

[utf8 설정 - 기존내용 하단에 아래내용 추가]

vi /etc/my.cnf

=====
[client]
default-character-set = utf8

[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

# Recommended in standard MySQL setup
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

character-set-client-handshake=FALSE
init_connect="SET collation_connection = utf8_general_ci"
init_connect="SET NAMES utf8"
character-set-server = utf8
collation-server = utf8_general_ci

[mysqldump]
default-character-set = utf8

[mysql]
default-character-set = utf8

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
=====

 

/usr/bin/systemctl enable mysqld
/usr/bin/systemctl start mysqld

 

/*--------
[포트허용]
firewall-cmd --permanent --zone=public --add-port=3306/tcp
firewall-cmd --reload


[데이터베이스 생성 & 계정생성 & 권한부여]

mysql -u root -p 

create database 데이터베이스명 default character set utf8;  

create user '유저명'@'%' identified by '비밀번호';

grant all privileges on *.* to '유저명'@'%';
*---------/

 

[timezone 설정]
//서울 시간 확인
ls /usr/share/zoneinfo/Asia

mv /etc/localtime /etc/localtime_org
ln -s /usr/share/zoneinfo/Asia/Seoul /etc/localtime

'Web > 자잘한거' 카테고리의 다른 글

파일시스템  (0) 2018.03.02
3 way hand shake  (0) 2018.03.02
OSI 7 계층  (0) 2018.03.02
TCP/IP  (0) 2018.03.02
centOs 7.x / Node js yum install  (0) 2018.02.26

댓글