티스토리 뷰


# 아파치 2.4.38 설치


yum -y install wget gcc* expat-devel && \ 
mkdir -p /usr/src/apache && \ 
cd /usr/src/apache && \ 
wget http://ftp.neowiz.com/apache/httpd/httpd-2.4.38.tar.gz && \ 
wget http://ftp.neowiz.com/apache/apr/apr-1.6.5.tar.gz && \ 
wget http://ftp.neowiz.com/apache/apr/apr-util-1.6.1.tar.gz && \ 
wget http://downloads.sourceforge.net/project/pcre/pcre/8.43/pcre-8.43.tar.gz && \ 
tar xvzf apr-1.6.5.tar.gz && \ 
tar xvzf apr-util-1.6.1.tar.gz && \ 
tar xvzf httpd-2.4.38.tar.gz && \ 
tar xvzf pcre-8.43.tar.gz && \ 
cd apr-1.6.3 && \ 
cp -arp libtool libtoolT && \ 
./configure --prefix=/usr/local/apr && \ 
make && make install && \ 
cd /usr/src/apache/apr-util-1.6.1 && \ 
./configure --with-apr=/usr/local/apr && \ 
make && make install && \ 
cd /usr/src/apache/pcre-8.41 && \ 
./configure && \ 
make && make install && \ 
cd /usr/src/apache/httpd-2.4.29 && \ 
./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr/bin --with-apr-util=/usr/local/apr/bin && \ 
make && make install 



