1) postgresql 安装
download www.postgresql.org
先添加组
groupadd postgresql
useradd -g postgresql postgresql
passwd postgresql
tar -zxvf postgresql-8.1.3.tar.gz
cd postgresql-8.1.3
./configure --prefix=/usr/local/pgsql --with-mb=EUC_CN
error readline library not found
./configure --prefix=/usr/local/pgsql --with-mb=EUC_CN --without-readline
make
make install
chown postgresql:postgresql /usr/local/pgsql
cd /usr/local/pgsql
mkdir data
chown postgresql:postgresql
编辑环境变量
vi /etc/bashrc
PATH="$PATH":/usr/local/pgsql/bin
export POSTGRES_HOME=/usr/local/pgsql
export PGLIB=$POSTGRES_HOME/lib
export PGDATA=$POSTGRES_HOME/data
export MANPATH="$MANPTH":$POSTGRES_HOME/man
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"$PGLIB"
环境变量生效
bash
su- postgresql
cd /usr/local/pgsql/bin
initdb -D /home/postgresql/data
postgresql start
pg_ctl start -D /home/postgresql/data
开机启动
vi /etc/rc.d/rc.local
添加 text
#需要的命令
COMM=/sur/local/pgsql/bin/pg_ctl
#数据库的位置
DBDIR=/home/postgresql/data
#启动的命令
PGSQLCOMM="$COMM start -D $DBDIR"
#系统启动的命令
su - postgresql -c "$PGSQLCOMM"
#输出命令,提示作用
echo $PGSQLCOMM
如果su出现问题,请把selinux关掉调试
配置文件在
vi /etc/sysconfig/selinux
修改
SELINUX=disabled
SELINUXTYPE=strict
重起调试
2个普通用户是否可以相互su
注意:
我犯的一个错误
当系统提示我不能使用su命令的时候,我去ls -l /bin/su 发现它的权限有问题,我就执行了chmod 755 /bin/su
这是个错误的错误
修改回去的命令是 chmod 711 /bin/su chmod u+s /bin/su
setuid 具体的作用我就不说了
好了postgresql 安装完毕了,我花费了一个星期的时间,看来人是比较笨的
2)mysql的安装
去mysql.org下载 现在很多的包都是编译好的,我不太习惯使用,或者说不会使用,
下载回来cp到相应目录执行./scripts/mysql_installdb --user=mysql 提示错误缺少一个lib*.so.5的文件,
我在我的系统中找到了,但是还是不能安装所以我放弃了
我下的是
mysql-5.0.19.tar.gz or
mysql-4.18.16.tar.gz 也有同样的问题 如果是定植安装的话,有可能提示错误
出现错误为
checking how to run the C++ preprocessor... /lib/cpp
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
这个错误是我们少装了一个gcc-c++ 的编译器。找个装上就可以了
gcc-c++ 4.0.08.rpm 可能有个依赖包,一起也装了
然后编译就可以了
./configure --prefix=/usr/local/mysql --exec-prefix=/usr/lcoal/mysql --with-extra-charsets=gb2312 --mandir=/usr/share/man
./mysql_install_db
./mysqld_safe --user=root &
cp ./mysql/support-files/my-menium.cnf /etc/my.cnf
3)apache2.0.55 安装
下载http://httpd.apache.org/download.cgi
tar -zxvf apache2
进入目录
./configure --prefix=/usr/local/apache --enable-shared=max --enable-module=rewrite --enable-module=so
make
make install
启动
cd /usr/local/apache/bin/apachectl start
开机启动
vi /etc/rc.d/rc.local
添加
/usr/local/apache/bin/apachectl start
然后127.0.0.1 看到测试页安装成功
4)gd库相关的软件安装
xpm
http://koala.ilog.fr/ftp/pub/xpm/ 找到了下载的地方但是安装不上,而且也没发觉现在还用这种格式
zlib
http://www.zlib.net/
下载解压安装
./configure
make
make install
freetype download
http://prdownloads.sourceforge.net/freetype/freetype-2.1.10.tar.gz?download
下载解压安装
./configure
make
make install
libpng
http://sourceforge.net/project/showfiles.php?group_id=5624
解压
cd libpng-1.2.7
cd scripts/
mv makefile.linux ../makefile
cd ..
make
make install
注意,这里的makefile不是用./configure生成,而是直接从scripts/里拷一个
jpegsrc
http://www.ijg.org/
ftp://ftp.uu.net/graphics/jpeg/
解压
cd jpeg-6b/
./configure --enable-shared //必须这样,要不无法建立库
make
make install
提示错误 ./libtool 找不到什么的
解决:
执行 whereis libtool 然后copy到 jpeg-6b目录下,因为他使用的是绝对目录
如果找不到,就安装一个
make test
make install
提示一个错误,无法建立/usr/local/man/man1/* 文件或者目录,自己去建立一个 mkdir /usr/local/man/man1
gd 安装
http://www.boutell.com/gd/
解压
进入目录
./configure --prefix=/usr/local/gd --exec-prefix=/usr/local/gd
--with-PACKAGE=yes --with-png --with-freetype --with-jpeg --with-zlib
make
make install
5)php5.1.2 安装
先执行./configure
提示ra2c 没有去
ra2c.org 下载
下载解压安装
./configure
make
make install
提示没有 bison
http://ftp.gnu.org/pub/gun/bison/ download
下载解压安装
./configure
make
make install
提示找不lex命令
去http://ftp.gnu.org/non-gnu/flex/
下载解压安装
./configure
make
make install
提示需要libxml2
http://ftp.gnome.org/pub/GNOME/sources/libxml2/
注意版本2.11以上
下载解压安装
./configure
make
make install
没有错误提示了,执行
./configure --with-apxs2=/usr/local/apache2/bin/apxs
--disable-debug --enable-ftp --enable-inline-optimization
--enable-bcmath --enable-safe-mode --enable-track-vars --enable-trans-sid
--enable-xml --with-mysql --with-pgsql --with-xml -with-freetype-dir=/usr
--with-png-dir=/usr --with-gd --enable-gd-native-ttf --with-ttf --with-jpeg-dir=/usr
--with-png --with-zlib-dir=/usr --enable-mbstring=cn
注意,里面有些东西要求你输入比较严格的目录 比如
--with-mysql=/usr/local/mysql/
--with-pgsql=/usr/local/pgsql/
--with-gd=/usr/local/gd/
cp php-5.1.2/php.ini-dist /usr/local/lib/php/php.ini
6)整合 apache 跟php
修改apche配置文件
vi /usr/local/apache/conf/httpd.conf
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
7)测试,重新启动apache
vi /usr/local/apache/htdocs/test.php
<?php
phpinfo();
?>
保存退出
在浏览器里输入
127.0.0.1/test.php
如果成功证明安装完毕