标签:
源码安装Apache
1解决依赖关系
http需要apr和apr-util
(1) 编译安装apr
# tar -xvf apr-1.5.2.tar.gz
# cd apr-1.5.2
# ./configure --prefix=/usr/local/apr
# make && make install
(2) 编译安装apr-util
# tar -xvf apr-util-1.5.4.tar.gz
# cd apr-util-1.5.4
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
# make && make install
在安装http的时候也要解决pcre-devel包,光盘自带
yum install pcre-devel -y
$ ./configure --prefix=PREFIX
$ make
$ make install
$ PREFIX/bin/apachectl start
这里我们需要个apache添加一些功能
./configure --help 可以查看帮助
./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-modules=most --enable-mpms-shared=most --with-mpm=event
这个时候安装openssl-devel 和update openssl
yum install openssl -y
yum update openssl-devel -y
./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-mods-shared=most --enable-mpms-shared=all
make && make install
安装 Mysql
tar -xvf mysql-5.5.8.tar.gz
cmake下载地址:http://www.cmake.org/
# tar zxvf cmake-2.8.4.tar.gz
# cd cmake-2.8.4
#./configure
# make
# make install
ncurses下载地址:http://www.gnu.org/software/ncurses/
yum install ncurses-devel readline-devel
# tar zxvf ncurses-5.8.tar.gz
# cd ncurses-5.8
#./configure
# make
# make install
# mkdir -p /mydata/data
# groupadd -r mysql
# useradd -g mysql -r -s /sbin/nologin -M -d /mydata/data mysql
# chown mysql:mysql /mydata/data
# tar -xvf mysql-5.6.26.tar.gz
# cd mysql-5.6.26
# cmake ./ -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/mydata/data
# make && make install
将mysql的启动服务添加到系统服务中
# cp support-files/mysql.server /etc/init.d/mysql
cd /usr/local/mysql
chown -R mysq:mysql .
scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
shell> bin/mysqld_safe --user=mysql
现在可以使用下面的命令启动mysql
# service mysql start
停止mysql服务
# service mysql stop
重启mysql服务
# service mysql restart
当启动时候遇到错误
MySQL is not running, but lock file (/var/lock/subsys/mysql[FAILED]
-bash-4.1$ /etc/rc.d/init.d/mysql start
Starting MySQL.The server quit without updating PID file (/mydata/data/www.pdjun.com.pid)
解决方法
Remove Your MySQL Config File
If you have modified your MySQL configuration file, MySQL may not like it few versions after (MySQL is not backward compatibility friendly). It can be the problem of using an unsupported variable, or something similar. The easiest way is to remove your configuration file, and try to start the MySQL server again:
Backup your MySQL configuration first.
mv /etc/my.cnf /etc/my.cnf.backup
And restart the MySQL server again:
/usr/local/share/mysql/mysql.server start
Hopefully you will see the following message:
Starting MySQL. SUCCESS!
给mysql设置密码
用root 进入mysql后
mysql>set password =password(‘你的密码‘);
mysql>flush privileges;
安装php
phph需要光盘里面的组包"X Software Development" 和libmcrypt,libmcrypt-devel
yum -y groupinstall "X Software Development"
yum install libxml2 libxml2-devel bzip2-devel openssl-devel
tar -xvf php-5.6.12.tar.gz
cd php-5.6.12
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-sockets --with-apxs2=/usr/local/apache/bin/apxs --with-mcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2 --enable-maintainer-zts
make
make test
make install
为php提供配置文件:
# cp php.ini-production /etc/php.ini
3、 编辑apache配置文件httpd.conf,以apache支持php
# vim /etc/httpd/httpd.conf
1、添加如下二行
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
2、定位至DirectoryIndex index.html
修改为:
DirectoryIndex index.php index.html
而后重新启动httpd,或让其重新载入配置文件即可测试php是否已经可以正常使用。
安装xcache为php加速
tar -xvf xcache-3.2.0.tar.gz
cd xcache-3.2.0
# ./configure --enable-xcache --with-php-config=/usr/local/php/bin/php-config
# make && make install
安装结束时,会出现类似如下行:
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-zts-20131226/
2、编辑php.ini,整合php和xcache:
首先将xcache提供的样例配置导入php.ini
# mkdir /etc/php.d
# cp xcache.ini /etc/php.d
说明:xcache.ini文件在xcache的源码目录中
接下来编辑/etc/php.d/xcache.ini,找到extension开头的行,修改为如下行:
extension = /usr/local/php/lib/php/extensions/no-debug-zts-20100525/xcache.so
注意:如果php.ini文件中有多条zend_extension指令行,要确保此新增的行排在第一位。
lamp源码搭建
标签:
原文地址:http://www.cnblogs.com/pdjun/p/5808034.html