본문 바로가기
IT 끄적이기

CentOS 7 서버 세팅하기

by 미르아 2020. 7. 7.
728x90

기본 세팅

 

* wget 설치

# yum install wget -y

 

* VPN 설정

CentOS 7에서 iptables 방화벽 데몬 사용하기 참고

방화벽중지

# systemctl stop firewalld

# systemctl mask firewalld

 

설치

# yum install iptables-services -y

# systemctl enable iptables

                                     

iptables 포트 설정해주기

 

APM 설치

 

* 설치전 준비

의존성 라이브러리를 설치합니다
libpng* 의 경우 설치시 충돌이 발생하여...  --skip-broken 옵션을 지정하여 설치

# yum -y install gcc gcc-c++  libtermcap-devel gdbm-devel zlib* libxml* freetype* libjpeg* gd-*
# yum -y install libpng* --skip-broken

 

1. apache 설치

 

# yum -y install httpd

 

vhost 경로에 맞게 수정

 

# vi /etc/httpd/conf.d/vhost.conf

 

 

2. PHP 설치

 

1) Repository data 업데이트

CentOS/RHEL 7 :

# rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm

# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

 

2) 설치

yum install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-mysql php56w-intl php56w-mbstring

 

3) 아파치 재시작

systemctl restart httpd

 

4) 현재버전 확인

[root@wsay ~]# php -v

PHP 5.6.40 (cli) (built: Jan 12 2019 13:11:15)

Copyright (c) 1997-2016 The PHP Group

Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

 

5) 타임존 설정

# vi /etc/php.ini

date.timezone = Asia/Seoul

 

 

* MariaDB 설치

 

# yum -y install mariadb-server mariadb

# systemctl enable mariadb 

# vi /etc/my.cnf

 

my.cnf 맞게 설정 

 

# Don't listen on a TCP/IP port at all. This can be a security enhancement,

# if all processes that need to connect to mysqld run on the same host.

# All interaction with mysqld must be made via Unix sockets or named pipes.

# Note that using this option without enabling named pipes on Windows

# (using the "enable-named-pipe" option) will render mysqld useless!

#

#skip-networking

server-id   = 1

 

# Uncomment the following if you want to log updates

#log-bin=mysql-bin

 

# binary logging format - mixed recommended

binlog_format=mixed

 

# Causes updates to non-transactional engines using statement format to be

# written directly to binary log. Before using this option make sure that

# there are no dependencies between transactional and non-transactional

# tables such as in the statement INSERT INTO t_myisam SELECT * FROM

# t_innodb; otherwise, slaves may diverge from the master.

#binlog_direct_non_transactional_updates=TRUE

 

# Uncomment the following if you are using InnoDB tables

innodb_data_home_dir = /var/lib/mysql

innodb_data_file_path = ibdata1:10M:autoextend

innodb_log_group_home_dir = /var/lib/mysql

# You can set .._buffer_pool_size up to 50 - 80 %

# of RAM but beware of setting memory usage too high

innodb_buffer_pool_size = 16M

innodb_additional_mem_pool_size = 2M

# Set .._log_file_size to 25 % of buffer pool size

innodb_log_file_size = 5M

innodb_log_buffer_size = 8M

innodb_flush_log_at_trx_commit = 1

innodb_lock_wait_timeout = 50

 

character-set-client-handshake = FALSE

character-set-server=utf8mb4

collation-server = utf8mb4_unicode_ci

 

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

# system start mariadb

# mysql_secure_installation

 

Enter current password for root (enter for none) : 이 부분은 현재 루트 비번이 없기 때문에 엔터

Set root password ? [Y/n] : n를 누르고 root 패스워드설정안함

Remove anonymous users? [Y/n] ; 익명 접근을 막을것이냐? 라고 묻습니다. 보안상 y 누르고 엔터

Disallow root login remotely? [Y/n] ; root 계정으로 원격 접속을 막을 것인가? 보안상 y 누르고 엔터

Remove test database and access to it? [Y/n] ; test 용으로 사용된 데이타 베이스를 삭제할것이냐? y 엔터

Reload privilege tables now? [Y/n] ; 지금까지 설정한 값을 적용할것이냐? y 엔터

 

vsftpd 설치

 

1. vsftpd 설치

# yum -y install vsftpd ftp

 

2. passive 모드설정

pasv_enable=Yes

pasv_min_port=60000

pasv_max_port=61000

 

3. iptable 수정

20, 21, 60000~61000 포트 등록

 

4. 접속계정 설정

ftp 접속 불가계정 등록

# vi /etc/vsftpd/user_list

 

5. 접속시 530, 500 오류 발생시

# setsebool -P ftp_home_dir 1

 

6. 사용자가 홈디렉토리만 접근가능하게

chroot_local_user=YES

chroot_list_enable=YES

allow_writeable_chroot=YES

chroot_list_file=/etc/vsftpd/chroot_list

 

chroot_list 파일에 모든 디렉토리 접근 가능한 사용자id 추가

 

systemctl enable vsftpd

systemctl start vsftpd

 

728x90