Rocky Linux 8 Apahce + MariaDB 소스설치

Rocky Linux 8 Apahce + MariaDB 소스설치

Redhat 8 -> CentOS 8 지원종료 (12월 31일) -> Rocky Linux 8

1. httpd 설치

mkdir /usr/local/src/APM_Setup

cd /usr/local/src/APM_Setup/

wget https://archive.apache.org/dist/httpd/httpd-2.4.51.tar.gz

wget https://archive.apache.org/dist/apr/apr-1.7.0.tar.gz

wget https://archive.apache.org/dist/apr/apr-util-1.6.1.tar.gz

wget http://ftp.exim.org/pub/pcre/pcre-8.45.tar.gz

tar zxvf httpd-2.4.51.tar.gz

tar zxvf apr-1.7.0.tar.gz

tar zxvf apr-util-1.6.1.tar.gz

tar zxvf pcre-8.45.tar.gz

cd /usr/local/src/APM_Setup/apr-1.7.0/

./configure --prefix=/usr/local/apr && make -j4 && make install

cd /usr/local/src/APM_Setup/apr-util-1.6.1/

./configure --with-apr=/usr/local/apr && make -j4 && make install

=============================================================================================

xml/apr_xml.c:35:10: fatal error: expat.h: No such file or directory

#include

^~~~~~~~~

compilation terminated.

make[1]: *** [/usr/local/src/APM_Setup/apr-util-1.6.1/build/rules.mk:206: xml/apr_xml.lo] Error 1

make[1]: Leaving directory '/usr/local/src/APM_Setup/apr-util-1.6.1'

make: *** [/usr/local/src/APM_Setup/apr-util-1.6.1/build/rules.mk:118: all-recursive] Error 1

=============================================================================================

yum -y install expat-devel

=============================================================================================

cd /usr/local/src/APM_Setup/pcre-8.45/

./configure --prefix=/usr/local/pcre && make -j4 && make install

cd /usr/local/src/APM_Setup/httpd-2.4.51/

sed -i "s/#define DEFAULT_SERVER_LIMIT 256/#define DEFAULT_SERVER_LIMIT 2048/g" ./server/mpm/prefork/prefork.c

sed -i "s/#define DEFAULT_SERVER_LIMIT 16/#define DEFAULT_SERVER_LIMIT 256/g" ./server/mpm/worker/worker.c

sed -i "s/#define DEFAULT_SERVER_LIMIT 16/#define DEFAULT_SERVER_LIMIT 256/g" ./server/mpm/event/event.c

./configure \

--prefix=/usr/local/apache \

--enable-so \

--enable-rewrite\

--enable-ssl \

--enable-expires \

--enable-mods-shared=all \

--enable-modules=shared \

--with-apr=/usr/local/apr \

--with-apr-util=/usr/local/apr \

--with-mpm=prefork \

--with-pcre=/usr/local/pcre \

--with-included-apr-util \

--with-mpms-shared=all

make -j4 && make install

cd /usr/local/src/APM_Setup/

wget https://kldp.net/modurl/release/2188-mod_url-apache2-1.25.tar.bz2

tar xvf 2188-mod_url-apache2-1.25.tar.bz2

cd /usr/local/src/APM_Setup/mod_url-apache2-1.25

/usr/local/apache/bin/apxs -iac mod_url.c

echo "" >> /usr/local/apache/conf/httpd.conf

echo "

CheckURL On

" >> /usr/local/apache/conf/httpd.conf

echo "" >> /usr/local/apache/conf/httpd.conf

# Apache 유저,그룹,기본설정

sed -i "s/`grep '^User ' /usr/local/apache/conf/httpd.conf`/User nobody/g" /usr/local/apache/conf/httpd.conf

sed -i "s/`grep '^Group ' /usr/local/apache/conf/httpd.conf`/Group nobody/g" /usr/local/apache/conf/httpd.conf

sed -i 's/#ServerName www.example.com:80/ServerName localhost:80/g' /usr/local/apache/conf/httpd.conf

# PHP 연동 설정

sed -i 's/DirectoryIndex index.html/DirectoryIndex index.html index.php index.jsp/g' /usr/local/apache/conf/httpd.conf

# ServerAdmin 설정

sed -i 's/ServerAdmin [email protected]/ServerAdmin root@localhost/g' /usr/local/apache/conf/httpd.conf

# Apahce 로그 설정

sed -i 's/ErrorLog "logs\/error_log"/ErrorLog "logs\/error.log"/g' /usr/local/apache/conf/httpd.conf

sed -i 's/CustomLog "logs\/access_log" common/CustomLog "logs\/access.log" common/g' /usr/local/apache/conf/httpd.conf

# Apache cgi 설정

sed -i 's/#AddHandler cgi-script .cgi/AddHandler cgi-script .cgi/g' /usr/local/apache/conf/httpd.conf

# Apache apache2-handler PHP 연동 설정

sed -i '/AddType application\/x-gzip .tgz/a\ #PHP Enable' /usr/local/apache/conf/httpd.conf

sed -i '/AddType application\/x-gzip .tgz/a\ #' /usr/local/apache/conf/httpd.conf

sed -i '/\ #PHP Enable/a \ AddType application/x-httpd-php-source .phps' /usr/local/apache/conf/httpd.conf

sed -i '/\ #PHP Enable/a \ AddType application/x-httpd-php .php .jsp .html' /usr/local/apache/conf/httpd.conf

# 홈소스 위치 디렉토리 허용 설정

echo "

AllowOverride All

Options Indexes FollowSymLinks

