linux社区爱心援助Linux认证系列教程业界动态站务新闻公司招聘建议留言网址大全LPI专题CISCO专题
设为首页
加入收藏
管理团队
JSP  
JAVA  
PERL  
 您的位置:首页 > article > unix > unix入门 >
栏目导栏
资料搜索
热门文章
·SCO OpenServer系统手册
·solaris迅速查找手册
·UNIX常用命令-目录及文件操作命
·常见的“压缩与解压缩”方法
·SUN的入门培训资料
·Solaris FAQ 1.2
·UNIX系统操作入门篇
·unix大全下载基地
·教你如何配置安全的SOLARIS系统
·吐血奉献.samba安装设置!
·solaris常用命令及简单解释
·UNIX 常识总集~!
·Windows XP 与 Solaris 10 双操
·隆重推荐:Solaris硬盘分区简介
·UNIX基础知识
最新文章
·Solaris SSH的配置和管理介绍
·在Unix环境下mount ISO文件
·Solaris 管理员常用的168条命令
·solaris raid 制作大集合
·在Solaris下使用USB存储设备
·SecureCRT访问HPUX没办法用vi问
·scounix网络设置心得
·solaris网络配置
·solaris上直接运行linux二进制
·HP Unix的补丁安装
·系统备份与恢复命令:fbackup+
·Oracle 10g基于Solaris 9 x86平
·完全硬盘安装solaris10
·solaris点滴9.29-10.07
·solaris volume manager do RA
Google
 
Solaris 10 OS 快速安装 Apache + Mysql + php
[ 作者:  加入时间:2007-02-20 11:55:17  来自:Linux联盟收集整理 ]
前言:

本文的阅读对象是为已经有 ApacheMySQL php 基本的操作经验的人员编写。主要讲求正确和快速安装。 致于,ApacheMySQL php详细设定、修改方面和软件测试,在这里不会详谈。

设定、测试与启动 Apache2

Solaris 10 已经内置安装了 Apache 2.xx,只需要做一些设定便可以使用。

1. 首先用 Root 了登入文字模式系统 ( Console Mode )

2. 复制 /etc/apache2/httpd.conf-example /etc/apache2/httpd.conf

# cp /etc/apache2/httpd.conf-example /etc/apache2/httpd.conf

3. 编辑 /etc/apache2/httpd.conf

·   设定你所需要的 ServerName 服务器名称,预设为 127.0.0.1

·   ServerAdmin 设定正确的 E-mail 地址

4. 使用以下指令启动 Apache

# svcadm enable apache2

然后,试一试从新启动 Solaris ,看一看 Apache 能不自动启动。基本网页文件位置为 /var/apache2/htdocs

设定、测试与启动 MySQL

Solaris 10 已经内置安装了 MySQL。安装者必须要用 Root 身份登入系统。以下的安装步骤可以在 /usr/sfw/src/mysql/Docs 目录中找到。

1.  root 身份 login Console mode 中,并且进行数据库的事前准备。rcxLinux联盟
# /usr/sfw/bin/mysql_install_db
rcxLinux联盟
Preparing db tablercxLinux联盟
Preparing host tablercxLinux联盟
Preparing user tablercxLinux联盟
Preparing func tablercxLinux联盟
Preparing tables_priv tablercxLinux联盟
Preparing columns_priv tablercxLinux联盟
Installing all prepared tablesrcxLinux联盟
060118 21:24:03 /usr/sfw/sbin/mysqld: Shutdown CompletercxLinux联盟
<snip...>

2. 建立 mysql user group ,并且更改数据目录的群组。rcxLinux联盟
# groupadd mysql
rcxLinux联盟
# useradd -g mysql mysql
rcxLinux联盟
# chgrp -R mysql /var/mysql
rcxLinux联盟
# chmod -R 770 /var/mysql
rcxLinux联盟
# installf SUNWmysqlr /var/mysql d 770 root mysql

3. 预设 MySQL 设定文件位置为 /var/mysql/my.cnf

4. 复制 MySQL 设定文件到预设位置rcxLinux联盟
# cp /usr/sfw/share/mysql/my-medium.cnf /var/mysql/my.cnf

