PM包和源码包存放位置 /root MySQL 数据库位置 /opt/mysql Apache 网站根目录 /opt/www 1. 使用 yum 程序安装所需开发包(以下为标准的 RPM 包名称) # yum install gcc gcc-c gcc-g77 flex bison autoconf automake bzip2-devel zlib-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel libxml-devel 这里我们将编译GD所必须的一些小软件比如libpng,libtiff,freetype,libjpeg等先用RPM的方式一并安装好,避免手动编译浪费时间,同时也能避免很多错误,这几个小软件的编译很麻烦。这几个小软件编译错误了,GD当然安装不了,php5的编译当然也没戏了。所以我们抓大放小,对这些小牛鬼蛇神采取快速简洁的方式进行安装。并且对服务器的性能也不能产生什么影响。 2.下载并解压mysql php apache源码程序 [root@localhost ~]#wget http://apache.mirror.phpchina.com/httpd/httpd-2.2.9.tar.gz [root@localhost ~]#wget http://download.mysql.cn/download_file/gz/5.0/mysql-5.0.22.tar.gz [root@localhost ~]#wget http://cn.php.net/distributions/php-5.2.6.tar.gz [root@localhost ~]#tar zxvf mysql* [root@localhost ~]#tar zxvf php* [root@localhost ~]#tar zxvf httpd* 安装mysql [root@localhost ~]# cd mysql* [root@localhost mysql-5.0.22]# ls //查看解压的文件 [root@localhost mysql-5.0.22]#vi INSTALL-SOURCE //查看安装详细步骤 [root@localhost mysql-5.0.22]# groupadd mysql [root@localhost mysql-5.0.22]#useradd -g mysql mysql [root@localhost mysql-5.0.22]#./configure --prefix=/opt/mysql5 [root@localhost mysql-5.0.22]#make [root@localhost mysql-5.0.22]#make install [root@localhost mysql-5.0.22]# cp support-files/my-medium.cnf /etc/my.cnf [root@localhost mysql-5.0.22]#cd /opt/mysql5 [root@localhost mysql5]#chown -R mysql . [root@localhost mysql5]#chgrp -R mysql . [root@localhost mysql5]#ll [root@localhost mysql5]#bin/mysql_install_db --user=mysql Installing all prepared tables Fill help tables To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /opt/mysql5/bin/mysqladmin -u root password 'new-password' /opt/mysql5/bin/mysqladmin -u root -h localhost.localdomain password 'new-password' See the manual for more instructions. You can start the MySQL daemon with: cd /opt/mysql5 ; /opt/mysql5/bin/mysqld_safe & You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory: cd sql-bench ; perl run-all-tests Please report any problems with the /opt/mysql5/bin/mysqlbug script! The latest information about MySQL is available on the web at http://www.mysql.com Support MySQL by buying support/licenses at http://shop.mysql.com [root@localhost mysql5]#chown -R root . [root@localhost mysql5]#chown -R mysql var [root@localhost mysql5]#ls -l [root@localhost mysql5]#bin/mysqld_safe --user=mysql & [2] 20152 [1] Exit 127 bin/mysql_safe --user=mysql [root@localhost mysql5]# Starting mysqld daemon with databases from /opt/mysql5/var [root@localhost mysql5]#ps -ef | grep mysql root 20152 3999 0 16:30 pts/0 00:00:00 /bin/sh bin/mysqld_safe --user=mysql mysql 20176 20152 0 16:30 pts/0 00:00:00 /opt/mysql5/libexec/mysqld --basedir=/opt/mysql5 --datadir=/opt/mysql5/var --user=mysql --pid-file=/opt/mysql5/var/localhost.localdomain.pid --skip-locking --port=3306 --socket=/tmp/mysql.sock [root@localhost mysql5]#pwd /opt/mysql5 [root@localhost mysql5]#ls [root@localhost mysql5]#bin/mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 to server version: 5.0.22-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> APACHE安装 [root@localhost ~]# cd httpd* [root@localhost httpd-2.2.9]#ls ****INSTALL**** [root@localhost httpd-2.2.9]#vi INSTALL //查看安装步骤。 [root@localhost httpd-2.2.9]#./configure –enable-so –prefix=/opt/www [root@localhost httpd-2.2.9]#make [root@localhost httpd-2.2.9]#make install [root@localhost httpd-2.2.9]#cd /opt/www [root@localhost www]# ll total 60 drwxr-xr-x 2 root root 4096 Sep 16 17:30 bin drwxr-xr-x 2 root root 4096 Sep 16 17:31 build drwxr-xr-x 2 root root 4096 Sep 16 17:30 cgi-bin drwxr-xr-x 4 root root 4096 Sep 16 17:30 conf drwxr-xr-x 3 root root 4096 Sep 16 17:30 error drwxr-xr-x 2 root root 4096 Jun 10 15:14 htdocs drwxr-xr-x 3 root root 4096 Sep 16 17:30 icons drwxr-xr-x 2 root root 4096 Sep 16 17:31 include drwxr-xr-x 4 root root 4096 Sep 16 17:30 lib drwxr-xr-x 2 root root 4096 Sep 16 17:30 logs drwxr-xr-x 4 root root 4096 Sep 16 17:31 man drwxr-xr-x 14 root root 12288 Jun 10 15:18 manual drwxr-xr-x 2 root root 4096 Sep 16 17:30 modules 测试apache [root@localhost www]# bin/apachectl start //启动APACHE 在浏览器地址栏中打192.168.75.132 出现:It works! 说明APACHE已经开始工作。 PHP安装: [root@localhost www]# bin/apachectl stop [root@localhost ~]#cd php* [root@localhost php-5.2.6]# ls ****INSTALL**** [root@localhost php-5.2.6]#vi INSTALL //查看安装步骤。 [root@localhostphp-5.2.6]#./configure–with-apxs2=/opt/www/bin/apxs –with-mysql=/opt/mysql5 [root@localhost php-5.2.6]#make [root@localhost php-5.2.6]#make test [root@localhost php-5.2.6]#make install [root@localhost php-5.2.6]# cp php.ini-dist /opt/www/lib/php.ini [root@localhost php-5.2.6]#cd [root@localhost ~]#cd /opt/www [root@localhost www]# ll [root@localhost www]# cd modules [root@localhost modules]# ls httpd.exp libphp5.so [root@localhost modules]# cd ../ [root@localhost www]# ls bin cgi-bin error icons lib man modules build conf htdocs include logs manual [root@localhost www]# cd conf [root@localhost conf]# ls extra httpd.conf.bak magic original httpd.conf httpd.conf.wxd8482-2008-09-16 mime.types [root@localhost conf]# vi httpd.conf LoadModule php5_module modules/libphp5.so 添加“AddType application/x-http-d-php .php .phtml”如下 AddType application/x-compress .Z AddType application/x-gzip .gz .tgz AddType application/x-httpd-php .php .phtml [root@localhost conf]#cd [root@localhost ~]# /opt/www/bin/apachectl start //启动APACHE [root@localhost ~]#cd /opt/www/htdocs [root@localhost htdocs]# vi test.php phpinfo(); ?> 在浏览器中敲入 192.168.75.135/test.php中可以看到PHP信息,说明安装完成。 |
|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )
GMT+8, 2024-9-30 05:34 , Processed in 0.150953 second(s), 12 queries , Gzip On, MemCache On.
Powered by Discuz! X3.5
© 2001-2023 Discuz! Team.