LAMP的安装
系统环境:CentOS 5.4
软件版本:httpd-2.2.17.tar.bz2 mysql-5.1. php-5.2.17.tar.bz2
环境:yum install make gcc gcc-c++ libxml2 libxml2-devel libmcrypt libmcrypt-devel libtool-ltdl apr apr-* ncurses ncurses-*
安装mysql:
#tar -zxvf mysql-5.1.
#cd mysql-5.1.53
#/usr/sbin/groupadd mysql
#/usr/sbin/useradd mysql -g mysql
#./configure --prefix=/opt/mysql --localstatedir=/opt/mysql/data/ --with-server-suffix=-enterprise-gpl --without-debug --with-big-tables --with-extra-charsets=gb2312,utf8,GBK --with-extra-charsets=all --with-
pthread --enable-thread-safe-client --enable-static --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --enable-assembler --without-innodb --without-ndb-debug --without-isam
#make(时间会很长、优化的比较多)
#make install
#mkdir -R /opt/mysql/data
#cd /opt/mysql
#bin/mysql_install_db --user=mysql
注:Installing MySQL
OK
Filling
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/opt/mysql/bin/mysqladmin -u root password 'new-password'
/opt/mysql/bin/mysqladmin -u root -h xsl228 password 'new-password'
Alternatively you can run:
/opt/mysql/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /opt/mysql ; /opt/mysql/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /opt/mysql/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /opt/mysql/bin/mysqlbug script!
#chown -sql .
#chown -sql /opt/mysql/data
#cp share/mysql/my-mediumf /etc/myf
#cp share/mysql/mysql.server /etc/rc.d/init.d/mysqld
#chmod 755 /etc/rc.d/init.d/mysqld
#/opt/mysql/bin/mysqld_safe -user=mysql &
如果mysql不成功,查看下mysql的错误日志
apache安装:
#tar -jxvf httpd-2.2.17.tar.bz2
#cd httpd-2.2.17
#./configure --prefix=/opt/bokee/apache2 --enable-so --enable-rewrite --enable-mods-shared=all --enable-vhost-alias=shared --enable-cache=shared --enable-file-cache=shared --enable-disk-cache=shared --enable-mem-cache=shared --enable-proxy=shared --enable-proxy-http=shared --enable-proxy-connect=shared --disable-proxy-ftp --disable-userdir --disable-asis --enable-ssl
#make
#make install
#/opt/bokee/apache2/bin/apachectl start
启动apache会报错,但是还是可以启动
编辑下/opt/bokee/apache2/f
ServerName 127.0.0.1
重启apache服务就可以正常启动了
php安装:
yum install libxml2* libpng* libjpeg* freetype* gd gd-* libxslt* zlib* libtool* php-pear php-pdo #tar -jxvf php-5.2.17.tar.bz2
#cd php-5.2.17
#./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc --with-apxs2=/opt/bokee/apache2/bin/apxs--with-mysql=/opt/mysql --with-mysqli=/opt/mysql/bin/mysql_config --with-gd --enable-gd-native-ttf --with-jpeg-dir --with-png-dir --with-zlib --with-freetype-dir --with-libxml-dir --with-xsl --enable-sqlite-utf8 --with-iconv --enable-mbstring=all --disable-debug --with-pear
注:+--------------------------------------------------------------------+
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |
+--------------------------------------------------------------------+
Thank you for using PHP.
#make
注:Build complete.
Don't forget to run 'make test'.
#make install
注:Installing PHP SAPI module: apache2handler
/opt/bokee/apache2/build/instdso.sh SH_LIBTOOL='/usr/lib/apr-1/build/libtool' libphp5.la /opt/bokee/apache2/modules
/usr/lib/apr-1/build/libtool --mode=install cp libphp5.la /opt/bokee/apache2/modules/
cp .libs/libphp5.so /opt/bokee/apache2/modules/libphp5.so
cp .libs/libphp5.lai /opt/bokee/apache2/modules/libphp5.la
libtool: install: warning: remember to run `libtool --finish /home/weijunping/php-5.2.17/libs' chmod 755 /opt/bokee/apache2/modules/libphp5.so
[activating module `php5' in /opt/bokee/apache2/f]
Installing PHP CLI binary: /usr/local/php5/bin/
Installing PHP CLI man page: /usr/local/php5/man/man1/
Installing build environment: /usr/local/php5/lib/php/build/
Installing header files: /usr/local/php5/include/php/
Installing helper programs: /usr/local/php5/bin/
program: phpize
program: php-config
Installing man pages: /usr/local/php5/man/man1/
page: phpize.1
page: php-config.1
Installing PEAR environment: /usr/local/php5/lib/php/
[PEAR] Archive_Tar -installed: 1.3.7
[PEAR] Console_Getopt -installed: 1.2.3
[PEAR] Structures_Graph-installed: 1.0.3
[PEAR] XML_Util -installed: 1.2.1
[PEAR] PEAR -installed: 1.9.1
Wrote PEAR system config file at: /usr/local/php5/f
You may want to add: /usr/local/php5/lib/php to your php.ini include_path
Installing PDO headers: /usr/local/php5/include/php/ext/pdo/
#cp php.ini-dist /usr/local/php5/etc/php.ini
#vi /usr/local/php5/etc/php.ini
将register_globals = Off改为register_globals = On
整合apache 与php
1、
#vi /opt/apache2.2.17/f 些模块简单的修改
在配置文件中添加如下:
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
2、
查:(设置WEB 默认文件)
DirectoryIndex index.html
替换为:
DirectoryIndex index.php index.html index.htm //在WEB 目录不到默认文件,httpd 就会执行/var/www/error/noindex.html
3、
到这一段:
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride none
更改为AllowOverride all
允许apache rewrite
●测试服务器
1、测试PHP
进入Apache默认主目录DocumentRoot "/opt/bokee/apache2/htdocs",在该目录下建一个test.php文件
#vi test.php 写入以一内容
<?phpinfo();?>
然后在浏览器中看ip/test.php
CentOs5.4系统中搭建论坛Discuz
在Discuz(www.discuz)上下载软件包Discuz_7.2_FULL_SC_UTF8.zip
上传至服务器
#mkdir Discuz
#unzip Discuz_7.2_FULL_SC_UTF8.zip -d Discuz
将upload文件夹复制到apache的主目录中
在apache的主目录中创建子目录bbs
并赋予/opt/bokee/apache2/htdocs读写权限
#cd /opt/bokee/apache2/htdocs
#mkdir bbs
#chmod 777 -R /opt/bokee/apache2/htdocs
将Discuz目录中的upload目录中的所有内容复制到bbs中
#cp -r /home/weijunping/Discuz/upload/* /opt/bokee/apache2/htdocs/bbs
在mysql中添加数据库和用户
#/opt/mysql/bin/mysql -uroot -p
输入密码
mysql> create database discuz ;//添加discuz数据库
Query OK, 1 row affected (0.00 sec)
mysql> grant all privileges on discuz.* to discuz@localhost identified by '123456';
//添加discuz用户,并设定密码为123456
Query OK, 0 rows affected (0.00 sec)
然后在IE地址栏中输入:119.255.34.149/bbs/install/开始安装Discuz的安装
“我同意”--“下一步”—
此处的数据库名和数据库密码均为前面在数据库中创建的;管理员帐号极其密码是新设置的
php项目搭建开始在数据库中创建表格等信息
论坛后台管理中心:119.255.34.149/bbs/admincp.php

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。