5. 手动启动 mysqlrcxLinux联盟
# /usr/sfw/sbin/mysqld_safe --user=mysql &

6. 设定 MySQL root user密码 ( 下文中的 new-password 为你想要的密码,你可以自行更改为你喜欢的密码。因为安全理由,切密不要使用 new-password 为你的密码,一定要更改 ) rcxLinux联盟
# cd /usr/sfw/bin
rcxLinux联盟
# ./mysqladmin -u root password 'new-password'
rcxLinux联盟
# ./mysqladmin -u root -h `hostname` password 'new-password'

7. 测试 MySQL ServerrcxLinux联盟
# ./mysqlshow -p
rcxLinux联盟
Enter password: new-passwordrcxLinux联盟
+-----------+rcxLinux联盟
| Databases |rcxLinux联盟
+-----------+rcxLinux联盟
| mysql     |rcxLinux联盟
| test      |rcxLinux联盟
+-----------+rcxLinux联盟
# ./mysql -u root -p
rcxLinux联盟
Enter password: new-passwordrcxLinux联盟
Welcome to the MySQL monitor. Commands end with ; or \g.rcxLinux联盟
Your MySQL connection id is 3 to server version: 4.0.20-standardrcxLinux联盟
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.rcxLinux联盟
rcxLinux联盟
mysql> show databases;
rcxLinux联盟
+-----------+rcxLinux联盟
| Databases |rcxLinux联盟
+-----------+rcxLinux联盟
| mysql     |rcxLinux联盟
| test      |rcxLinux联盟
+-----------+rcxLinux联盟
2 rows in set (0.00 sec)rcxLinux联盟
rcxLinux联盟
mysql> quit;
rcxLinux联盟
Bye

8. 设定 Solaris Server 在启动和关机时,自动运行和停止MySQL ServerrcxLinux联盟
# ln /etc/sfw/mysql/mysql.server /etc/rc3.d/S99mysql
rcxLinux联盟
# ln /etc/sfw/mysql/mysql.server /etc/rc0.d/K00mysql
rcxLinux联盟
# ln /etc/sfw/mysql/mysql.server /etc/rc1.d/K00mysql
rcxLinux联盟
# ln /etc/sfw/mysql/mysql.server /etc/rc2.d/K00mysql
rcxLinux联盟
# ln /etc/sfw/mysql/mysql.server /etc/rcS.d/K00mysql

9. 然后,试一试从新启动 Solaris ,看一看 MySQL 能不自动启动。预设 MySQL 设定文件位置为 /var/mysql/my.cnf

下载与设定 PHP

1.       root 身份 login Console mode 中。

2.       检查清楚 PATH 是否包含 /opt/csw/bin /usr/sfw/bin,如果没有,请自行加上。rcxLinux联盟
# bash
rcxLinux联盟
# export PS1='\u:\w#'
rcxLinux联盟
root:/# echo $PATH
rcxLinux联盟
/opt/csw/bin:/usr/sfw/bin:/usr/sbin:/usr/bin:/usr/openwin/bin:/usr/dt/bin:/usr/ccs/bin

