网上搜来的教程如下
复制代码 代码如下:
yum -y install gcc gcc-c++ automake autoconf libtool glibc make
libmcrypt安装
mkdir /usr/local/source && cd /usr/local/source #创建并进入源文件目录
[root@localhost source ]# wget " #下载libmcrypt
[root@localhost source ]# mv libmcrypt-2.5.7.tar.gz\?modtime\=1171868460\&\;big_mirror\=0 libmcrypt-2.5.7.tar.gz #重命名
tar – –zxvf libmcrypt-2.5.7.tar.gz #解压
cd libmcrypt-2.5.7 #进入解压目录
./configure --prefix=https://www.jb51.net/usr/local/libmcrypt && make && make install #安装
因为编译安装libmcrypt一直出错,运行rpm –q libmcrypt 查看安装的rpm包 发现失败
所以参考了另一篇安装lnmp的文章
复制代码 代码如下:
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers libXpm* #下载安装编译工具和依赖包
yum -y update #更新yum
下载安装包
mkdir /tmp/source
cd /tmp/source
wget #最新
wget 稳定版 因为php5.5不支持mysql扩展了,暂时不用最新的
wget #mysql5.6
wget
mv libmcrypt-2.5.8.tar.gz\?r\=http\:%2F%2Fsourceforge.net%2Fprojects%2Fmcrypt%2Ffiles%2FLibmcrypt%2F2.5.8%2F libmcrypt-2.5.8.tar.gz #删除多余参数的文件名
wget https://ftp.gnu.org/gnu/libiconv/libiconv-1.14.tar.gz
wget
mv mhash-0.9.9.9.tar.gz\?r\=http\:%2F%2Fsourceforge.net%2Fprojects%2Fmhash%2Ffiles%2Fmhash%2F0.9.9.9%2F mhash-0.9.9.9.tar.gz #删除多余参数的文件名
wget
mv mcrypt-2.6.8.tar.gz\?r\=http\:%2F%2Fsourceforge.net%2Fprojects%2Fmcrypt%2Ffiles%2FMCrypt%2F2.6.8%2F mcrypt-2.6.8.tar.gz #删除多余参数的文件名
wget
###暂没有下载 memcache pcre eaccelerator
安装libiconv、libmcrypt、(#没安装libltdl)、mhash、(#安装make没效果mcrypt),bison
复制代码 代码如下:
845 tar zxvf libmcrypt-2.5.8.tar.gz
846 cd libmcrypt-2.5.8
847 ./configure --prefix=https://www.jb51.net/usr/local/libmcrypt
848 make && make install
836 tar zxvf libiconv-1.14.tar.gz
837 cd libiconv-1.14
838 ./configure --prefix=https://www.jb51.net/usr/local
839 make && make install
850 tar zxvf mhash-0.9.9.9.tar.gz
851 cd mhash-0.9.9.9
854 ./configure --prefix=https://www.jb51.net/usr/mhash
855 make && make install
安装cmake
复制代码 代码如下:
cd /tmp/
tar zxvf cmake-2.8.3.tar.gz
cd cmake-2.8.3/
./configure --prefix=https://www.jb51.net/usr
gmake
gmake install
准备用户、目录
复制代码 代码如下:
groupadd mysql
useradd -g mysql mysql
groupadd www
useradd -g www www
mkdir -p /data/mysql
chown -R mysql:mysql /data/mysql
mkdir -p /data/www
chown -R www:www /data/www
安装mysql
编译:
复制代码 代码如下:
tar zxvf mysql-5.6.22.tar.gz
cd mysql-5.6.22
cmake -DCMAKE_INSTALL_PREFIX=https://www.jb51.net/usr/local/mysql -DMYSQL_DATADIR=https://www.jb51.net/data/mysql -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DSYSCONFDIR=https://www.jb51.net/usr/local/mysql/etc/ -DWITH_SSL=yes -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_READLINE=on
make && make install
ln -s /usr/local/mysql/lib/lib* /usr/lib/
配置:
复制代码 代码如下:
/usr/local/mysql/scripts/mysql_install_db --basedir=https://www.jb51.net/usr/local/mysql --datadir=https://www.jb51.net/data/mysql/ --user=mysql
自启动
复制代码 代码如下:
cp /opt/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on
/etc/rc.d/init.d/mysqld start
cd /opt/mysql/
bin/mysql_secure_installation #设置mysql账号密码
安装php
编译:
复制代码 代码如下: