安装lamp详细版本

来源:互联网 发布:风靡网络 编辑:程序博客网 时间:2024/05/18 05:13

@font-face { font-family: "宋体";}@font-face { font-family: "Verdana";}p.MsoNormal, li.MsoNormal, div.MsoNormal { margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: "Times New Roman"; }a:link, span.MsoHyperlink { color: rgb(2, 122, 198); text-decoration: none; }a:visited, span.MsoHyperlinkFollowed { color: purple; text-decoration: underline; }p { margin: 7.2pt 0cm 14.4pt; font-size: 12pt; font-family: 宋体; }div.Section1 { page: Section1; }

1、安装mysql
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> tar zxvf mysql.tar.gz
shell> cd mysql-VERSION
shell> ./configure --prefix=/usr/local/mysql --enable-assembler--with-mysqld-ldflags=-all-static --with-extra-charsets=all --with-big-tables--with-charset=utf8 --with-collation=utf8_unicode_ci
shell> make
shell> make install
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> cd /usr/local/mysql
shell> bin/mysql_install_db --user=mysql (
初始化数据库)
shell> chown -R root .
shell> chown -R mysql var
shell> chgrp -R mysql .
shell> bin/mysqld_safe --user=mysql & (
启动服务器)
shell> mysqladmin -u root -p password '1234' (
修改root用户密码)
shell> cp /usr/local/mysql/share/mysql/mysql.server /etc/rc.d/init.d/mysqld
shell> chmod 700 /etc/rc.d/init.d/mysqld
shell> chkconfig --add mysqld (
以上三行作为mysql自动启动来用)

 

env查看环境变量

cp /usr/local/mysql/bin/mysql /usr/bin

chkconfig –delhttpd 删除系统中的apache服务;

2、安装apache
解压httpd-2.0.59.tar.gz
# tar -zvxf httpd-2.0.59.tar.gz
进入httpd-2.0.59目录
# cd httpd-2.0.59
生成/usr/local/apache2目录
# mkdir -p /usr/local/apache2
配置安装目录
# ./configure --prefix=/usr/local/apache2 --enable-modules=so --enable-rewrite
编译
# make
安装
# make install
安装完毕
#/usr/local/apache2/bin/apachectl -k start
启动测试

 直接访问服务器http://localhost/,可以看到 It WORKS!

apahce系统启动时自动启动
/usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd 建立一个符号连接:
# ln -s /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd

然后在此文件总添加以下几行(大概在文件顶部,约第二行的地方):

# chkconfig: 234530 100
# description: Activates/Deactivates Apache Web Server

最后,运行chkconfigApache添加到系统的启动服务组里面:

# /sbin/chkconfig--del httpd
# /sbin/chkconfig --add httpd

另外一种方法系统启动时加载apache
cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd
cd /etc/rc.d/rc3.d
ln -s ../init.d/httpd S80httpd

3、第三方库

安装 libxml2
tar -zxvf libxml2-2.6.19.tar.gz
cd libxml2-2.6.19
./configure --prefix=/usr/local/libxml2
make
make install
这一步结束时,libxml2被安装在/usr/local/下。

安装 zlib
tar -zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3

如果是64位系统 则 CFLAGS="-O3 -fPIC" ./configure --prefix=/usr/local/zlib/
./configure --prefix=/usr/local/zlib
make
make install
这一步结束时,zlib被安装在/usr/local/下。

安装 libpng
tar -zxvf libpng-1.2.10.tar.gz
cd libpng-1.2.10
cp scripts/makefile.linux makefile
make
make install
注意:这里的makefile不是用./configure生成的,而是直接从script/目录里拷一个
这一步结束时,zlib被安装在/usr/local/lib

安装 freetype
tar -zxvf freetype-2.2.1.tar.gz
cd freetype-2.2.1
./configure --prefix=/usr/local/freetype
make
make install
这一步结束时,freetype被安装在/usr/local/lib

安装 jpeg6
建立目录
mkdir /usr/local/jpeg6
mkdir /usr/local/jpeg6/bin
mkdir /usr/local/jpeg6/lib
mkdir /usr/local/jpeg6/include
mkdir /usr/local/jpeg6/man
mkdir /usr/local/jpeg6/man/man1
tar -zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
make
make install
注意:这里./configure一定要带--enable-shared参数,不然,不会生成共享库

安装 gd
tar -zxvf gd-2.0.33.tar.gz
cd gd-2.0.33
./configure --prefix=/usr/local/gd --with-png=/usr/local/lib--with-freetype=/usr/local/freetype --with-jpeg=/usr/local/jpeg6
make && make install

4、安装PHP

tar -zxvfphp5.tar.gz

cd php5
./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs--with-config-file-path=/etc --with-libxml-dir=/usr/local/libxml2--with-zlib-dir=/usr/local/zlib --with-gd=/usr/local/gd--with-jpeg-dir=/usr/local/jpeg6 --with-png-dir=/usr/local/lib --with-freetype-dir=/usr/local/freetype--with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config--with-openssl --enable-gd-native-ttf --enable-mbstring --enable-ftp--enable-bcmath --enable-sockets --enable-zip --enable-soap --enable-calendar
make
make install
cp php.ini-dist /etc/php.ini

5、整合apache2php5
apache
配置文件及目录是:
/usr/local/apache2/conf/httpd.conf
apache
默认存放主页的位置是:
/usr/local/apache2/htdocs
以下是配置文件里面的信息:(有的地方要做修改)
ServerRoot "/usr/local/apache2"
这是指定apache程序所在的目录,比如日志文件、配置文件等目录。
DocumentRoot "/usr/local/apache2/htdocs"
这个是存放网页的目录

这一句应该和DocumentRoot的目录保持一致。
找到 DirectoryIndex index.html
改为 DirectoryIndex index.html index.html.var index.htmindex.php
找到 AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php (注意空格)
AddType application/x-httpd-php-source .phps
添加 AddDefaultCharset utf8 使apache默认支持utf8字符集
保存配置文件就重启apache 的守护进程。
/usr/local/apache2/bin/apachectl restart

注意: 
每次更改配置文件。要重启服务。
对存放网页的目录执行:命令chmod 755 目录名 或者 chmod-R 755 目录名

编辑php.ini文件,找到
;default_charset="iso-8859-1"
增加一行:default_charset="utf8"

以上步骤都执行完后。在/usr/local/apache2/htdocs/里编辑文件进行测试。
phpinfo.php
里面的内容:
phpinfo();
?>
在浏览器地址栏中输入:
http://localhost/phpinfo.php
出现php说明页面说明安装成功。

 

 

Yum install subversion

 

原创粉丝点击