Require all granted

" >> /usr/local/apache/conf/httpd.conf

echo "" >> /usr/local/apache/conf/httpd.conf

# Apache 실행 파일 설정

\cp -arpf /usr/local/apache/bin/apachectl /etc/init.d/

chmod 700 /etc/init.d/apachectl

sed -i '/#!\/bin\/sh/a # chkconfig: 2345 90 90' /etc/init.d/apachectl

sed -i '/#!\/bin\/sh/a # description: init file for Apache server daemon.\ \\' /etc/init.d/apachectl

sed -i '/#!\/bin\/sh/a # processname: /usr/local/apache/bin/apachectl' /etc/init.d/apachectl

sed -i '/#!\/bin\/sh/a # config: /usr/local/apache/conf/httpd.conf' /etc/init.d/apachectl

sed -i '/#!\/bin\/sh/a # pidfile: /usr/local/apache/logs/httpd.pid' /etc/init.d/apachectl

=============================================================================================

# MySQL-5.0 시도

groupadd -g 400 mysql

useradd -u400 -g400 -d /usr/local/mysql -s /bin/false mysql

cd /usr/local/src/APM_Setup/

wget http://ftp.jaist.ac.jp/pub/mysql/Downloads/MySQL-5.0/mysql-5.0.96.tar.gz

tar zxvf mysql-5.0.96.tar.gz

cd /usr/local/src/APM_Setup/mysql-5.0.96/

./configure \

--prefix=/usr/local/mysql \

--localstatedir=/usr/local/mysql/data \

--with-mysqld-user=mysql \

--with-extra-charsets=all \

--with-plugins=max \

--enable-thread-safe-client \

--sysconfdir=/etc \

--with-mysqld-ldflags=-all-static \

--with-client-ldflags=-all-static \

--without-debug \

--enable-shared \

--enable-assembler \

--with-readline \

--with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock \

--with-plugins=innobase \

--with-charset=utf8 CXXFLAGS="-std=gnu++98"

=============================================================================================

configure: error: No curses/termcap library found

yum -y install libtermcap-devel ncurses-devel

yum install compat-*

=============================================================================================

\cp -arpf /usr/local/src/APM_Setup/mysql-5.0.96/support-files/my-huge.cnf /etc/my.cnf

\cp -arpf /usr/local/src/APM_Setup/mysql-5.0.96/support-files/mysql.server /etc/init.d/mysqld

sed -i 's/skip-locking/skip-external-locking/g' /etc/my.cnf

sed -i "/# basedir/a basedir = \/usr\/local\/mysql" /etc/my.cnf

sed -i "/# datadir/a datadir = /usr/local/mysql/data" /etc/my.cnf

sed -i "/# port /a port = 3306" /etc/my.cnf

sed -i '/# log_bin/a log-bin=mysql-bin' /etc/my.cnf

/usr/local/src/APM_Setup/mysql-5.0.96/scripts/mysql_install_db \

--user=mysql \

--datadir=/usr/local/mysql/data \

--basedir=/usr/local/mysql

mkdir -p /usr/local/mysql/tmp

mkdir -p /usr/local/mysql/logs

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

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

chmod 700 /etc/init.d/mysqld

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

rm -rf /etc/init.d/mysql

/etc/init.d/mysqld restart

=============================================================================================

# MySQL 4.1 시도

cd /usr/local/src/APM_Setup/

wget http://ftp.jaist.ac.jp/pub/mysql/Downloads/MySQL-4.1/mysql-4.1.22.tar.gz

tar zxvf mysql-4.1.22.tar.gz

cd /usr/local/src/APM_Setup/mysql-4.1.22/

./configure \

--prefix=/usr/local/mysql \

--with-mysqld-user=mysql \

--localstatedir=/usr/local/mysql/data \

--sysconfdir=/etc \

--without-debug \

--with-mysqld-ldflags=-all-static \

--with-client-ldflags=-all-static \

--enable-shared \

--enable-assembler \

--with-readline \

--enable-thread-safe-client \

--with-extra-charsets=all \

--with-innodb \

--with-pthread \

--with-named-thread-lib=-lpthread \

--with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock \

--with-charset=utf8 CXXFLAGS="-std=gnu++98"

make -j4 && make install

\cp -arpf /usr/local/src/APM_Setup/mysql-4.1.22/support-files/my-huge.cnf /etc/my.cnf

\cp -arpf /usr/local/src/APM_Setup/mysql-4.1.22/support-files/mysql.server /etc/init.d/mysqld

sed -i 's/skip-locking/skip-external-locking/g' /etc/my.cnf

sed -i "/# basedir/a basedir = \/usr\/local\/mysql" /etc/my.cnf

sed -i "/# datadir/a datadir = /usr/local/mysql/data" /etc/my.cnf

sed -i "/# port /a port = 3306" /etc/my.cnf

sed -i '/# log_bin/a log-bin=mysql-bin' /etc/my.cnf

/usr/local/src/APM_Setup/mysql-4.1.22/scripts/mysql_install_db \

--user=mysql \

--datadir=/usr/local/mysql/data \

--basedir=/usr/local/mysql

mkdir -p /usr/local/mysql/tmp

mkdir -p /usr/local/mysql/logs

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

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

chmod 700 /etc/init.d/mysqld

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

rm -rf /etc/init.d/mysql

/etc/init.d/mysqld restart

=============================================================================================

공유하기 글 요소 저작자표시

from http://93it-security-service.tistory.com/298 by ccl(A) rewrite - 2021-11-29 04:01:33