一、源码安装LAMP环境:
步骤: ( 一)安装httpd 挂载LAMP+POSTFIX.iso mount /dev/cdrom /media cp /media/* /tmp 搭建yum源 yum install *gcc* -y yum install *openssl* cd /tmp tar -zxvf httpd-2.2.9.tar.gz -C /usr/src cd /usr/src/httpd-2.2.9 ./configure --prefix=/usr/local/apache2 --enable-rewrite --enable-so --enable-auth-digest --enable-cgi --with-ssl=/usr/lib --enable-ssl --enable-suexec --with-suexec-caller=daemon --with-suexec-docroot=/usr/local/apache2/htdocs make && make install说明:
--with-suexec-caller=daemon 指定允许调用SUEXEC 功能用户名为daemon。 --with-suexec-docroot 指定SUEXEC功能的网页cd /usr/local/apache2/bin
cp apachectl /etc/init.d/httpd vim /etc/init.d/httpd # chkconfig: 35 85 15 # description: Web Server chkconfig --add httpd chkconfig --level 35 httpd on(二)安装mysql
yum -y install libtermcap-devel cd /tmp tar -zxvf mysql-5.0.56.tar.gz -C /usr/src useradd -M -s /sbin/nologin mysql cd /usr/src/mysql-5.0.56 ./configure --prefix=/usr/local/mysql --with-mysqld-user=mysql make && make install cp support-files/my-medium.cnf /etc/my.cnf /usr/local/mysql/bin/mysql_install_db --user=mysql chown -R root:mysql /usr/local/mysql chown -R mysql /usr/local/mysql/var echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf ldconfig cp support-files/mysql.server /etc/init.d/mysqld chmod o+x /etc/init.d/mysqld chkconfig --add mysqld chkconfig mysqld on service mysqld start export PATH=$PATH:/usr/local/mysql/bin echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile mysqladmin -u root password 123456 mysql -u root -p 输入密码123456 quit(三)安装php
yum install *libxml2* -y cd /tmp tar -jxvf php-5.2.6.tar.bz2 -C /usr/src cd /usr/src/php-5.2.6 ./configure --prefix=/usr/local/php5 --enable-mbstring --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-config-file-path=/usr/local/php make make install cp php.ini-dist /usr/local/php5/php.ini vim /usr/local/apache2/conf/httpd.conf 53 LoadModule php5_module modules/libphp5.so 54 AddType application/x-httpd-php .php (注意是空格.php) 167 <IfModule dir_module> 168 DirectoryIndex index.php index.html 169 </IfModule> service httpd restart(四)测试验证
vim /usr/local/apache2/htdocs/index.php <?php phpinfo(); ?> service httpd restart 客户端访问web。二、架设Discuz
mysql -u root –p create database bbsdb; grant all on bbsdb.* to identified by '123456'; quit cd /tmp unzip UCenter_1.0.0_SC_UTF8.zip -d /usr/local/apache2/htdocs/ mv /usr/local/apache2/htdocs/upload /usr/local/apache2/htdocs/ucenter unzip Discuz_6.1.0_SC_UTF8.zip -d /usr/local/apache2/htdocs/ mv /usr/local/apache2/htdocs/upload /usr/local/apache2/htdocs/bbs cd /usr/local/apache2/htdocs/ucenter chown -R daemon data cd /usr/local/apache2/htdocs/bbs chown -R daemon config.inc.php p_w_uploads forumdata uc_client/data/cache三、安装phpMyAdmin
cd /tmp tar -zxvf phpMyAdmin-2.11.9.5-all-languages.tar.gz -C /usr/local/apache2/htdocs cd /usr/local/apache2/htdocs mv phpMyAdmin-2.11.9.5-all-languages/ phpMyAdmin cp config.sample.inc.php config.inc.php vim config.inc.php 17 $cfg['blowfish_secret'] = '123456';破解mysql密码:
service mysqld stop /usr/local/mysql/bin/mysqld_safe --skip-grant-table & mysql -u root update mysql.user set password=password('123456') where user='root'; flush privileges;