一、源码安装LAMP环境:
步骤: ( 一)安装httpd 挂载LAMP.iso mount /dev/cdrom /media cp /media/* /tmp 搭建yum源 yum install *gcc* -y yum install *openssl* -y 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 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 useradd -M -s /sbin/nologin mysql tar -zxvf /tmp/mysql-5.0.56.tar.gz -C /usr/src 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 tar -jxvf /tmp/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>setenforce 0 ;禁止或者关闭
service httpd restart
(四)测试验证
echo "<?php phpinfo(); ?>" >/usr/local/apache2/htdocs/index.php service httpd restart 客户端访问web。