一、首先安装MysqL
yum install -y gcc gcc-c++ make autoconf wget ncurses-devel libmcrypt-devel libxml2-devel openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel openldap-devel libtool-ltdl-devel libevent-devel gd-devel bzip2-devel pcre-devel bison-devel bison libaio-devel cmake readline-devel
tar zxvf percona-server-percona-server-5.6.32-78.0.tar.gz
cd percona-server-percona-server-5.6.32-78.0
3、添加MysqL用户
groupadd MysqL
useradd -r -g MysqL MysqL
更改所有权 sudo chown MysqL:MysqL /myweb/MysqL/
sudo cmake . -DCMAKE_INSTALL_PREFIX=/myweb/MysqL/ -DWITH_INNOBASE_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_DEBUG=0 -DBUILD_CONFIG=MysqL_release -DENABLE_DTRACE=0 -DFEATURE_SET=community -DWITH_EMBEDDED_SERVER=OFF
make && make install
cp support-files/my-default.cnf /etc/my.cnf
sudo cp support-files/MysqL.server /etc/init.d/MysqL
要给/etc/init.d/MysqL一个可执行的权限
sudo chmod +x /etc/init.d/MysqL
修改一下这个文件
sudo nano /etc/init.d/
MysqLbasedir=/myweb/MysqL/
10、
THREAD_CONCURRENCY=4不推荐使用了
my.cnf MysqLd字段x下放入explicit_defaults_for_timestamp
sudo scripts/MysqL_install_db –user=MysqL –basedir=/myweb/MysqL –datadir=/myweb/MysqL/data
chkconfig MysqL on
11、service MysqL start
可能权限会导致出现一个错误 the server quit without updating pid file 此时 执行下
sudo chmod 777 -R /myweb/MysqL/
chmod 777 -R /myweb/tmp
chmod 777 -R /myweb/MysqL
13.1 设置远程连接 (根据需要设置)
修改数据库root用户的密码 sudo /myweb/MysqL/bin/MysqLadmin -u root password ‘root’
./MysqLadmin -h127.0.0.1 -uroot password ‘密码’
sudo MysqL -uroot -p 输入设置的密码
sudo ln -s /myweb/MysqL/bin/MysqL /usr/bin/MysqL
进入 执行
grant all privileges on . to root@”%” identified by “password” with grant option;
grant all privileges on . to guest@”127.0.0.1” identified by “123456” with grant option;
flush privileges;
二、安装apache2.4.23
http://apr.apache.org/download.cgi 先下载 apr-1.5.2.tar.gz apr-util-1.5.4.tar.gz
进行安装
sudo tar zxvf apr-1.5.2.tar.gz
cd apr-1.5.2
sudo ./configure
sudo make
sudo make install
sudo tar -zxvf apr-util-1.5.4.tar.gz
cd apr-util-1.5.4
./configure –prefix=/usr/local/apr-util –with-apr=/usr/local/apr
sudo make
sudo make install
sudo tar zxvf pcre-8.37.tar.gz
cd pcre-8.37
sudo ./configure –prefix=/usr/local/pcre
sudo make
sudo make install
tar zxvf httpd-2.4.23.tar.gz
cd httpd-2.4.23
sudo ./configure –prefix=/myweb/apache –enable-so –enable-mods-shared=most –with-mpm=worker –with-apr=/usr/local/apr/ –with-apr-util=/usr/local/apr-util/ –with-pcre=/usr/local/pcre
sudo make
sudo make install
sudo ln -s /myweb/apache/bin/apachectl /usr/bin/apachectl
rpm -qa |grep apr
/etc/rc.d/rc.local
加入启动脚本即可
/myweb/apache/bin/apachectl start
ln -s /myweb/apache/bin/apachectl /etc/init.d/apache
即可以服务启动 service apache restart
/etc/rc.d/rc2.d 2 代表运行级别
修改/etc/init.d/apache 中内容
chkconfig –add apache
三、安装PHP5.6.23
sudo tar zxvf libiconv-1.14.tar.gz
cd libiconv-1.14/
./configure –prefix=/usr/local
make
make install
1、安装libmcrypt
tar zxvf libmcrypt-2.5.8.tar.gz #解压
cd libmcrypt-2.5.8 #进入安装目录
./configure #配置
make #编译
make install #安装
2、安装mhash
tar zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9
./configure
make
make install
3、安装mcrypt
cd /usr/local/src
tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8
ln -s /usr/local/bin/libmcrypt_config /usr/bin/libmcrypt_config #添加软连接
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH #添加环境变量
./configure
make
make install
sudo tar zxvf PHP-5.6.23.tar.gz
cd PHP-5.6.23
./configure –prefix=/myweb/PHP –with-config-file-path=/myweb/PHP/etc –with-MysqL=MysqLnd –with-MysqL-sock=/myweb/MysqL/MysqL.sock –with-MysqLi=MysqLnd –with-iconv-dir=/usr/local –with-freetype-dir –with-jpeg-dir –with-png-dir –with-zlib –with-libxml-dir=/usr –enable-xml –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 –enable-ftp –with-pear –enable-exif –with-mcrypt –with-pdo-MysqL=MysqLnd –with-apxs2=/myweb/apache/bin/apxs –with-mcrypt
在安装一个软件包时,最后输入sudo make install命令后,出现以下错误信息:
error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory
但是在/usr/local/lib下却能找到libiconv.so.2,解决方法是将/usr/local/lib路径添加到/etc/ld.so.conf文件中,然后用sudo ldconfig命令加载,再重新输入sudo make install命令就可以了。
include ld.so.conf.d/*.conf
/usr/local/lib
sudo make ZEND_EXTRA_LIBS=’-liconv’
19、sudo make install安装
20、复制PHP.ini进/myweb/PHP/etc/下
cp PHP.ini-production /myweb/PHP/etc/PHP.ini
设置/myweb/apache/conf/httpd.conf 找到libph5.so的设置位置 修改
LoadModule modules/libPHP5.so。
AddType application/x-httpd-PHP .PHP
AddType application/x-httpd-PHP-source .PHPs
21、设置documentroot设置为/myweb/webroot
23、重启apache sudo apachectl restart
sudo ln -s /myweb/PHP/bin/PHPize /usr/bin/PHPize
sudo ln -s /myweb/apache/bin/apachectl /usr/bin/apachectl
sudo tar zxvf apcu-4.0.7.tgz
cd apcu-4.0.7
sudo PHPize
sudo ./configure –with-PHP-config=/myweb/PHP/bin/PHP-config
sudo make
sudo make install
sudo ln -s /myweb/PHP/lib/PHP/extensions/no-debug-zts-20131226/* /myweb/PHP/ext/
extension_dir = “/myweb/PHP/lib/PHP/extensions/no-debug-zts-20131226/”
zend_extension=opcache.so
并开启opcache的相关选项 开启enable 及 cli
sudo PHPize ./configure –with-PHP-config=/myweb/PHP/bin/PHP-config make && make install 修改PHP.ini extension_dir = “./myweb/PHP/lib/PHP/extensions/no-debug-zts-20131226/” date.timezone = PRC [zendopcache] zend_extension=opcache.so [apcu] extension=apcu.so