1.安装包准备:
#cp bao/* /usr/local/scr/lamp
2.安装Apache httpd-2.4.3.tar.gz
->安装依赖包:apr-1.4.6.tar.bz2
# tar jxf apr-1.4.6.tar.bz2
#cd apr-1.4.6
#yum install gcc* -y 需要安装gcc编译环境
#./configure --prefix=/usr/local/apr
#make && make isntall
#tar jxf apr-util-util-1.5.1
#cd apr-util-1.5.1
#./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
#make && make install
->安装httpd-2.4.3.tar.gz
#yum install zlib-devel openssl-devel pcre-devel -y 安装环境
# tar zxf httpd-2.4.3.tar.gz
#cd httpd-2.4.3
# ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --enable-module=so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --enable-cache --enable-file-cache --enable-men-cache --enable-disk-cache --enable-static-support --enable-static-ab --disable-userdir --with-mpm=prefork --enable-nonportable-atomics --disable-ipv6 --with-senfile
#make && make install
#/usr/local/apache2/bin/apachectl -k start开启服务
cd /usr/local/apache2/bin/ -> ./apachectl start 开启Apache服务
cd /usr/local/apache2/bin/ -> ./apachectl stop 关闭Apache服务
#ps -ef | grep httpd 查看Apache服务的状态
#ps -aux | grep apache
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ
root 17844 0.0 0.4 4576 2212 ? Ss 11:07 0:00 /usr/local/apache2/bin/httpd -k start
daemon 17852 0.0 0.3 4576 1716 ? S 11:07 0:00 /usr/local/apache2/bin/httpd -k start
daemon 17853 0.0 0.3 4576 1716 ? S 11:07 0:00 /usr/local/apache2/bin/httpd -k start
daemon 17854 0.0 0.3 4576 1716 ? S 11:07 0:00 /usr/local/apache2/bin/httpd -k start
daemon 17855 0.0 0.3 4576 1716 ? S 11:07 0:00 /usr/local/apache2/bin/httpd -k start
daemon 17856 0.0 0.3 4576 1716 ? S 11:07 0:00 /usr/local/apache2/bin/httpd -k start
#killall httpd 关闭http功能
3.MySql源码安装:
#rpm -ivh cmake-2.6.4-7.el5.i386.rpm 安装cmake编译包
# groupadd mysql 创建用户组
# useradd -g mysql mysql 创建用户
#yum remove mysql-server mysql mysql-devel -y 删除系统自带的mysql功能
# mkdir -pv /usr/local/mysql/data 创建用户数据目录
mkdir: 已创建目录 “/usr/local/mysql”
mkdir: 已创建目录 “/usr/local/mysql/data”
# yum install ncurses-devel -y 编译安装时会报错,提示安装这个环境包
# tar zxf mysql-5.5.29.tar.gz
# cd mysql-5.5.29
#cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/usr/local/mysql/data/ -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DENABLE_LOCAL_INFILE=1 \
-DEXTAR_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DMYSQL_USER=mysql \
-DWITH_DEBUG=0 \
-DWITH_EMBEDED_SERVER=0
(cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \-DMYSQL_DATADIR=/usr/local/mysql/data/ -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DWITH_INNOBASE_STORAGE_ENGINE=1 -DENABLE_LOCAL_INFILE=1 -DEXTAR_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_USER=mysql -DWITH_DEBUG=0 -DWITH_EMBEDED_SERVER=0)
#make && make install
#cp support-files/my-innodb-heavy-4G.cnf /etc/my.cnf
# vim /etc/my.cnf
[mysqld]
port = 3306
socket = /usr/local/mysql/mysql.sock
skip-name-resolve = 1
将mysql的服务启动项加到/init.d
#cp support-files/mysql.server /etc/init.d/mysqlsource
#chmod 755 /etc/init.d/mysqlsource 修改具有执行权限
更改文件目录的所有者和属组
#chown -R mysql.mysql /usr/local/mysql/
初始化数据库
# sh scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/
将所需的数据、模块链接
#ln -s /usr/local/mysql/bin/* /usr/bin/
#ln -s /usr/local/mysql/lib* /usr/lib/
#ln -s /usr/local/mysql/libexec/* /usr/local/libexec/ 可执行的文件
#ln -s /usr/local/mysql/share/man/man1/* /usr/share/man/man1
#ln -s /usr/local/mysql/share/man/man8/* /usr/share/man/man8
数据库启动
#/etc/init.d/mysqlsource start
查看数据库服务的状态:
# /usr/local/mysql/bin/mysqladmin stauts
4.安装PHP
->安装依赖包libiconv-1.14.tar.gz
#tar zxf libiconv-1.14.tar.gz
#cd libiconv-1.14
#./configure --prefix=/usr/local --with-apr=/usr/local/apr
#make && make install
->安装依赖包libmcrypt-2.5.8.tar.gz
#tar zxf libmcrypt-2.5.8.tar.gz
#cd libmcrypt-2.5.8
#./configure && make && make install
# cd libltdl/
#./configure --enable-ltdl-install && make && make install
->安装依赖包mhash-0.9.9.9.tar.gz和mcrypt-2.6.8.tar.gz
->#tar zxf mhash-0.9.9.9.tar.gz 请注意先后顺序和链接文件操作
#cd mhash-0.9.9.9
#./configure && make && make install
#ln -s /usr/local/lib/* /usr/lib/ 请注意不能重复链接,重复链接会报错
#ln -s /usr/local/bin/libmcypt-config /usr/bin
->#tar zxf mcrypt-2.6.8.tar.gz
#cd mcrypt-2.6.8
->安装php-5.4.11.tar.bz2
#yum install libxml2-devel libpng-devel bzip2-devel curl-devel libjpeg-devel freetype-devel net-snmp-devel -y
# yum install autoconf automake libtool re2c flex bison -y
#tar jxf php-5.4.11.tar.bz2
#cd php-5.4.11
#./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql/ --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql --with-iconv-dir=/usr/local/ --enable-fpm --with-fpm-user=apache --with-fpm-group=apache --with-pcre-regex --with-zlib --with-bz2 --enable-calendar --disable-phar --with-curl --enable-dba --with-libxml-dir --enable-ftp --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv --with-mhash --enable-mbstring --with-mcrypt --enable-pcntl --enable-xml --disable-rpath --enable-shmop --enable-sockets --enable-zip --enable-bcmath --with-snmp --disable-ipv6 --disable-rpath --disable-debug --with-apxs2=/usr/local/apache2/bin/apxs
#make ZEND_EXTRA_LIBS='-liconv'
#make install
(32位系统报错:找不到libmysqlclient.so.18 。解决问题:#ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/ )
#cp php.ini-production /usr/local/php/etc/php.ini
5.编辑httpd.conf
#vim /usr/local/apache2/conf/httpd.conf
搜索关键字Addtype
添加:Addtype application/x-httpd-php .php
搜索index.html(DirectoryIndex index.php)
更改为index.html->index.php
#cd /usr/local/apache2/htdocs
删除index.html
新建一个测试页面
#vim index.php
<?php
phpinfo();
?>
重新启动Apache
#kill httpd(不建议使用)
#/usr/local/apache2/bin/apachectl start
6.启动数据库
排错:
# /etc/init.d/mysqlsource start
Starting MySQL.The server quit without updating PID file (/usr/local/mysql/data/shen2.pid). [失败]
# /etc/init.d/mysqlsource status
MySQL is running but PID file could not be found [失败]
解决办法:1.# ps aux | grep mysql 打印进程
# kill -9 pid1 pid2 杀死进程
再启动
2.可能是配置文件修改出错引起
#vim /etc/my.cny 默认配置哦
[mysqld]
port =3306
socket =/var/lib/mysql/mysql.sock
7.安装论坛
#unzip Discuz_7.2_FULL_SC_UTF8.zip
#mv upload/* /usr/local/apache2/htdocs
重新启动Apache,完成论坛的安装
浏览器输入ip/install/index.php
配置论坛文件
#vim /usr/local/php/etc/php.ini
修改:short_open_tag = On
#cd /usr/local/apache2/htdocs
chmod -R 777 *
数据库用户名:root
数据库密码:空
管理员密码:123456
rpmfind.net 搜索rpm包网站
本文转自 南非波波 51CTO博客,原文链接:http://blog.51cto.com/nanfeibobo/1555974,如需转载请自行联系原作者