# mariaDB 10.3.10 설치 
yum remove mariadb* mysql* && \ 
rm -rf /etc/my.cnf /etc/my.cnf.d && \ 
yum install -y gnutls-devel && \ 
cd /usr/src && \ 
wget https://cmake.org/files/v3.9/cmake-3.9.6.tar.gz && \ 
tar xvzf cmake-3.9.6.tar.gz && \ 
cd cmake-3.9.6/ && \ 
./bootstrap && \ 
make && make install && \ 
yum -y install gcc gcc-c++ libtermcap-devel gdbm-devel zlib* libxml* freetype* libpng* libjpeg* iconv flex gmp cmake ncurses-devel && \ 
mkdir /usr/src/mariadb && \ 
cd /usr/src/mariadb/ && \ 
wget http://ftp.hosteurope.de/mirror/archive.mariadb.org//mariadb-10.3.10/source/mariadb-10.3.10.tar.gz && \ 
tar xvzf mariadb-10.3.10.tar.gz && \ 
cd /usr/src/mariadb/mariadb-10.3.10/ && \ 
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DWITH_EXTRA_CHARSETS=all -DMYSQL_DATADIR=/usr/local/mysql/data -DENABLED_LOCAL_INFILE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -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 && make install && \ 
groupmod -g 400 mysql && \ 
usermod -u 400 -g 400 -d /usr/local/mysql -s /bin/false mysql && \ 
chown -R mysql.mysql /usr/local/mysql && \ 
chmod 711 /usr/local/mysql && \ 
chmod 700 /usr/local/mysql/data && \ 
chmod 751 /usr/local/mysql/bin && \ 
chmod 750 /usr/local/mysql/bin/* && \ 
chmod 755 /usr/local/mysql/bin/mysql && \ 
chmod 755 /usr/local/mysql/bin/mysqldump && \ 
chmod 700 /usr/local/mysql/support-files/mysql.server && \ 
cp -arp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld 


my.cnf 파일 수동 생성 - 
chmod 600 /etc/my.cnf 
/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data 
/etc/init.d/mysqld start 
[root@gukii_cent7 ~]# /usr/local/mysql/bin/mysql_secure_installation  

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB 
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY! 

In order to log into MariaDB to secure it, we'll need the current 
password for the root user.  If you've just installed MariaDB, and 
you haven't set the root password yet, the password will be blank, 
so you should just press enter here. 

Enter current password for root (enter for none):  
OK, successfully used password, moving on... 

Setting the root password ensures that nobody can log into the MariaDB 
root user without the proper authorisation. 

You already have a root password set, so you can safely answer 'n'. 

Change the root password? [Y/n] y 
New password:  
Re-enter new password:  
Password updated successfully! 
Reloading privilege tables.. 
 ... Success! 


By default, a MariaDB installation has an anonymous user, allowing anyone 
to log into MariaDB without having to have a user account created for 
them.  This is intended only for testing, and to make the installation 
go a bit smoother.  You should remove them before moving into a 
production environment. 

Remove anonymous users? [Y/n] y 
 ... Success! 

Normally, root should only be allowed to connect from 'localhost'.  This 
ensures that someone cannot guess at the root password from the network. 

Disallow root login remotely? [Y/n] y 
 ... Success! 

By default, MariaDB comes with a database named 'test' that anyone can 
access.  This is also intended only for testing, and should be removed 
before moving into a production environment. 

Remove test database and access to it? [Y/n] y 
 - Dropping test database... 
 ... Success! 
 - Removing privileges on test database... 
 ... Success! 

Reloading the privilege tables will ensure that all changes made so far 
will take effect immediately. 

Reload privilege tables now? [Y/n] y 
 ... Success! 

Cleaning up... 

All done!  If you've completed all of the above steps, your MariaDB 
installation should now be secure. 

Thanks for using MariaDB! 



# php 7.3.7 설치 
yum -y install libxml2-devel libpng-devel libjpeg-devel && \ 
mkdir -p /usr/src/php && \ 
cd /usr/src/php/ && \ 
wget https://www.php.net/distributions/php-7.3.7.tar.gz && \ 
tar xvzf php-7.3.7.tar.gz  && \ 
cd php-7.3.7/ && \ 
./configure --prefix=/usr/local/php --with-mysqli --with-openssl --with-pdo-mysql=mysqlnd --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/apache/conf --with-zlib --disable-debug --enable-calendar --enable-ftp --enable-sockets --enable-sysvsem --with-gd --with-jpeg-dir=/usr/lib64 && \ 
make && make install && \ 
cp php.ini-development /usr/local/apache/conf/php.ini && \ 


<수동>vi /usr/local/apache/conf/php.ini  
... 
mysqli.default_socket = /tmp/mysql.sock 


<수동>vi /usr/local/apache/conf/httpd.conf 

    DirectoryIndex index.html ++index.php ++index.jsp 

... 
    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 
... 

<수동>vi /usr/local/apache/htdocs/index.html 


It works!

++





< 수동 > 
vi /usr/local/apache/conf/httpd.conf  
Listen 81 
ServerName 192.168.30.145 
User nobody 
Group nobody 

/usr/local/apache/bin/apachectl start 
---------------------------------------------------------------------- 
vi /etc/my.cnf  
# Example mysql config file for very large systems. 

# This is for large system with memory of 1G-2G where the system runs mainly 
# MySQL. 

# You can copy this file to 
# /etc/my.cnf to set global options, 
# mysql-data-dir/my.cnf to set server-specific options (in this 
# installation this directory is /var/lib/mysql) or 
# ~/.my.cnf to set user-specific options. 

# One can in this file use all long options that the program supports. 
# If you want to know which options a program support, run the program 
# with --help option. 

# The following options will be passed to all MySQL clients 
[client] 
#password       = your_password 
port            = 3306 
socket          = /tmp/mysql.sock 
default-character-set = utf8 

# Here follows entries for some specific programs 

# The MySQL server 
[mysqld] 
port            = 3306 
socket          = /tmp/mysql.sock 
datadir         = /usr/local/mysql/data 
basedir         = /usr/local/mysql/ 
skip-external-locking 
key_buffer_size = 384M 
max_allowed_packet=256M 
table_open_cache=512 
sort_buffer_size=2M 
thread_cache_size=8 
# Try number of CPU's*2 for thread_concurrency 
thread_concurrency=8 
myisam_sort_buffer_size=64M 
server-id       = 1 
max_connections = 100 
max_connect_errors = 100 
wait_timeout= 60 
skip-name-resolve 
log-error=/usr/local/mysql/log/mysqld.log 
pid-file=/usr/local/mysql/mysqld.pid 
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 

# Point the following paths to different dedicated disks 
#tmpdir         = /tmp/ 
#log-update     = /path-to-dedicated-directory/hostname 

# Uncomment the following if you are using BDB tables 
#set-variable   = bdb_cache_size=384M 
#set-variable   = bdb_max_lock=100000 

# Uncomment the following if you are using Innobase tables 
#innodb_data_file_path = ibdata1:2000M;ibdata2:2000M 
#innodb_data_home_dir = /var/lib/mysql/ 
#innodb_log_group_home_dir = /var/lib/mysql/ 
#innodb_log_arch_dir = /var/lib/mysql/ 
#set-variable = innodb_mirrored_log_groups=1 
#set-variable = innodb_log_files_in_group=3 
#set-variable = innodb_log_file_size=5M 
#set-variable = innodb_log_buffer_size=8M 
#innodb_flush_log_at_trx_commit=1 
#innodb_log_archive=0 
#set-variable = innodb_buffer_pool_size=16M 
#set-variable = innodb_additional_mem_pool_size=2M 
#set-variable = innodb_file_io_threads=4 
#set-variable = innodb_lock_wait_timeout=50 

[mysqldump] 
quick 
default-character-set = utf8 
max_allowed_packet=16M 

[mysql] 
no-auto-rehash 
default-character-set = utf8 
# Remove the next comment character if you are not familiar with SQL 
#safe-updates 

[myisamchk] 
key_buffer_size=256M 
sort_buffer_size=256M 
read_buffer=2M 
write_buffer=2M 

[mysqlhotcopy] 
interactive-timeout 
---------------------------------------------------------------------- 
/etc/init.d/mysqld start 
[root@gukii_cent7 ~]# /usr/local/mysql/bin/mysql_secure_installation  

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB 
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY! 

In order to log into MariaDB to secure it, we'll need the current 
password for the root user.  If you've just installed MariaDB, and 
you haven't set the root password yet, the password will be blank, 
so you should just press enter here. 

Enter current password for root (enter for none):  
OK, successfully used password, moving on... 

Setting the root password ensures that nobody can log into the MariaDB 
root user without the proper authorisation. 

You already have a root password set, so you can safely answer 'n'. 

Change the root password? [Y/n] y 
New password:  
Re-enter new password:  
Password updated successfully! 
Reloading privilege tables.. 
 ... Success! 


By default, a MariaDB installation has an anonymous user, allowing anyone 
to log into MariaDB without having to have a user account created for 
them.  This is intended only for testing, and to make the installation 
go a bit smoother.  You should remove them before moving into a 
production environment. 

Remove anonymous users? [Y/n] y 
 ... Success! 

Normally, root should only be allowed to connect from 'localhost'.  This 
ensures that someone cannot guess at the root password from the network. 

Disallow root login remotely? [Y/n] y 
 ... Success! 

By default, MariaDB comes with a database named 'test' that anyone can 
access.  This is also intended only for testing, and should be removed 
before moving into a production environment. 

Remove test database and access to it? [Y/n] y 
 - Dropping test database... 
 ... Success! 
 - Removing privileges on test database... 
 ... Success! 

Reloading the privilege tables will ensure that all changes made so far 
will take effect immediately. 

Reload privilege tables now? [Y/n] y 
 ... Success! 

Cleaning up... 

All done!  If you've completed all of the above steps, your MariaDB 
installation should now be secure. 

Thanks for using MariaDB! 
---------------------------------------------------------------------- 
vi /usr/local/apache/conf/php.ini  
... 
mysqli.default_socket = /tmp/mysql.sock 

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

    DirectoryIndex index.html ++index.php ++index.jsp 

... 
    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 
... 

vi /usr/local/apache/htdocs/index.html 


It works!

++



---------------------------------------------------------------------- 
* VirtualHost 설정 
# Virtual hosts 설정하기 위하여 아래내용 주석 해제 
vi /usr/local/apache/conf/httpd.conf 
--#Include conf/extra/httpd-vhosts.conf 
++Include conf/extra/httpd-vhosts.conf 

vi /usr/local/apache/conf/extra/httpd-vhosts.conf 

    ServerName gukii.example.com 
    ServerAdmin gukii@dummy-host2.example.com 
    DocumentRoot /home/gukii/www 
    ErrorLog "logs/gukii.example.com-error_log
    CustomLog "logs/gukii.example.com-access_log" common 

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

'OS > CentOS 7.X' 카테고리의 다른 글

[CentOS 7.X] hostname 바로 적용하기  (0) 2019.10.05
댓글