LAMP 环境搭建关键步骤及注意事项 一、安装MySQL 1) shell> cd /usr/local/src shell> groupadd mysql shell> useradd mysql -g mysql 创建mysql用户 shell> tar -xzvf mysql-5.0.51a.tar.gz shell> cd mysql-5.0.51a shell> ./configure --prefix=/usr/local/mysql --with-charset=gb2312 --with-extra-charsets=gbk,gb2312 shell> make && make install
shell> cp support-files/f /etc/f shell> cd /usr/local/mysql 修改此目录的所有文件权限, shell> chown -R mysql.mysql . 为mysql用户生成数据库 shell> bin/mysql_install_db --user=mysql 为安全起见 将原目录权限改回root shell> chown -R root . 将新生成的存放数据库的目录改回mysql所有以便能够正常启动。 shell> chown -R mysql var
设置mysql开机自动启动 cp support-files/mysql.server /etc/rc.d/init.d/mysqld chmod +x /etc/rc.d/init.d/mysqld chkconfig --add mysqld service mysqld start chkconfig mysqld on
二、安装支持图形库 zlib-1.2.3.tar.gz jpegsrc.v6b.tar.gz libpng-1.2.12.tar.gz freetype-2.3.4.tar.gz gd-2.0.34.tar.gz
1)libxml2 shell> cd /usr/local/src shell> tar -xjvf libxml2-2.6.27.tar.bz2 shell> cd libxml2-2.6.27 shell>./configure --prefix=/usr/local/libxml2 shell> make && make install
2)zlib shell> cd /usr/local/src shell> tar -zxvf zlib-1.2.3.tar.gz shell> cd zlib-1.2.3 shell>./configure //这个配置编译命令不要加目录参数 shell> make && make install
3)jpeg6 shell> mkdir -p /usr/local/jpeg6 shell> mkdir -p /usr/local/jpeg6/bin shell> mkdir -p /usr/local/jpeg6/lib shell> mkdir -p /usr/local/jpeg6/include shell> mkdir -p /usr/local/jpeg6/man shell> mkdir -p /usr/local/jpeg6/man1 shell> mkdir -p /usr/local/jpeg6/man/man1 安装出现错误 提示无关键目录无法继续 手动建立如上目录 shell> cd /usr/local/src shell> tar -zvxf jpegsrc.v6b.tar.gz shell> cd jpeg-6b shell>./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static shell> make && make install
4)libpng shell> cd /usr/local/src shell> tar -zvxf libpng-1.2.12.tar.gz shell> cd libpng-1.2.12 shell>./configure //和zlib一样不要带参数,让它默认安装到相应目录 shell> make && make install
5)freetype shell> cd /usr/local/src shell> tar -zvxf freetype-2.3.4.tar.gz shell> cd freetype-2.3.4 shell> mkdir -p /usr/local/freetype shell>./configure --prefix=/usr/local/freetype shell> make && make install
6)GD库 shell> cd /usr/local/src shell> tar -zvxf gd-2.0.34.tar.gz shell> mkdir -p /usr/local/gd shell> cd gd-2.0.34 shell>./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/jpeg6/ --with-png --with-zlib --with-freetype=/usr/local/freetype/ shell> make && make install
三、安装 apache2 shell> cd /usr/local/src shell> tar -zxvf httpd-2.2.4.tar.gz shell> cd httpd-2.2.4 shell>./configure --prefix=/usr/local/apache2 --enable-module=most --enable-rewrite --enable-shared=max --enable-so --enable-ssl shell> make && make install
o l xiamianmeianne
四、安装 php5 shell> cd /usr/local/src shell> tar -zxvf php-5.2.2.tar.gz shell> cd php-5.2.2 shell>./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-freetype-dir=/usr/local/freetype --with-gd=/usr/local/gd --with-zlib --with-libxml-dir=/usr/local/libxml2 --with-jpeg-dir=/usr/local/jpeg6 --with-png-dir --enable-mbstring=all --enable-mbregex --enable-shared shell> make && make install shell> cp php.ini-dist /usr/local/php/lib/php.ini
五、安装Zend shell> cd /usr/local/src shell> tar -zxvf ZendOptimizer-3.2.8-linux-glibc21-i386.tar.gz shell> cd ZendOptimizer-3.2.8-linux-glibc21-i386 ./install
注:php.ini的路径是在/usr/local/php/lib/目录下
六、配置并启动Apache
在Apache主配置文件中增加: AddType application/x-httpd-php .php .phtml 找到index.php 在前面添加index.php
启动Apache /usr/local/apache2/bin/apachectl start
设置MySQL和Apache自动启动 shell> echo "/usr/local/apache2/bin/apachectl start" >> /etc/rc.local
七、建立php测试网页 vim /usr/local/apache2/htdocs/index.php <?php phpinfo(); ?>
搭建完毕
天上云怎么样?天上云隶属于成都天上云网络科技有限公司,是一家提供云服务器及物理服务器的国人商家,目前商家针对香港物理机在做优惠促销,香港沙田机房采用三网直连,其中电信走CN2,带宽为50Mbps,不限制流量,商家提供IPMI,可以自行管理,随意安装系统,目前E3-1225/16G的套餐低至572元每月,有做大规模业务的朋友可以看看。点击进入:天上云官方网站天上云香港物理机服务器套餐:香港沙田数据中...
特网云为您提供高速、稳定、安全、弹性的云计算服务计算、存储、监控、安全,完善的云产品满足您的一切所需,深耕云计算领域10余年;我们拥有前沿的核心技术,始终致力于为政府机构、企业组织和个人开发者提供稳定、安全、可靠、高性价比的云计算产品与服务。公司名:珠海市特网科技有限公司官方网站:https://www.56dr.com特网云为您提供高速、稳定、安全、弹性的云计算服务 计算、存储、监控、安全,完善...
ProfitServer已开启了黑色星期五的促销活动,一直到本月底,商家新加坡、荷兰、德国和西班牙机房VPS直接5折,无码直购最低每月2.88美元起,不限制流量,提供IPv4+IPv6。这是一家始于2003年的俄罗斯主机商,提供虚拟主机、VPS、独立服务器、SSL证书、域名等产品,可选数据中心包括俄罗斯、法国、荷兰、美国、新加坡、拉脱维亚、捷克、保加利亚等多个国家和地区。我们随便以一个数据中心为例...