커뮤니티 정보

제목 CentOS 7 APM 컴파일 설치 정보 링크입니다.
첨부화일  apm_install_centos7_compile_2019.txt (17.4 KB)
등록자 관리자 등록일 2019.08.05 17:58:04 검색 2418

CentOS 7 APM 컴파일 설치 (php 5.3.x) 입니다.



https://server-talk.tistory.com/158

https://xinet.kr/?p=1494

http://www.withsystems.co.kr/board_eXuH77/258



 



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

방화벽

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



/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 accept

ed.</description>

  <service name="dhcpv6-client"/>

  <service name="http"/>

  <service name="ssh"/>

  <service name="https"/>

</zone>



firewall-cmd --reload



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

yum install -y wget perl patch pcre-devel lua-devel libxml2-devel ncurses-devel zlib zlib-devel curl openssl openssl-devel libtermcap-devel libc-client-devel bison gcc g++ cpp gcc-c++ freetype freetype-devel freetype-utils gd gd-devel libjpeg libjpeg-devel libpng libpng-devel curl curl-devel flex php-mbstring libexif-devel libmcrypt libmcrypt-devel



1. mysql

wget https://downloads.mysql.com/archives/get/file/mysql-5.5.61.tar.gz

 

2. apache

wget http://mirror.apache-kr.org/httpd/httpd-2.4.38.tar.gz

wget http://mirror.apache-kr.org/apr/apr-1.6.5.tar.gz

wget http://mirror.apache-kr.org/apr/apr-iconv-1.2.2.tar.gz

wget http://mirror.apache-kr.org/apr/apr-util-1.6.1.tar.gz

wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.43.tar.gz



3. php

wget https://mirrors.netix.net/sourceforge/m/ma/mapn/source/php/php-5.3.13.tar.gz



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

MySQL

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



1. 쿼리를 사용한 방법



update mysql.user set password = password('패스워드') where user ='아이디' and host = '%';

flush privileges;

 

update mysql.user set password = password('root') where user = 'root' and host='%';

flush privileges;

 

set password for '아이디'@'%' = password('패스워드');

 

set password for 'root'@'%' = password('root');



grant usage on *.* to '아이디'@'%' identified by '패스워드';

grant usage on *.* to 'root'@'%' identified by 'root';



2. 커맨드를 사용한 방법



mysqladmin -uroot -p password ekdnjs@ekdnjs



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



wget mirror.koreaidc.com/mariadb/mariadb-10.1.31.tar.gz

tar xvfz mariadb-10.1.31.tar.gz

cd mariadb-10.1.31



cmake \

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \

-DWITH_EXTRA_CHARSETS=all \

-DMYSQL_DATADIR=/free1/mysql_data \

-DENABLED_LOCAL_INFILE=1 \

-DDOWNLOAD_BOOST=1 \

-DWITH_BOOST=../boost_1_59_0 \

-DWITH_PARTITION_STORAGE_ENGINE=1 \

-DWITH_FEDERATED_STORAGE_ENGINE=1 \

-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \

-DWITH_MYISAM_STORAGE_ENGINE=1 \

-DENABLED_LOCAL_INFILE=1 \

-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \

-DSYSCONFDIR=/etc \

-DDEFAULT_CHARSET=utf8 \

-DDEFAULT_COLLATION=utf8_general_ci \

-DWITH_EXTRA_CHARSETS=all



make -j `grep processor /proc/cpuinfo' | wc -l`

make install



useradd -M mysql -u 27 >& /dev/null

chown -R root:mysql /usr/local/mysql

cd /usr/local/mysql

chmod 700 support-files/mysql.server

cp support-files/mysql.server /etc/rc.d/init.d/mysql

ln -s /etc/rc.d/init.d/mysql /etc/rc.d/rc3.d/S97mysql

cp support-files/mysql.server /usr/bin/



vi /etc/my.cnf



[client]

default-character-set = utf8

port = 3306

socket = /tmp/mysql.sock

default-character-set = utf8

#