3.       安装 pkg-getrcxLinux联盟
root:/# mkdir /usr/local/src
rcxLinux联盟
root:/# cd /usr/local/src
rcxLinux联盟
root:/usr/local/src# wget http://www.blastwave.org/pkg_get.pkg
rcxLinux联盟
root:/usr/local/src# cp pkg_get.pkg ..
rcxLinux联盟
root:/usr/local/src# pkgadd -d pkg_get.pkg all
rcxLinux联盟
rcxLinux联盟
You may use and copy this software without charge, as you see fit.rcxLinux联盟
The software is copyright (C) Philip Brown, Nov 2002rcxLinux联盟
rcxLinux联盟
Dont forget to update /opt/csw/etc/pkg-get.conf with your nearest archive site.rcxLinux联盟
The selected base directory </opt/csw> must exist before installationrcxLinux联盟
is attempted.rcxLinux联盟
rcxLinux联盟
Do you want this directory created now [y,n,?,q] yrcxLinux联盟
Using </opt/csw> as the package base directory.rcxLinux联盟
## Processing package information.rcxLinux联盟
## Processing system information.rcxLinux联盟
2 package pathnames are already properly installed.rcxLinux联盟
## Verifying disk space requirements.rcxLinux联盟
## Checking for conflicts with packages already installed.rcxLinux联盟
## Checking for setuid/setgid programs.rcxLinux联盟
rcxLinux联盟
This package contains scripts which will be executed with super-userrcxLinux联盟
permission during the process of installing this package.rcxLinux联盟
rcxLinux联盟
Do you want to continue with the installation of <CSWpkgget> [y,n,?] yrcxLinux联盟
rcxLinux联盟
Installing pkg_get - CSW version of automated package download tool as <CSWpkgget>rcxLinux联盟
rcxLinux联盟
## Installing part 1 of 1.rcxLinux联盟
/opt/csw/bin/pkg-getrcxLinux联盟
/opt/csw/etc/pkg-get.conf.cswrcxLinux联盟
/opt/csw/share/man/man1m/pkg-get.1mrcxLinux联盟
/var/pkg-get/admin-fullautorcxLinux联盟
[ verifying class <none> ]rcxLinux联盟
## Executing postinstall script.rcxLinux联盟
rcxLinux联盟
Installing /opt/csw/etc/pkg-get.conf.csw to pkg-get.confrcxLinux联盟
Installation of <CSWpkgget> was successful.rcxLinux联盟
rcxLinux联盟
root:/usr/local/src# cd /
rcxLinux联盟
root:/#

4.       检查是否安装好 pkg-get wget的位置 rcxLinux联盟
root:/#
which pkg-get
rcxLinux联盟
/opt/csw/bin/pkg-getrcxLinux联盟
root:/# which wget
rcxLinux联盟
/usr/sfw/bin/wget

5.       安装完整的 wget 软件rcxLinux联盟
root:/# pkg-get -i wgetrcxLinux联盟
注意:将会出现大量文字,不用担心,只要完成安装就可以。

6.       移除旧版本的 wgetrcxLinux联盟
root:/# cd /usr/sfw/bin
rcxLinux联盟
root:/usr/sfw/bin# mv wget wget.orig
rcxLinux联盟
root:/usr/sfw/bin# exit
rcxLinux联盟
# bash
rcxLinux联盟
# export PS1='\u:\w#'
rcxLinux联盟
root:/#

7.       检查wget新的位置是否正确rcxLinux联盟
root:/# which wget
rcxLinux联盟
/opt/csw/bin/wget

8.       检查 GNU Autoconf 的版本是否为 2.59 或以上rcxLinux联盟
root:/# which autoconf && autoconf --version | head -2
rcxLinux联盟
/opt/csw/bin/autoconfrcxLinux联盟
autoconf (GNU Autoconf) 2.59rcxLinux联盟
Written by David J. MacKenzie and Akim Demaille.rcxLinux联盟
如果不是为 2.59 或以上版本或根本没有这个程序,执行以下指令:rcxLinux联盟
root:/# pkg-get -i autoconf

9.       检查 GNU automake 的版本是否为 1.8.3 或以上rcxLinux联盟
root:/# which automake && automake --version | head -2
rcxLinux联盟
/opt/csw/bin/automakercxLinux联盟
automake (GNU automake) 1.8.3rcxLinux联盟
Written by Tom Tromey <tromey@redhat.com>.rcxLinux联盟
如果不是为1.8.3 或以上版本或根本没有这个程序,执行以下指令:rcxLinux联盟
root:/# pkg-get -i automake

10.    检查 GNU sed version 的版本是否为 4.1.4 或以上rcxLinux联盟
root:/# which gsed && gsed --version | head -2
rcxLinux联盟
/opt/csw/bin/gsedrcxLinux联盟
GNU sed version 4.1.4rcxLinux联盟
Copyright (C) 2003 Free Software Foundation, Inc.rcxLinux联盟
如果不是为 4.1.4 或以上版本或根本没有这个程序,执行以下指令:rcxLinux联盟
root:/# pkg-get -i gsed

