linuxk-layouts
MariaDB Archives
Apache Source Code
3
4

A P M 설치와 설정

Setup web server on centos 7
1. Installing Mariadb

2. Installing Apache

3. Installing PHP

 

구축 환경: CentOS7-x64bit

 

웹 서버 디렉토리 구조

/apm /apps /data  
  /docs /xe  
  /plugin /phpmyadmin  
  /server /apache /apr  
  /apr-iconf  
  /apr-util  
  /httpd  
  /conf  
  /mariadb  
  /php


Mariadb Installing 

Step 1 >> 의존라이브러리 설치
[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
#sql_mode=NO_ENGINE_SUBSTITUTION
datadir = /var/lib/mysql
socket = /var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd

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

#
# include all files from the config directory
#
!includedir /apm/server/conf/my.cnf.d

Step 2 >> DB 관리자 및 그룹 생성

groupadd dba
useradd -M -c "MySQL" -d /var/mysql -g dba -s /bin/nologin mysql

Step 3 >> Mariadb 소스 다운로드 및 설치

cd /usr/src
wget http://mirror.rackspace.com/mariadb//mariadb-10.4.11/source/mariadb-10.4.11.tar.gz
tar zxvf mariadb-10.4.11.tar.gz
cd mariadb-10.4.11

cmake 를 이용한 configure 
cmake \
-DCMAKE_INSTALL_PREFIX=/apm/server/mariadb \
-DMYSQL_DATADIR=/apm/apps/data \
-DTMPDIR=/apm/server/mariadb/tmp \
-DMYSQL_UNIX_ADDR=/apm/server/mariadb/mysql.sock \
-DPID_FILE_DIR=/apm/server/mariadb/mariadb.pid \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_ARIA_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_BOOST=1 \
-DWITH_EXTRA_CHARSETS=all \
-DWITH_FEDERATEDX_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_JEMALLOC=0 \
-DWITH_LOCALES=0 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_QUERY_CACHE_INFO=0 \
-DWITH_QUERY_RESPONSE_TIME=0 \
-DWITH_READLINE=1 \
-DWITH_SAFEMALLOC=AUTO \
-DWITH_SSL=system \
-DWITH_XTRADB_STORAGE_ENGINE=1 \
-DWITH_ZLIB=system \
-DUSE_ARIA_FOR_TMP_TABLES=0
# 컴파일 
make

# 설치
make install

아래처럼 컴파일과 설치를 한번에 할수도 있다.
make; make install

mv /apm/server/mariadb /apm/server/mariadb-10.4.11
ln -s mariadb-10.4.11 /apm/server/mariadb

Step 2.4 DB 디렉토리 생성 및 소유권 변경
[root@host mariadb-10.4.11]# mkdir /apm/apps
[root@host mariadb-10.4.11]# mkdir /var/log/mariadb
[root@host mariadb-10.4.11]# mkdir /var/run/mariadb
[root@host mariadb-10.4.11]# chown mysql:dba /var/log/mariadb
[root@host mariadb-10.4.11]# chown mysql:dba /var/run/mariadb
[root@host mariadb-10.4.11]# cd /apm/server/mariadb

[root@host mariadb]# mkdir /apm/server/conf
[root@host mariadb]# mv /etc/my.cnf /apm/server/conf/
[root@host mariadb]# mv /etc/my.cnf.d /apm/server/conf/
[root@host mariadb]# vi /apm/server/conf/my.cnf

my.cnf 내용
[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
#sql_mode=NO_ENGINE_SUBSTITUTION
datadir=/apm/apps/data
port = 3306
socket = /apm/server/mariadb/mysql.sock
innodb_buffer_pool_size = 16M
innodb_additional_mem_pool_size = 2M
innodb_thread_concurrency = 16
innodb_flush_log_at_trx_commit = 1
innodb_log_buffer_size = 50M
innodb_log_file_size = 5M
innodb_lock_wait_timeout = 50

my.cnf 내용
[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
#sql_mode=NO_ENGINE_SUBSTITUTION
datadir = /var/lib/mysql
socket = /var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd

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

#
# include all files from the config directory
#
!includedir /apm/server/conf/my.cnf.d

Step 7 >> 기본 데이터베이스 생성 및 폴더 권한 변경

./scripts/mysql_install_db --user=mysql --datadir=/apm/apps/data  --defaults-file=/apm/server/conf/my.cnf




- Signature

안녕하세요 리눅스 커뮤니티 한국 리눅스 입니다.


profile
리한 (Feb 03, 2020 13:09:03)
cmake \
-DCMAKE_INSTALL_PREFIX=/apm/server/mariadb \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DDAEMON_NAME=mariadb \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_DATADIR=/apm/apps/data \
-DMYSQL_TCP_PORT=3306 \
-DMYSQL_UNIX_ADDR=/apm/server/mariadb/mysql.sock \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_ARIA_STORAGE_ENGINE=1 \
-DUSE_ARIA_FOR_TMP_TABLES=ON \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_BOOST=1 \
-DWITH_EXTRA_CHARSETS=all \
-DWITH_FEDERATEDX_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_QUERY_CACHE_INFO=ON \
-DWITH_QUERY_RESPONSE_TIME=ON \
-DWITH_READLINE=1 \
-DWITH_JEMALLOC=no \
-DWITH_SSL=system \
-DWITH_XTRADB_STORAGE_ENGINE=1 \
-DWITH_ZLIB=system
linux korea