## MySQL 설치 전 필수 조건
cd /usr/local/src/
yum install -y wget vim epel-release
얌 설치 -y https://rpms.remirepo.net/enterprise/remi-release-7.rpm
얌 업데이트 -y
## CentOS 7의 기본 환경 변수 설정
에코 ” ” >> /etc/profile
echo “####default PATH#####” >> /etc/profile
echo “내보내기 경로=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:” >> /etc/profile
에코 “#####################” >> /etc/profile
## 소스 설치를 위한 패키지 환경 설치
yum 설치 -y libdb-devel enchant-devel libxslt libxslt-devel net-snmp-devel readline-devel readline aspell-devel unixODBC unixODBC-devel libicu-devel icu libicu libc-client libc-client-devel libc-client-2007f freetype- devel freetype* freetype libXpm libXpm-devel libpng-devel libpng* libvpx-devel libvpx libcurl libcurl-devel curl* curl-devel curl tcp_wrappers-devel libzip 환경 모듈 uw-imap-utils uw-imap-devel uw-imap uw-imap -정적 pam-devel libldb-devel openldap-devel cyrus-sasl-devel bzip2-devel bzip2 bzip2-libs ncurses-devel ncurses mysql-devel libjpeg-devel libjpeg* libjpeg-devel openssl-devel openssl* openssl-libs libxml* libxml2 libxml2 -devel libmcrypt libmcrypt-devel libmcrypt* mcrypt mhash* mhash mhash-devel libmhash libmhash-devel expat-devel expat expat* gmp* gmp gmp-devel krb5* krb5-devel db4 db4-devel wget make cmake libtool* pcre* gdbm* gdbm gdbm-devel libtiff* libtiff libtiff-devel 플렉스 zlib* zlib-devel zlib gd* gd gd-devel 패치 t1lib t1lib-devel readline l ibe dit-devel libtidy libtidy-devel gcc* gcc gcc-c++ libtermcap-devel dialog sqlite-devel oniguruma oniguruma-devel libzip5 mod_ssl postgresql-devel lcov systemtap-sdt-devel mod_ldap elfutils-devel libwebp-devel libwebp git gzip libnghttp2-devel valgrind * mod_proxy* editline editline-devel patchelf systemd-devel ImageMagick-devel libzstd-devel libffi libffi-devel libraqm-devel libraqm libsodium libsodium-devel
## CentOS 6 이하용 라이브러리 설정
mkdir /usr/kerberos
ln -s /usr/lib64 /usr/kerberos/lib
## PHP imap 관련 모듈 64비트 32비트 라이브러리 호환성 설정
ln -s /usr/lib64/libc-client.a /usr/lib/libc-client.a
/usr/include/db.h를 분리합니다.
ln -s /usr/include/libdb4/db.h /usr/include/db.h
ln -s /usr/include/sqlext.h /usr/local/include/sqlext.h
ln -s /usr/lib64/libgdbm_compat.so /usr/local/lib64/libdbm.so
## OpenLDAP 호환
\cp -arpf /usr/lib64/libldap* /usr/lib/
ln -sf /usr/lib64/libm.so /usr/lib/libm.so
ln -sf /usr/lib64/libssl.so /usr/lib/libssl.so
## libXpm 모듈 32비트 호환
ln -s /usr/lib64/libXpm.so /usr/lib/
ln -s /usr/lib64/libXpm.so.4 /usr/lib/
ln -s /usr/lib64/libXpm.so.4.11.0 /usr/lib/
## PHP 이미지 모듈 64비트 32비트 라이브러리 호환성 설정
ln -s /usr/lib64/libjpeg.so /usr/lib
ln -s /usr/lib64/libpng.so /usr/lib
## MySQL 계정 만들기
그룹 추가 -g 400 mysql
useradd -u400 -g400 -d /usr/local/mysql -s /bin/false mysql
## MySQL gcc 모드용 Subversion 설치
yum install -y 호환성-* –skip-broken
## gcc 4.4.7 모드의 하위 버전으로 전환
\mv -f /usr/bin/gcc /usr/bin/gcc48-백업
ln -s /usr/bin/gcc44 /usr/bin/gcc
\mv -f /usr/bin/g++ /usr/bin/g++48-백업
ln -s /usr/bin/g++44 /usr/bin/g++
echo “/* Linuxthreads */” >> /usr/include/pthread.h
## MySQL 다운로드 및 배포
mkdir /usr/local/src/APM_Setup
cd /usr/local/src/APM_Setup
wget https://dbstudy.info/mysqlarchives/4.0.30/mysql-4.0.30.tar.gz
tar zxvf mysql-4.0.30.tar.gz
cd mysql-4.0.30
wget https://github.com/ingktds/mysql-4.0.30/archive/refs/heads/master.zip
cd mysql-4.0.30-마스터/
tar zxvf mysql-4.0.30.tar.gz
mv mysql-4.0.30 /usr/local/src/APM_setup/
CD mysql-4.0.30
## MySQL 컴파일 설정 및 설치
./구성\
–prefix=/usr/local/mysql\
–with-mysqld-user=mysql \
–localstatedir=/usr/local/mysql/data \
–with-charset=euc_kr \
–sysconfdir=/etc \
–with-mysqld-ldflags=-all-static \
–with-client-ldflags=-all-static \
–디버그 없이 \
–enable-maintainer-mode \
–활성화-공유\
–어셈블러 활성화 \
–with-readline \
–with-gnu-ld \
–with-pic \
–with-libwrap \
–enable-thread-safe-client \
–with-extra-charsets=모두 \
–with-pthread \
–with-pstack\
–with-named-thread-lib=-lpthread \
–with-innodb\
–대형 테이블 포함\
–with-charset=euc_kr \
–with-unix-socket-path=/tmp/mysql.sock
make -j && make 설치
## MySQL 구성 파일 및 스크립트 생성
\mv -f /etc/my.cnf /etc/my.cnf_source_before
\cp -arpf ./support-files/my-innodb-heavy-4G.cnf /etc/my.cnf
\cp -arpf ./support-files/mysql.server /etc/init.d/mysqld
## DB 디렉토리 생성 및 권한 소유권 설정
chmod 711 /usr/local/mysql
chmod 751 /usr/local/mysql/bin
chmod 755 /usr/local/mysql/bin/mysql
chmod 750 /usr/local/mysql/bin/*
chmod 755 /usr/local/mysql/bin/mysqldump
chmod 700 /etc/init.d/mysqld
chown -R mysql.mysql /usr/local/mysql/data
chown -R mysql:mysql /usr/local/mysql
## DB 초기화
/usr/local/mysql/bin/mysql_install_db –user=mysql –basedir=/usr/local/mysql –datadir=/usr/local/mysql/data
## MySQL 비밀번호 설정
/etc/init.d/mysqld 재시작
/usr/local/mysql/bin/mysqladmin -u 루트 암호 “설정할 암호”
## MySQL 환경 변수 설정
다음 구성에는 Apache, MySQL 및 PHP 부분이 포함되어 있습니다.
에코 ” ” >> /etc/profile
echo “APACHE_HOME=/usr/local/apache” >> /etc/profile
echo “MySQL_HOME=/usr/local/mysql” >> /etc/profile
echo “PHP_HOME=/usr/local/php” >> /etc/profile
에코 ” ” >> /etc/profile
에코 “내보내기 경로=”\$”APACHE_HOME/bin:”\$”MySQL_HOME/bin:”\$”PHP_HOME/bin:”\$”PHP_HOME/sbin”\$”{경로:+:”\$”{ 경로}}” >> /etc/프로필
소스 /etc/profile
위 명령어가 아닌 DB만 운용하고 싶다면 다음과 같은 명령어를 입력하면 된다.
에코 ” ” >> /etc/profile
echo “MySQL_HOME=/usr/local/mysql” >> /etc/profile
echo “내보내기 PATH=”\$”MySQL_HOME/bin:”\$”{PATH:+:”\$”{PATH}}” >> /etc/profile
에코 ” ” >> /etc/profile
소스 /etc/profile