Install Mysql(5.7)
- 准备工作
yum remove -y mysql mysql-devel mysql-server ncurses-devel
useradd -u 8003 -M -s /sbin/nologin mysql
yum install -y cmake
- 编译
tar -xzf mysql-boost-5.7.13.tar.gz -C /usr/local/src/
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DDOWNLOAD_BOOST=1 \
-DDOWNLOAD_BOOST_TIMEOUT=2000 \
-DWITH_BOOST=../boost \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DMYSQL_USER=mysql
make -j 4; make install
chown -R mysql:mysql /usr/local/mysql
cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
# vim /etc/init.d/mysqld
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
chkconfig mysqld on
/usr/local/mysql/scripts/mysql_install_db --default-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql
ln -s /usr/local/mysql/bin/* /usr/bin/
service mysqld restart
mysql_secure_installation
Install php(5.6.13)
- 准备工作
yum install -y gcc net-snmp-devel libcurl-devel libssh2-devel OpenIPMI-devel libvpx-devel libjpeg-devel libpng-devel libXpm-devel freetype-devel libmcrypt-devel
- 编译
./configure --prefix=/usr/local/php -with-config-file-path=/usr/local/php --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-mcrypt --with-gettext
# error about openssl libraries
find / -name libssl.so
/usr/lib/x86_64-linux-gnu/libssl.so
初步判断它可能只会在 /usr/lib/ 下寻找 libssl.so 文件,于是:
ln -s /usr/lib/x86_64-linux-gnu/libssl.so /usr/lib
make; make install
cp /usr/local/src/php-5.6.13/php.ini-production /usr/local/php/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp /usr/local/src/php-5.6.13/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm; cd
chkconfig php-fpm on
echo "<?php phpinfo(); ?>" > /usr/local/nginx/html/index.php
– 必须启用–with-gettext,否则编译zabbix会提示php gettext no fail