ITeye博客

Red Hat AS4下安装LAMP

KJ · 2010-03-15 21:07 · 操作系统 · Markdown

LAMP 安装 安装MYSQL #tar –zxvf mysql-5.0.22.tar.gz //解开安装包 #cd mysql-5.0.22 //进入安装目录 #mkdir /usr/local/mysql //创建mysql目录 #./configure --prefix=/usr/local/mysql //设置安装目录 #make //编译 #make install //安装 // 或是这样 #make && make install 编译并安装 #groupadd mysql //新建名为mysql的组 #useradd –g mysql mysql //新建名为mysql的用户,并且默认属于mysql组 #chgrp –R mysql /usr/local/mysql //改变/usr/local/mysql及下属文件与目录属于的组 #cp support-files/my-large.cnf /etc/my.cnf //拷贝my-large.cnf到/etc中,替换原有的my.cnf #scripts/mysql_install_db //建立初始数据 #chown –R mysql:mysql /usr/local/mysql/var //更改var及下面的文件目录属组与属主 #cp support-files/mysql.server /etc/init.d/mysqld //拷贝mysql.server到init.d目录中并重命名为mysql,启动文件 #chmod 755 /etc/init.d/mysqld //设置启动文件的权限为755 #chkconfig --add mysqld //把此服务添加到系统启动中,add为添加至/etc/rc.d/init.d中 #chkconfig mysqld on //on默认在3\5级别服务默认启动 #/etc/init.d/mysqld start #/usr/local/mysql/bin/mysqld_safe & //启动mysql #/usr/local/mysql/bin/mysqladmin –u root –p password 123 //默认root用户密码为空,设置密码为123 #/usr/local/mysql/bin/mysql –u root –p //输入上面设置的123后,以root身份登陆 #./mysqladmin -u root -p password 456 //输入上面设置的123后.以root身份登陆 mysql> grant select on test.* to 'ttt' @'%' identified by'ttt' with grant option; //添加一个名称为ttt,密码为ttt的mysql账户,对test数据库有修改权限 2、Apahce的安装 #tar -zxvf httpd-2.2.3.tar.gz //解压httpd-2.2.3.tar.gz包 #./configure –prefix=/usr/local/apache2 --enbale-module=so //这里的—prefix指定apache 的安装将安装到:/usr/local/apache2目录下 #make //编译 #make install //安装 #vi /usr/local/apache2/conf/httpd.conf //将里面的ServerName前面的#去掉,后面是:自己的ip:80 #/usr/local/apache2/bin/apachectl start //启动apache服务 如果你想一开机就让apache自动运行的话,那么进行如下操作: 编辑etc/rc.d /rc.local

vi /etc/rc.d/rc.local

在最后加上一句: /usr/local/apache2/bin/apachectl start 看这里的/usr/local/apache2的安装路径用到了吧,所以大家装的时候一定要记清楚哦。。。。

jpeg包的安装和设定 #mkdir -p /usr/local/jpeg6

mkdir -p /usr/local/jpeg6/bin

mkdir -p /usr/local/jpeg6/lib

mkdir -p /usr/local/jpeg6/include

mkdir -p /usr/local/jpeg6/man/man1

//上面的创建目录 #tar –zxvf jpegsrc.v6b.tar.gz //解压jpegsrc.v6b.tar.gz包 #./configure –prefix=/usr/local/jpeg6/ --enable-static #make //编译 #make install //安装 安装libpng

tar xvzf libpng-1.2.8.tar.gz

cd libpng-1.2.8

cp scritp/makefile.gcmmx makefile(本身自带makefile文件,无需configure,copy一下就OK了)

make

make install

安装freetype #tar –zxvf freetype-2.3.5.tar.gz #cd freetype-2.3.5 #mkdir –p /usr/local/freetype #./configure –prefix=/usr/local/freetype #make #make install 安装zlib(lib png支持包) #tar –zxvf zlib-1.2.2.tar.gz #cd zlib-1.2.2.tar.gz #./configure #make #make insatll 安装GD库# #tar –zxvf gd-2.0.33.tar.gz #cd gd-2.0.33.tar.gz

./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg6/ --with-png=/usr/local/lib/ --with-zlib=/usr/local/lib/ --with-freetype=/usr/local/freetype/

#make #make install #cp gd.h /usr/local/lib/ 安装xml包 #tar –zxvf libxml2-2.6.19.tar.gz #cd libxml2-2.2.6.19 #./configure –prefix=/usr/local/libxml2 #make #make install 安装Curl库 #tar –zxvf curl-7.16.4.tar.gz #cd curl-7.16.4 #./configure –prefix=/usr/local/curl #make #make install 安装php #tar –zxvf php-5.2.3.tar.gz #cd php-5.2.3.tar.gz #./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql/ --with-curl=/usr/local/curl --enable-ftp --with-libxml-dir=/usr/local/libxml2 --with-gd-dir=/usr/local/gd2 --with-jpeg-dir=/usr/local/jpeg6/ --with-zlib-dir=/usr/local/lib --with-png=/usr/local/lib/ --with-freetype-dir=/usr/local/freetype #make #make install #cp php.ini-dist /usr/local/lib/php.ini 其中./configure 后的 --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql/ --with-libxml-dir=/usr/local/libxml2 是必要的选项 --with-gd=/usr/local/gd2/ --with-jpeg-dir=/usr/local/jpeg6/ --with-png=/usr/local/lib --with-zlib-dir=/usr/lib --with-freetype-dir=/usr/local/freetype 这是让PHP支持GD库的配置选项 --with-curl=/usr/local/curl 支持CURL库 --enable-ftp 打开FTP库函数支持 --enable-soap --with-xsl=/usr/local/libxslt --enable-xslt 让PHP支持SOAP, 上面这些一般用得少, 可以去掉 --- 收尾工作: 编辑apache的配置文件httpd.conf vi /etc/httpd/httpd.conf 找到 “#AddType application/x-gzip .gz .tgz” 并在后面加入 AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps 这两行的目的是让apache识别php。 再找到“DirectoryIndex index.html” 加上 index.php 让它把index.php做为默认页 ---测试环境: 在/usr/local/apache/htdocs/下面建立php文件。

vi /usr/local/apache/htdocs/index.php

输入:

重启apache服务器

/usr/local/apache/bin/apachectl restart

浏览器中输入:http://127.0.0.1/index.php测试一下,激动的话面就出来喽!!!!

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。