11.    检查 gcc 的版本是否为 3.4.3 或以上rcxLinux联盟
root:/# which gcc && gcc --version | head -2
rcxLinux联盟
/usr/sfw/bin/gccrcxLinux联盟
gcc (GCC) 3.4.3 (csl-sol210-3_4-branch+sol_rpath)rcxLinux联盟
Copyright (C) 2004 Free Software Foundation, Inc.rcxLinux联盟
如果不是为 3.4.3 或以上版本或根本没有这个程序,执行以下指令:rcxLinux联盟
root:/# pkg-get -i gcc

12.    检查 GNU Make 的版本是否为 3.80 或以上rcxLinux联盟
root:/# which gmake && gmake --version | head -2
rcxLinux联盟
/usr/sfw/bin/gmakercxLinux联盟
GNU Make 3.80rcxLinux联盟
Copyright (C) 2002 Free Software Foundation, Inc.rcxLinux联盟
如果不是为 3.80 或以上版本或根本没有这个程序,执行以下指令:rcxLinux联盟
root:/# pkg-get -i gmake

13.    检查 flex version 的版本是否为 2.5.4 或以上rcxLinux联盟
root:/# which flex && flex --version | head -2
rcxLinux联盟
/usr/sfw/bin/flexrcxLinux联盟
flex version 2.5.4rcxLinux联盟
如果不是为 2.5.4 或以上版本或根本没有这个程序,执行以下指令:rcxLinux联盟
root:/# pkg-get -i flex

14.    检查 GNU Bison 的版本是否为 1.875 或以上rcxLinux联盟
root:/# which bison && bison --version | head -2
rcxLinux联盟
/usr/sfw/bin/bisonrcxLinux联盟
bison (GNU Bison) 1.875rcxLinux联盟
Written by Robert Corbett and Richard Stallman.rcxLinux联盟
如果不是为 1.875 或以上版本或根本没有这个程序,执行以下指令:rcxLinux联盟
root:/# pkg-get -i bison

15.    检查 GNU M4 的版本是否为 1.4.3 或以上rcxLinux联盟
root:/# which gm4 && gm4 --version | head -2
rcxLinux联盟
/opt/csw/bin/gm4rcxLinux联盟
GNU M4 1.4.3rcxLinux联盟
Written by Rene' Seindal.rcxLinux联盟
如果不是为 1.4.3 或以上版本或根本没有这个程序,执行以下指令:rcxLinux联盟
root:/# pkg-get -i gm4

16.    检查 Perl 的版本是否为 5.8 或以上rcxLinux联盟
root:/# which perl && perl -v | head -2
rcxLinux联盟
/usr/bin/perl rcxLinux联盟
This is perl, v5.8.4 built for i86pc-solaris-64intrcxLinux联盟
如果不是为 5.8 或以上版本或根本没有这个程序,执行以下指令:rcxLinux联盟
root:/# pkg-get -i perl

17.    检查 GNU zip 的版本是否为 1.3.3 或以上rcxLinux联盟
root:/# which gunzip && gunzip -V | head -2
rcxLinux联盟
/usr/bin/gunziprcxLinux联盟
gunzip 1.3.3-patch.1rcxLinux联盟
(2002-03-08) rcxLinux联盟
如果不是为 1.3.3 或以上版本或根本没有这个程序,执行以下指令:rcxLinux联盟
root:/# pkg-get -i gunzip

18.    检查 GNU tar 的版本是否为 1.14 或以上rcxLinux联盟
root:/# which gtar && gtar --version | head -2
rcxLinux联盟
/usr/sfw/bin/gtarrcxLinux联盟
tar (GNU tar) 1.14rcxLinux联盟
Copyright (C) 2004 Free Software Foundation, Inc.rcxLinux联盟
如果不是为 1.14 或以上版本或根本没有这个程序,执行以下指令:rcxLinux联盟
root:/# pkg-get -i gtar