[mysqld]

socket=/tmp/mysql.sock

datadir=/free/mysql_data

basedir = /usr/local/mysql

#user = mysql

#bind-address = 0.0.0.0

#

skip-external-locking

key_buffer_size = 384M

max_allowed_packet = 1M

table_open_cache = 512

sort_buffer_size = 2M

read_buffer_size = 2M

read_rnd_buffer_size = 8M

myisam_sort_buffer_size = 64M

thread_cache_size = 8

query_cache_size = 32M

#

#dns query

skip-name-resolve

#

#connection

max_connections = 1000

max_connect_errors = 1000

wait_timeout= 60

#

#slow-queries

#slow_query_log = /free/mysql_data/slow-queries.log

#long_query_time = 3

#log-slow-queries = /free/mysql_data/mysql-slow-queries.log

#

##timestamp

explicit_defaults_for_timestamp

symbolic-links=0

#

### log

log-error=/free/mysql_data/mysqld.log

pid-file=/tmp/mysqld.pid

#

###chracter

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

#

symbolic-links=0

#

##Password Policy

#validate_password_policy=LOW

#validate_password_policy=MEDIUM

#

### MyISAM Spectific options

default-storage-engine = myisam

key_buffer_size = 32M

bulk_insert_buffer_size = 64M

myisam_sort_buffer_size = 128M

myisam_max_sort_file_size = 10G

myisam_repair_threads = 1

#

### INNODB Spectific options

#default-storage-engine = InnoDB

#skip-innodb

#innodb_additional_mem_pool_size = 16M

#innodb_buffer_pool_size = 1024MB

#innodb_data_file_path = ibdata1:10M:autoextend

#innodb_write_io_threads = 8

#innodb_read_io_threads = 8

#innodb_thread_concurrency = 16

#innodb_flush_log_at_trx_commit = 1

#innodb_log_buffer_size = 8M

#innodb_log_file_size = 128M

#innodb_log_files_in_group = 3

#innodb_max_dirty_pages_pct = 90

#innodb_lock_wait_timeout = 120

#

[mysqldump]

default-character-set = utf8

max_allowed_packet = 16M

#

[mysql]

no-auto-rehash

default-character-set = utf8

#

[myisamchk]

key_buffer_size = 256M

sort_buffer_size = 256M

read_buffer = 2M

write_buffer = 2M





** InnoDB 설정 **



[client]

default-character-set = utf8

port = 3306

socket = /tmp/mysql.sock

default-character-set = utf8

#

[mysqld]

socket=/tmp/mysql.sock

datadir=/free/mysql_data

basedir = /usr/local/mysql

#user = mysql

#bind-address = 0.0.0.0

#

skip-external-locking

key_buffer_size = 384M

max_allowed_packet = 1M

table_open_cache = 512

sort_buffer_size = 2M

read_buffer_size = 2M

read_rnd_buffer_size = 8M

myisam_sort_buffer_size = 64M

thread_cache_size = 8

query_cache_size = 32M

#

#dns query

skip-name-resolve

#

#connection

max_connections = 1000

max_connect_errors = 1000

wait_timeout= 60

#

#slow-queries

#slow_query_log = /free/mysql_data/slow-queries.log

#long_query_time = 3

#log-slow-queries = /free/mysql_data/mysql-slow-queries.log

#

##timestamp

explicit_defaults_for_timestamp

symbolic-links=0

#

### log

log-error=/free/mysql_data/mysqld.log

pid-file=/tmp/mysqld.pid

#

###chracter

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

#

symbolic-links=0

#

##Password Policy

#validate_password_policy=LOW

#validate_password_policy=MEDIUM

#

### MyISAM Spectific options

#default-storage-engine = myisam

key_buffer_size = 32M

bulk_insert_buffer_size = 64M

myisam_sort_buffer_size = 128M

myisam_max_sort_file_size = 10G

myisam_repair_threads = 1

#

### INNODB Spectific options

default-storage-engine = InnoDB

skip-innodb

