一 Apache的安装
1 linux 依赖关系
http://hi.baidu.com/ziiip/item/0fb48bbe6d189049bb0e12ef
http://www.linuxidc.com/Linux/2010-07/27080.htm
2 安装Apache提示APR not found的解决办法
2.这里可以联网了。这里用到的我不写到一起了。
安装wget工具。
[root@localhost ~]# yum -y install wget
安装GCC软件套件
[root@localhost ~]# yum -y install gcc
[root@localhost ~]# yum -y install gcc-c++
安装make
[root@localhost ~]# yum -y install make
安装vim
[root@localhost ~]# yum -y install vim
tar xvf ./apr-1.4.6.tar tar xvf ./apr-util-1.5.1.tar tar xvf ./php-5.4.8.tar tar xvf ./httpd-2.4.3.tar cd ./apr-1.4.6 ./configure --prefix /opt/apr make && make install yum install gcc cd ../apr-util-1.5.1 ./configure --prefix=/opt/apr --with-apr=/opt/apr make && make install
pcre-8.20编译安装出错[pcrecpp.lo] Error 1
这个错误是缺少安装gcc-c++
yum -y install gcc-c++ cd ../pcre-8.31 ./configure --prefix=/opt/pcre --with-apr=/opt/apr/ --with-apr-util=/opt/apr/ make && make install cd ../httpd-2.4.2 ./configure --prefix=/opt/apache2.4 --with-apr=/opt/apr --with-apr-util=/opt/apr --with-pcre=/opt/pcre --enable-rewrite make && make install
打开 /opt/apache2.4/conf/http.conf,找到 #Include conf/extra/httpd-vhosts.conf,去掉前面的#,然后配置
/opt/apache2.4/conf/extra/httpd-vhosts.conf 的站点
修改
<Directory /> Options FollowSymLinks AllowOverride ALL Order deny,allow Allow from all </Directory>
You don’t have permission to access / on this server的解决方法
http://www.selmy.org/2010/05/23/forbidden-access-server/
编译httpd出错 cannot find libapr-1.la
mkdir /opt/apache2.4/lib
cp /opt/apr/lib/libapr-1.la /opt/apache2.4/lib
即可
参见 http://shenlan.blog.51cto.com/55742/458852
二、PHP安装
php 安装错误
1) configure: error: xml2-config not found. Please check your libxml2 installation
http://www.cnblogs.com/happyhotty/articles/2539864.html
cd ../php-5.4.8 yum install libxml2 yum install libxml2-devel -y yum install libjpeg libpng freetype libjpeg-devel libpng-devel freetype-devel -y yum install libmcrypt libmcrypt-devel ./configure --prefix=/opt/php5.4/ --with-apxs2=/opt/apache2.4/bin/apxs --with-mysql --enable-ftp --enable-mbstring --with-pdo-mysql --enable-pcntl --enable-soap --enable-sockets --enable-mysqlnd --enable-zip --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --enable-gd-native-ttf --enable-wddx --with-mcrypt make && make install
不能yum libmcrypt 的时候报的错误
如果linux报错 configure: error: no acceptable C compiler found in $PATH See `config.log’ for more details.
是由于没有安装gcc引起的,
rm: cannot remove `libtoolT': No such file or directory 解决方案
这时直接打开 configure,把 $RM “$cfgfile” 那行删除掉,重新再运行 ./configure 就可以了。
yum安装mcrypt错误:No package php-mcrypt available.解决方法
yum install epel-release //扩展包更新包
yum update //更新yum源
yum install libmcrypt libmcrypt-devel mcrypt mhash 就ok了
三、Mysql 安装
参考
Linux下源代码编译安装MySQL 5.5.14完整教程
http://www.linuxidc.com/Linux/2011-08/40369.htm
MySQL 5.5.28源码包编译安装
http://www.phpfuns.com/mysql/cmake-install-mysql.shtml
Linux下源代码编译安装MySQL 5.5.14完整教程
http://www.linuxidc.com/Linux/2011-08/40369p2.htm
CentOS 6.2下编译安装mysql-5.5.28
http://www.wangshangyou.com/mysql/103.html
错误
安装mysql出现Could NOT find Curses (missing CURSES_LIBRARY CURSES_INCLUDE_PATH),提示解决方法
[root@localhost software]# cd mysql-5.5.11 [root@localhost mysql-5.5.11]# cmake . -- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH) CMake Error at cmake/readline.cmake:82 (MESSAGE): Curses library not found. Please install appropriate package, remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel. Call Stack (most recent call first): cmake/readline.cmake:126 (FIND_CURSES) cmake/readline.cmake:216 (MYSQL_USE_BUNDLED_LIBEDIT) CMakeLists.txt:250 (MYSQL_CHECK_READLINE) -- Configuring incomplete, errors occurred! [root@localhost mysql-5.5.11]# rm CMakeCache.txt [root@localhost mysql-5.5.11]# yum install ncurses-devel Warning: Bison executable not found in PATH -- Configuring done -- Generating done -- Build files have been written to: /software/mysql-5.5.11 [root@localhost mysql-5.5.11]# yum install bison
错误 2 COLLATION 'utf8_general_ci' is not valid for CHARACTER SET 'latin1'
修改my.cnf后重新初始化
[client]
default-character-set = utf8
[mysqld]
character_set_server=utf8
cd ../ tar xvf ./cmake-2.8.7.tar tar xvf ./mysql-5.5.24.tar cd ./cmake-2.8.7 ./bootstrap make && make install groupadd mysql useradd -r -g mysql mysql cd ../mysql-5.5.24 cmake ./ -DCMAKE_INSTALL_PREFIX=/opt/mysql5.5 -DINSTALL_DATADIR=/website/data/mysql/data -DEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_MYISAM_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1 make && make install cp /opt/mysql5.5/support-files/mysql.server /etc/init.d/mysql cd /opt/mysql5.5/ ./scripts/mysql_install_db --user=mysql --datadir=/website/data/mysql/
fdisk -l
18 fdisk /dev/vdb
19 fdisk -l
20 mkfs -t ext3 /dev/vdb1
21 mount /dev/vdb1 /www
vi /etc/sysconfig/iptables
service iptables restart
LoadModule php5_module modules/libphp5.so
在<IfModule mime_module>里面
AddType application/x-httpd-php .php
===========================================
nginx+php5.6+mysql5.6
1、源码安装nginx:
配置好yum 后安装必备包:
yum install -y gcc gcc-c++ zlib zlib-devel pcre pcre-devel
cd nginx-1.10.1
./configure --prefix=/opt/nginx
make && make install
2、php
2.1
yum install libxml2 libxml2-devel libjpeg libpng freetype libjpeg-devel libpng-devel freetype-devel libcurl curl curl-devel -y
2.2
yum install libmcrypt libmcrypt-devel 没成功,我源码编译安装了
cd libmcrypt-2.5.8
./configure
make && make install
2.3
./configure --prefix=/opt/php5.6/ --with-config-file-path=/opt/php5.6/etc --with-mysql --enable-ftp --enable-mbstring --with-pdo-mysql --enable-pcntl --enable-soap --enable-sockets --enable-mysqlnd --enable-zip --with-gd --with-jp
eg-dir --with-png-dir --with-freetype-dir --enable-gd-native-ttf --enable-wddx --with-mcrypt --with-iconv --with-zlib --with-curl --enable-fpm --enable-mbstring
make && make install
2.4
cp php.ini-production /opt/php5.6/etc/php.ini
rm /etc/php.ini -rf
ln -s /opt/php5.6/etc/php.ini /etc/php.ini
cp /opt/php5.6/etc/php-fpm.conf.default /opt/php5.6/etc/php-fpm.conf
vi /opt/php5.6/etc/php-fpm.conf
cp sapi/fpm/init.d.php-fpm /etc/rc.d/php-fpm
chmod +x /etc/rc.d/init.d/php-fpm
cp sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm
rm /etc/rc.d/php-fpm -rf
chmod +x /etc/rc.d/init.d/php-fpm
chkconfig php-fpm on
groupadd www
useradd -s /sbin/nologin -g www www
3、mysql
3.1
cd cmake-3.6.1
./configure
./bootstrap
make && make install
3.2
groupadd mysql
useradd -r -g mysql mysql
3.3
yum install ncurses-devel bison bison-devel
3.4
cd mysql-5.6.32
cmake -DCMAKE_INSTALL_PREFIX=/opt/mysql5.6/ -DMYSQL_DATADIR=/www/data/mysql/data -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/tmp/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
make && make install
3.5
cd /opt/mysql5.6
scripts/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/opt/mysql5.6/ --datadir=/www/data/mysql --user=mysql
可以按提示执行
/opt/mysql5.6/bin/mysql_secure_installation 去掉一些不必要的数据相关,可不执行
3.6
设置mysql的root密码
其他
chkconfig --list
chkconfig php-fpm on
chkconfig --list|grep php-fpm
chkconfig --list|grep nginx
vi /etc/init.d/nginx 请查看线上此文件内容
chmod +x nginx
/etc/init.d/nginx start
ps -ef|grep nginx
chkconfig --add nginx
chkconfig nginx on
chkconfig --list|grep nginx
chkconfig --list |grep mysql
chkconfig --add mysql
chkconfig mysql on
查看工具
sar -n DEV 1 4
yum install -y iptraf
参考
http://www.cnblogs.com/xiongpq/p/3384681.html
可能用到的 mysql报Segmentation fault错误是怎么回事
https://segmentfault.com/q/1010000002788260
http://www.cnblogs.com/zdz8207/p/3765579.html
http://www.cnblogs.com/allenblogs/archive/2010/08/12/1798247.html
http://jingyan.baidu.com/article/414eccf61b23ca6b431f0ad8.html