- 论坛徽章:
- 0
|
环境:Solaris9 for sparc Apache2+PHP+Mysql+”discuz论坛”
软件:
.tar.gz的文件包可以进行编译,测试中途是否出错,
.gz是的直接用pkgadd来安装,
以下软件我都放在/test目录下
httpd-2.0.61.tar.gz (www.apache.org)
mysql-5.0.41.tar.gz
php-4.4.5.tar.gz
Discuz!_5.5.0_SC_GBK.zip (www.discuz.net可以下载winddow版本的.rar,然后改成.zip或把rar的解压在ftp到solaris里,)
所需安装的软件包括:
bison-1.875d-sol9-sparc-local.gz
perl-5.8.5-sol9-sparc-local.gz
ncurses-5.4-sol9-sparc-local.gz
autoconf-2.59-sol9-sparc-local.gz
automake-1.9-sol9-sparc-local.gz
make-3.80-sol9-sparc-local.gz
zlib-1.2.1-sol9-sparc-local.gz
gcc-3.3.2-sol9-sparc-local.gz
libiconv-1.11-sol9-sparc-local.gz(不安装此软件的话,gcc不能正常编译
为了测试gcc是否能正常编译可以用以下方法测试:
#vi main.c
main.c的内容是:
#include <stdio.h>
int main(int argc, char **argv)
{
printf("hello world\n");
}
#gcc -o test main.c
#./test
hello world
)
上述软件可以从http://www.sunfreeware.com/或
http://ftp.iasi.roedu.net/mirrors/ftp.sunfreeware.com/pub/freeware/sparc/5.9/ 下载
----------------------------------------------------------------------------------------
一 修改路径
vi /etc/profile
在最后写入:
PATH=$PATH:/usr/ccs/bin:/usr/local/lib:/usr/local/bin:/usr/lib:/usr/local/apache2/bin:/usr/local/mysql/share/mysql:/usr/local/mysql/bin
CC=gcc
CFLAGS="-O6"
CXX=gcc
CXXFLAGS="-O6 -felide-constructors -fno-exceptions -fno-rtti"
保存退出
执行. /etc/profile
使修改立即生效。
二 安装
1.# gunzip zlib(后面省略)
2.#gunzip autoconf
3.#gunzip automake
4.#gunzip gcc
5.#gunzip libiconv
6.#gunzip bison
7.#gunzip perl
8.#pkgadd -d autoconf
9.#pkgadd -d automake
10.#pkgadd -d gcc
11.#pkgadd -d libiconv
12.#pkgadd -d bison
13.#pkgadd –d perl
14.#pkgadd –d zlib
15.#gunzip make
16.#pkgadd -d make
17.#gunzip ncurses
18.#pkgadd -d ncurses
----------------------------------------------------------------------------------
安装Mysql
1.#gunzip mysql-5.0.41.tar.gz
2.#tar -xvf mysql-5.0.41.tar
3.#cd mysql-5.0.41
(具体安装方法也可以参考mysql安装包里的文件,如下:
4.#more INSTALL-SOURCE
......
The basic commands that you must execute to install a MySQL source
distribution are:
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -
shell> cd mysql-VERSION
shell> ./configure --prefix=/usr/local/mysql
shell> make
shell> make install
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> cd /usr/local/mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> bin/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql var
shell> bin/mysqld_safe --user=mysql &(启动数据库)
......)
5.#chown -R root /usr/local/mysql
6.#chgrp -R mysql /usr/local/mysql
7.#chown -R mysql /usr/local/mysql/var
8.#chmod 777 /usr/local/mysql/lib/mysql/libmysqlclient.a
9.#cd /test/mysql-5.0.41
10.#cp support-files/my-medium.cnf /etc/my.cnf
11.#cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld
# 设置引导文件
12.#cd /etc/rc3.d
13.# ln -s ../init.d/mysqld S90mysql
14.# ln -s ../init.d/mysqld K90mysql
15.#ln -s /usr/local/mysql/include/mysql /usr/include/mysql
16.#ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
17.#echo /usr/lib/mysql >> /etc/ld.so.conf
# 启动数据库
31.#cd /usr/local/mysql/bin
32.#./mysqld_safe --user=mysql &
33.把libgcc包中所有的文件从/usr/local/lib拷贝到/usr/lib中,其中包含
libgcc_s.so
libstdc++.la
libstdc++.so.5.0.5
libgcc_s.so.1
libstdc++.so
libstdc++.so.5.0.1
libstdc++.a
libstdc++.so.5
libstdc++.so.5.0.2
34.#/etc/init.d/mysqld stop
35.#/etc/init.d/mysqld start
36.新安装mysql是要设置password的,
# /usr/local/mysql/bin/mysqladmin -u root password 123456
# cp /usr/local/lib/libncurses.so.5 /usr/local/mysql/lib/mysql
登录mysql数据库
# /usr/local/mysql/bin/mysql -uroot -p123456 (123456是默认数据库的密码,回车后直接进入mysql控制台)或
#/usr/local/mysql/bin/mysql -uroot -p
ENTER PASSWORD:
输入123456回车后进入mysql控制台.
(注:#/usr/local/mysql/bin/mysql -uroot -p ,-u和root有没有空格都行,
-p和123456之间没有密码则直接进入默认数据库,
若有空格的话,则提示
bash-2.05# /usr/local/mysql/bin/mysql -u root -p 123456
Enter password:
ERROR 1049 (42000): Unknown database '123456')
-----------------------------------------------------------------------------------------------------
有的是先装php后装apache,据说错误会少一些,笔者是先装的apache后装的php。
安装Apache
1.#gunzip httpd-2.0.61.tar.gz
2.#tar -xvf httpd-2.0.61.tar
3.#cd httpd-2.0.61
4.# ./configure --disable-nls --with-ld=/usr/ccs/bin/ld --with-as=/usr/c
cs/bin/as --prefix=/usr/local/apache2 --with-charset=gb2312 --with-extra-charsets
=all --with-config-file-path=/usr/local/apache2/conf --enable-so --enable-track-vars --enable-cgi --disable-nls
5.#make
6.#make install
修改配置文件:
7.vi /usr/local/apache2/conf/httpd.conf
将Group #-1改为Group nobody
#ServerName www.example.com:80
ServerName 135.252.160.51(笔者server的IP是135.252.160.51,添加完整的主机名也可以,如:dove.ans.lucent.com)
找到#AddType application/x-tar .tgz 这行,在下面加一行。前面不要加#号。
AddType application/x-httpd-php .php
找到下面一行在后面加上index.php,这表示网站的默认页也能够为index.php
DirectoryIndex index.html index.html.var index.php
---------------------------------------------------------------------------------------------------
安装PHP
1. #gunzip php-4.4.5.tar.gz
2. #tar -xvf php-4.4.5.tar
3. #cd php-4.4.5
4. #./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/httpd/bin/apxs --enable-track- vars --enable-force-cgi-redirect --with-config-file-path=/usr/local/php/etc
5. make
6. makeinstall
编译PHP
6. # vi /usr/local/apache2/conf/httpd.conf
#Add PHP as a application type
AddType application/x-httpd-php .php .php3 .phtml
AddType application/x-httpd-php-source .phps
# Add this line for PHP module
LoadModule php4_module modules/libphp4.so
47. #vi /usr/local/httpd/htdocs/index.php
写入:<? phpinfo(); ?>;
#chmod 755 index.php
#apachectl start
然后在IE中输入ip,测试一下是否成功了。
http://ip/index.php
---------------------------------------------------------------------------------------------------
安装论坛
将下载下来的包中discuz目录下的文件解压并考到APACHE的网页根目录
1. #unzip discuz.zip//在windows下将.rar格式改为.zip格式
或在 windows下解压后上传到server上也行,上传的目录是/usr/local/apache2/htdocs/bbs
2.将以下目录属性改为777。
./templates
./templates/default
./templates/default/*.*
./attachments
./customavatar
./forumdata
./forumdata/cache
./forumdata/template
3.在mysql中创建一个数据库discuz: (要将discuz.sql导入数据库discuz)
#/usr/local/mysql/bin/mysql -uroot -p
ENTER PASSWORD:
输入123456回车后进入mysql控制台.
mysql>create database discuz;
Mysql>use discuz;//转到discuz这个数据库上
Mysql>source /usr/local/apache2/htdocs/install/discuz.sql;// 将discuz.sql导入数据库discuz
Mysql>grant create,drop,select,insert,update,delete on discuz.* to admin@localhost Identified by "123456";//给discuz数据库
ctl+d退出控制台。
4.重启一下APACHE:
#/usr/local/apache2/bin/apachectl stop
#/usr/local/apache2/bin/apachectl start
5.配置好config.php文件里的相关信息,
$dbhost = ''; // 数据库服务器^M
$dbuser = 'root'; // 数据库用户名^M
$dbpw = '123456'; // 数据库密码^M
$dbname = 'angel'; // 数据库名^M
$adminemail = '4ngel@21cn.com'; // 论坛系统 Email^M
修改discuz字符集 (否则安装discuz时会报错:database_errno_1115 )
$dbcharset = 'latin1'; // MySQL 字符集, 可选 'gbk',
重起数据库
#/etc/init.d/mysqld restart
在IE地址栏输入:http://ip/bbs/index.php
出现论坛,
望各高手指点。 |
|