#innodb_additional_mem_pool_size = 16M

#innodb_buffer_pool_size = 1024MB

#innodb_data_file_path = ibdata1:10M:autoextend

#innodb_write_io_threads = 8

#innodb_read_io_threads = 8

#innodb_thread_concurrency = 16

#innodb_flush_log_at_trx_commit = 1

#innodb_log_buffer_size = 8M

#innodb_log_file_size = 128M

#innodb_log_files_in_group = 3

#innodb_max_dirty_pages_pct = 90

#innodb_lock_wait_timeout = 120

#

[mysqldump]

default-character-set = utf8

max_allowed_packet = 16M

#

[mysql]

no-auto-rehash

default-character-set = utf8

#

[myisamchk]

key_buffer_size = 256M

sort_buffer_size = 256M

read_buffer = 2M

write_buffer = 2M





[root@localhost mysql]# cd /usr/local/mysql

 

[root@localhost mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/free/mysql_data

 

[root@localhost mysql]# chown -R mysql /free/mysql_data/

 

[root@localhost mysql]# ll /free/mysql_data/

-rw-rw----. 1 mysql mysql 16384 3월 14 14:14 aria_log.00000001

-rw-rw----. 1 mysql mysql 52 3월 14 14:14 aria_log_control

-rw-rw----. 1 mysql mysql 2795 3월 14 14:14 ib_buffer_pool

-rw-rw----. 1 mysql mysql 50331648 3월 14 14:14 ib_logfile0

-rw-rw----. 1 mysql mysql 50331648 3월 14 14:14 ib_logfile1

-rw-rw----. 1 mysql mysql 12582912 3월 14 14:14 ibdata1

drwx------. 2 mysql root 4096 3월 14 14:14 mysql

drwx------. 2 mysql mysql 20 3월 14 14:14 performance_schema

drwx------. 2 mysql root 6 3월 14 14:14 test



[Mariadb (mysql ) 서비스 시작]



[root@localhost mysql]# mysql.server start





[서비스 시작 스크립트 생성]



vi /usr/lib/systemd/system/mariadb.service

 

[Unit]

Description=MySQL Server

After=network.target

 

[Service]

Type= forking

ExecStart = /etc/rc.d/init.d/mysql start

ExecStop = /etc/rc.d/init.d/mysql stop

 

[Install]

WantedBy=multi-user.target





[서비스 등록 및 start stop]



[root@localhost ~]# systemctl daemon-reload

[root@localhost ~]# systemctl enable mariadb.service

[root@localhost ~]# systemctl stop mariadb

[root@localhost ~]# systemctl start mariadb





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

Apache

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



Apache  install  ( worker 방식으로 설치 -> prefork 방식으로 설치하는 경우 HTTP/2 를 지원하지 않음 ) 먼저 nghttp2를 설치  진행



[root@localhost ~]# /usr/bin/yum -y install epel-release



[root@localhost ~]# yum -y install nghttp2 libnghttp2-devel



[root@localhost ~]# wget http://mirror.apache-kr.org/httpd/httpd-2.4.38.tar.gz

 

[root@localhost ~]# tar xvfz httpd-2.4.38.tar.gz

 

[root@localhost ~]# cd httpd-2.4.38

 

[root@localhost httpd-2.4.38]# perl -pi -e "s/LIMIT 16/LIMIT 128/g" server/mpm/worker/worker.c

 

[root@localhost httpd-2.4.38]# ./configure --prefix=/usr/local/apache --with-mpm=prefork \

--enable-cache --enable-mem-cache --enable-deflate --enable-expires --enable-ssl \

--enable-cgi --enable-vhost-alias --enable-rewrite --enable-so \

--enable-mods-shared=all --enable-module=shared --enable-mime-magic --enable-http2

 

[root@localhost httpd-2.4.38]# make -j `grep processor /proc/cpuinfo | wc -l`

 

[root@localhost httpd-2.4.38]# make install



---- 아파치 모듈설치  mod_url ----



[root@xinet ~]# wget http://jini.kldp.net/modurl/release/2186-mod_url-apache2-1.6.2.6.tar.bz2



[root@xinet ~]# tar xvfj 2186-mod_url-apache2-1.6.2.6.tar.bz2



[root@xinet ~]# cd mod_url-apache2



[root@xinet mod_url-apache2]# /usr/local/apache/bin/apxs -iac mod_url.c



---- apache 환경설정 구성 ----



vi /usr/local/apache/conf/httpd.conf



주석해제

LoadModule socache_shmcb_module modules/mod_socache_shmcb.so

LoadModule userdir_module modules/mod_userdir.so

LoadModule rewrite_module modules/mod_rewrite.so

LoadModule vhost_alias_module modules/mod_vhost_alias.so

LoadModule negotiation_module modules/mod_negotiation.so

LoadModule cgi_module modules/mod_cgi.so

 

<IfModule dir_module>

 DirectoryIndex index.html index.htm index.php

</IfModule>

<IfModule unixd_module>

User nobody

Group nobody

</IfModule>

 

DocumentRoot "/usr/local/apache/htdocs"

<Directory "/usr/local/apache/htdocs">

 Options Indexes FollowSymLinks

 AllowOverride None

 Require all granted

</Directory>

 

LogLevel warn http2:info

<IfModule log_config_module>

 LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %{GEOIP_COUNTRY_CODE}e" vcommon

 #CustomLog "logs/access_log" common

</IfModule>

 

<IfModule mime_module>

 TypesConfig conf/mime.types

 AddType application/x-gzip .tgz

 AddEncoding x-compress .Z

 AddEncoding x-gzip .gz .tgz

 AddType application/x-compress .Z

 AddType application/x-gzip .gz .tgz

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

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

 AddHandler cgi-script .cgi

 AddHandler type-map var

 AddType text/html .shtml

 AddOutputFilter INCLUDES .shtml

</IfModule>

 

##주석해제

Include conf/extra/httpd-mpm.conf

Include conf/extra/httpd-languages.conf

Include conf/extra/httpd-userdir.conf

Include conf/extra/httpd-default.conf

 

### http 2

<IfModule http2_module>

 ProtocolsHonorOrder On

 Protocols h2 http/1.1

 Protocols h2c http/1.1

</IfModule>

 

### mod_url

<IfModule mod_url.c>

CheckURL On

ServerEncoding EUC-KR

ClientEncoding UTF-8

</IfModule>



---- 기본 extra 폴더에 있는 내용들 수정 ----



[root@localhost httpd-2.4.29]# vi /usr/local/apache/conf/extra/httpd-languages.conf

 

##추가



AddLanguage ko .ko

 

 

[root@localhost httpd-2.4.29]# vi /usr/local/apache/conf/extra/httpd-default.conf

 

Timeout 60

KeepAlive On

MaxKeepAliveRequests 300

KeepAliveTimeout 2

UseCanonicalName Off

AccessFileName .htaccess

ServerTokens Prod

ServerSignature Off

HostnameLookups Off

<IfModule reqtimeout_module>

 RequestReadTimeout header=20-40,MinRate=500 body=20,MinRate=500

</IfModule>

 

 

[root@localhost httpd-2.4.29]# vi /usr/local/apache/conf/extra/httpd-userdir.conf

 

UserDir html

<Directory "/free/home/*/html">

 AllowOverride FileInfo AuthConfig Limit Options

 Require method GET POST

 Options MultiViews SymLinksIfOwnerMatch IncludesNoExec

</Directory>



---- 시작스크립트 작성 및  서비스 등록 ----



[root@localhost ~]# vi /usr/lib/systemd/system/httpd.service

 

[Unit]

Description=Apache HTTP Server

After=network.target

 

[Service]

Type= forking

ExecStart = /usr/local/apache/bin/apachectl start

ExecStop = /usr/local/apache/bin/apachectl stop

 

[Install]

WantedBy=multi-user.target

 

 

[root@localhost ~]# systemctl daemon-reload

 

[root@localhost ~]# systemctl enable httpd.service





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

PHP

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

1. 라이브러리 등록



# vi /etc/ld.so.conf



/lib



/lib64



/usr/lib



/usr/lib64



/usr/local/mysql/lib/mysql



/usr/local/apache/modules



이렇게 입력 해주고 저장한다.



# ldconfig



 



2. php 다운로드 및 압축해제



http://php.net/releases/



위 사이트에서 php 5.3.21 버전을 다운받고, 서버에 업로드 한다.



# tar xvfz php-5.3.21.tar.gz



 



3. 컴파일 진행



apache, mysql 설치에서도 언급했지만 필요없다고 생각되는 라이브러리는 삭제해도 된다.



이미 설치했다면 무시한다.



# yum -y install gcc gcc-c++ termcap libtermcap libtermcap-devel gdbm-devel zlib* libxml* freetype* libpng* libjpeg* curl-devel gd gd-devel libmcrypt libmcrypt-devel mhash mhash-devel apr apr-* libxml2 iconv unixODBC qpixman qpixman-devel dialog xorg-x11-devel



# cd php-5.3.21



압축 해제한 디렉토리로 이동한다.



# ./configure --prefix=/usr/local/php \

--with-config-file-path=/usr/local/apache/conf \

--with-apxs2=/usr/local/apache/bin/apxs \

--with-mysql=/usr/local/mysql \

--with-mysqli=/usr/local/mysql/bin/mysql_config \

--with-curl \

--disable-debug \

--enable-maintainer-zts \

--enable-safe-mode \

--enable-sockets \

--enable-sysvsem=yes \

--enable-sysvshm=yes \

--enable-ftp \

--enable-magic-quotes \

--enable-gd-native-ttf \

--enable-inline-optimization \

--enable-bcmath \

--with-zlib \

--with-gd \

--with-gettext \

--with-jpeg-dir=/usr \

--with-png-dir=/usr/lib \

--with-freetype-dir=/usr \

--with-libxml-dir=/usr \

--enable-exif \

--enable-sigchild \

--enable-mbstring \

--with-openssl



# make && make install

 



4. php 경로 설정



# ln -s /usr/local/php/bin/php /usr/bin/php



# vi /root/.bash_profile



PATH=$PATH:$HOME/bin:/usr/local/php/bin



추가한 뒤 적용해준다.



# source /root/.bash_profile



 



5. GendGuardLoader 설치



http://www.zend.com/en/products/guard/downloads



위 사이트에서 5.3버전을 다운받고, 서버에 업로드 한다. (Zend 사이트에 로그인이 필요하다.)



# tar xvfz ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz



# mkdir /usr/local/Zend



# cp -av ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/ZendGuardLoader.so /usr/local/Zend



php.ini 파일을 열어서 제일 하단에 아래 내용을 추가해준다.



[Zend]



zend_extension=/usr/local/Zend/ZendguardLoader.so



# php -v



PHP 5.3.21 (cli) (built: Jan 17 2018 17:43:51)

 Copyright (c) 1997-2013 The PHP Group

 Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies

 with Zend Guard Loader v3.3, Copyright (c) 1998-2010, by Zend Technologies



라고 나온다면 정상적으로 설치가 끝난 것이다.



php.ini 설정때문에 에러가 나는 경우도 있다.



이럴때는 아래 설정을 따라 해보면 정상이 될 수도 있으니 한번 해보길 바란다.



error_reporting = E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_WARNING ^ E_STRICT



date.timezone = "Asia/Seoul"



short_open_tag = On





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

vsFTP

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

chroot_local_user=YES

allow_writeable_chroot=YES

use_localtime=YES





firewall-cmd --permanent --add-service=ftp

firewall-cmd --permanent --add-port=21/tcp

firewall-cmd --reload



vi /etc/selinux/config



SELINUX=disable



systemctl enable vsftpd

systemctl restart vsftpd

ps -ax | grep vsftpd



 



 


... 자료없음 ...