19.    安装 libxml2 版本 2.6.23rcxLinux联盟
在安装 libxml2 之前有一点要特别注意,这程序不可以安装在需要 mount Driver 上。
rcxLinux联盟
因为,在启动 Solaris 时,当执行自动启动 Apache/php 时需要直接使用 libxml2,但这个时候,mount Driver 是还未启动的。rcxLinux联盟
很多时候,都有习惯把 /usr/local 放在 mount driver 上。如果你也有这个习惯,请特别注意,不要把 libxml2 安装在 /usr/local 上。 rcxLinux联盟
否则,当 Solaris 从启后, Apache/php 便不能自动启动,只能人手启动了。 rcxLinux联盟
在正常情况下,安装 libxml2,安装程序的预设安装路径为 /usr/local 这个安装路径是可以更改的。rcxLinux联盟
以下例子,将会把 libxml2 安装在 /usr/slocal 上。 rcxLinux联盟
root:/#
cd /usr/local/src
rcxLinux联盟
root:/usr/local/src# wget ftp://xmlsoft.org/libxml2/libxml2-2.6.23.tar.gz
rcxLinux联盟
...rcxLinux联盟
root:/usr/local/src# mkdir /usr/slocal
rcxLinux联盟
root:/usr/local/src# cp libxml2-2.6.23.tar.gz /usr/slocal
/rcxLinux联盟
root:/usr/local/src# cd /usr/slocal
rcxLinux联盟
root:/usr/slocal# gunzip -cd libxml2-2.6.23.tar.gz | gtar xvpf -
rcxLinux联盟
...rcxLinux联盟
root:/usr/slocal# cd libxml2-2.6.23
rcxLinux联盟
root:/usr/slocal/libxml2-2.6.23# ./configure --prefix=/usr/slocal
rcxLinux联盟
...rcxLinux联盟
root:/usr/slocal/libxml2-2.6.23# gmake
rcxLinux联盟
...rcxLinux联盟
root:/usr/slocal/libxml2-2.6.23# gmake install

20.    如果系统中没有这个档案 /etc/apache2/httpd.conf rcxLinux联盟
root:/# cp /etc/apache2/httpd.conf-example /etc/apache2/httpd.conf
编辑 /etc/apache2/httpd.conf

§         设定你所需要的 ServerName 服务器名称,预设为 127.0.0.1

§         ServerAdmin 设定正确的 E-mail 地址

21.    下载最新版本的 PHP ( http://www.php.net/downloads.php )rcxLinux联盟
root:/#
cd /usr/local/src
rcxLinux联盟
root:/usr/local/src# wget http://hk.php.net/get/php-5.1.2.tar.gz/from/this/mirror
rcxLinux联盟
...rcxLinux联盟
root:/usr/local/src# cp php-5.1.2.tar.gz ..
rcxLinux联盟
root:/usr/local/src# cd ..
rcxLinux联盟
root:/usr/local# gunzip -cd php-5.1.2.tar.gz | gtar xvpf -
rcxLinux联盟
...rcxLinux联盟
root:/usr/local# cd php-5.1.2
rcxLinux联盟
root:/usr/local/php-5.1.2# ./configure --with-apxs2=/usr/apache2/bin/apxs \rcxLinux联盟
--with-mysql=/usr/sfw/ --enable-dbase --with-libxml-dir=/usr/slocal \rcxLinux联盟
--with-config-file-path=/etc/apache2 --with-gd-dir=/opt/sfw/bin \rcxLinux联盟
--with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib --with-zlib --enable-mbstring
rcxLinux联盟
...rcxLinux联盟
root:/usr/local/php-5.1.2# gmake
rcxLinux联盟
...rcxLinux联盟
root:/usr/local/php-5.1.2# gmake install
  

     Installing PHP SAPI module:      ....................

 

root:/usr/local/php-5.1.2# cp php.ini-dist /etc/apache2/php.ini rcxLinux联盟
root:/usr/local/php-5.1.2#

22.    进入 apache2 设定文件目录rcxLinux联盟
root:/usr/local/php-5.1.2# cd /etc/apache2
rcxLinux联盟
root:/etc/apache2#

23.    如果要设定其它 php 的选项,请编辑 /etc/apache2/php.ini

24.    编辑 httpd.conf 文件rcxLinux联盟
安装完 php 后,php 会在 /etc/apache2/httpd.conf 内加入以下句子,请检查清楚,这句子是否存在:rcxLinux联盟
LoadModule php5_module libexec/libphp5.so
rcxLinux联盟
请在 /etc/apache2/httpd.conf 的最后一行手动加入以下句子:
 rcxLinux联盟
AddType application/x-httpd-php .php

25.