由 optix 在 01-14-2004 11:50 发表:
【原创】redhat AS 3下pgsql7.41-MYSQL4.0.17-php4.3.4-APACHE1.3.29-gd2.0.20安装。
前提mysql,pgsql,apache都是安装到/usr/local/mysql,/usr/local/pgsql,/usr/local/apache目录。
详细过程如下。稍后会放出支持java的全部过程。
--------------------------------
1.安装 PostgreSQL
useradd postgres (自动建立 postgres组)password:sqlpostgre
tar xvfz postgresql-7.4.1.tar.gz
cd postgresql-7.4.1
./configure --prefix=/usr/local/pgsql --enable-multibyte=EUC_CN(支持双字节)
make
make install
chown -R postgres.postgres /usr/local/pgsql
这样安装完毕后,并不是万事大吉了,还有一些收尾工作要做:
vi ~postgre/.bash_profile
添加:
PGLIB=/usr/local/pgsql/lib
PGDATA=/usr/local/pgsql/data
PATH=$PATH:/usr/local/pgsql/bin
export PGLIB PGDATA PATH
以 postgres 用户登录,
su - postgres
建立数据库目录:
$cd /usr/local/pgsql
$ mkdir data
启动数据库引擎:
$ initdb
出现如下字样就是好了。
/usr/local/pgsql/bin/postmaster -D /home/postgre/data
or
/usr/local/pgsql/bin/pg_ctl -D /home/postgre/data start
然后启动pgsql
$ postmaster -i -D ~/data &
使用脚本来使数据库服务器随系统启动而自动启动。在PostgreSQL的源码包的contrib/start-scripts目录下面我们可以看到freebsd linux PostgreSQL.darwin StartupParameters.plist.darwin 4个文件,这些文件时用来作为系统启动脚本的,在这里我们用linux来做说明。
在这里的操作使用你编译PostgreSQL数据库时的用户身份。
cd $HOME/src/postgresql-7.4/contrib/start-scripts
su //切换到root用户
cp linux /etc/rc.d/init.d/postgres //把linux改名为postgres拷贝到系统的启动脚本的目录。
cd /etc/rc.d/init.d
使用你熟习的编辑器来编辑postgres启动脚本。
29 ## EDIT FROM HERE
30
31 # Installation prefix
32 prefix=/usr/local/pgsql
33
34 # Data directory
35 PGDATA="/usr/local/pgsql/data"
36
37 # Who to run pg_ctl as, should be "postgres".
38 PGUSER=postgres
39
40 # Where to keep a log file
41 PGLOG="$PGDATA/serverlog"
42
43 ## STOP EDITING HERE
在这里我们要修改prefix,PGDATA,PGUSER的值,prefix就是我们在configure源码时指定的prefix,PGDATA就是我们initdb命令-D参数指定的路径,PGUSER是我们用来启动数据库服务器的用户。
chmod +x postgres //使脚本具有可执行权限
#echo "/etc/rc.d/init.d/postgres start > /dev/null &" >> /etc/rc.d/rc.local
然后修改我在/usr/local/pgsql/data/postgresql.conf里面将
tcpip_socket=false改成了
tcpip_socket=true了。
port=5632的注释去掉。
再修改pg_hba.conf里是远端的机器有权限登陆
然后在pg_hba.conf里面添加了本机的IP和此用户,数据库名。
2.安装mysql
#cd /data/server_soft
#tar -xvzf mysql-4.0.17.tar.gz
#groupadd mysql
#useradd -g mysql mysql
#cd mysql-4.0.14
#./configure --prefix=/usr/local/mysql --with-berkeley-db --with-innodb --without-docs --with-charset=latin1 --with-extra-charsets=gb2312
#make
#make install
#cd /usr/local/mysql/bin
#./mysql_install_db
#chown -R root /usr/local/mysql
#chown -R mysql /usr/local/mysql/var
#chgrp -R mysql /usr/local/mysql
#cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
#/usr/local/mysql/bin/mysqld_safe --user=mysql &
---------------------------------------------------------------------
//修改mysql中root用户密码
#./mysql
>show databases;
>use mysql
>update user set password=password("123456") where user="root";
>flush privileges;
>exit;
//修改完毕
---------------------------------------------------------------------
安装完毕后,需要把MySQL 库加入系统,采用ldconfig 命令来实现:
#echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf
#ldconfig -v | grep libmysqlclient
然后可以看到系统返回:
libmysqlclient.so.10 => libmysqlclient.so.10.0.0
让MySQL 在启动时自动运行:
#echo "/usr/local/mysql/bin/mysqld_safe > /dev/null &" >> /etc/rc.d/rc.local
3.安装apache
进入Apache 的源代码目录: (DSO方式)
#cd /data/server_soft/apache_1.3.29
#./configure --prefix=/usr/local/apache --enable-module=so --enable-shared=max
make
make install
修改 /usr/local/apache/conf/httpd.conf 如下两行
AddType application/x-httpd-php .php
DirectoryIndex index.html index.php
重新启动 Apache:
让apache在启动时自动运行:
#echo "/usr/local/apache/bin/apachectl start > /dev/null &" >> /etc/rc.d/rc.local
4.gd安装过程
a.安装zlib
tar zxvf zlib-1.1.3.tar.gz
cd zlib-1.1.3
./configure
make
make test
make install
b.安装libpng support
tar zxvf libpng-1.0.12.tar.gz
cd libpng-1.0.12
cp scripts/makefile.linux makefile
vi makefile
修改其中参数
ZLIBLIB=/usr/local/lib
ZLIBINC=/usr/local/include
make test
make install
c.安装jpeg-6b
tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure
make
make test
make install
make install-lib
d.安装freetype2
tar zxvf freetype-2.1.5.tar.gz
cd freetype-2.1.5
make setup
make
make install
e.安装gd
tar zxvf gd-2.0.20.tar.gz
./configure(或许加上参数--with-png=DIR等详见gd的R