magicliunx2.1 rc2安装mysql5.0.67 apache2.2.9 php4.4.9
1、首先是安装MySQLMySQL的安装相对比较复杂,我选择用http://dev.mysql.com/downloads/mysql/5.0.html#source文件来自动安装,这样减少了很多容易犯错的机会。
(1)下载mysql5.0.67.tar.gz
http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.67.tar.gz/from/http://mysql.cdpa.nsysu.edu.tw/
(2)#tar zxvf mysql-5.0.67.tar.gz
#cd mysql-5.0.67
#groupadd mysql
#useradd -g mysql mysql
#./configure –prefix=/usr/local/mysql
#make
#make install
# ln -s /usr/local/mysql/bin/* /usr/local/bin/
#cd /usr/local/mysql
#script/mysql_install_db –user=mysql (初始化数据库)
#chgrp -R mysql * (更改文件或目录的组所有权)
#bin/mysqld_safe –user=mysql & (启动mysql服务)
#/usr/local/mysql/bin/mysqladmin -u root password ‘123456′?(将root密码改为123456)
#/usr/local/mysql/bin/mysql -u root -p
#password ******
mysql>show databases;(测试,如果出现默认数据库,则成功)
错误!
出现ERROR 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
一般这样 # rm -fr /var/lib/mysql/*
# rm /var/lock/subsys/mysql
# killall mysqld
# service mysql start
2、安装apache2.2.9
安装Apache就简单多了,去http://httpd.apache.org/download.cgi 下载httpd-2.2.9.tar.gz
到/tmp目录。
在/tmp目录内,输入:
gunzip httpd-2.2.9.tar.gz
tar -xvf httpd-2.2.9.tar
将会在/tmp目录下新建一个httpd-2.2.9目录。移动整个目录到/usr/local/src下
mv /tmp/httpd-2.2.9 /usr/local/src/httpd-2.2.9目录
cd /usr/local/src/httpd-2.2.9
好了,我们好开始安装了:
./configure \
--prefix=/usr/local/apache \
--enable-shared=max \
--enable-modulerewrite \
--enable-module=so 执行以上指令,应该没有错误信息。--prefix=/usr/local/apache表示我们要把apache安装到/usr/local/apache目录下。
make
用make来编译。
make install
安装apache。
安装成功后,apache将存放在/usr/local/apache下。
3、安装php4.4.9
同理,先要下载PHP。去http://www.php.net/downloads.php 下载PHP 4.4.9(tar.gz) source
code (注意不是binary)。下载到/tmp目录下。
gunzip php-4.4.9.tar.gz
tar -xvf php-4.4.9.tar
将新建的php-4.4.9目录移到/usr/local/src目录下。切换到/usr/local/src/php-4.4.9目录
cd /usr/local/src/php-4.4.9
下面,我们要把php安装成apache的一个module。
./configure
--with-apxs2=/usr/local/apache/bin/apxs
--enable-ftp
--enable-inline-optimization
--enable-safe-mode
--enable-track-vars
--enable-trans-sid
--enable-xml
--with-mysql
--with-xml
应该没有错误信息。
make
make install
安装完毕。copy
/usr/local/src/php-4.4.9/php.ini-dist到/usr/local/lib/,并重命名为php.ini
cp /usr/local/src/php-4.4.9/php.ini-dist /usr/local/lib/php.ini
安装成功。下面要配置一下apache。
cd /usr/local/apache/conf
vi httpd.conf
在httpd.conf文件中,添加
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
应该将以上两句添加在其他AddType之后。
确保文件中有以下一句话,没有就自己添加在所有LoadModule之后。
LoadModule php4_modulemodules/libphp4.so
好了,":wq"保存httpd.conf文件,退出vi。启动apache server:
/usr/local/apache/bin/apachectl start
如果你想让你的apache每次系统reboot后都自动启动,你可以这样做:
cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd
vi /etc/rc.d/init.d/httpd
在httpd文件的第三行,插入以下两句话:
# chkconfig: 345 85 15
# description: Starts and stops the Apache HTTP Server.
":wq"保存httpd文件,退出vi。
把httpd变成可执行文件:
chmod +x /etc/rc.d/init.d/httpd
将httpd加入service列表:
chkconfig --add httpd
查看一下httpd是否加入到service 列表中
chkconfig --list
成功后,你可以用service httpd start, service httpd restart, service httpd
stop来启动、重启、和终止httpd service (httpd service 就是 apache service)。
好了,所有安装都完成了,下面测试一下PHP和apache。
测试PHP和Apache
在/usr/local/apache/htdocs目录下,新建一个test.php文件,文件中只有一句话:
<? phpinfo() ;?>
保存此文件。
在你的浏览器中输入http://localhost,你应该看到apache的欢迎页面。
在你的浏览器中输入http://localhost/test.php,你应该看到PHP的系统信息。
我安装成功的信息(20080927凌晨)
System Linux Nxjswt 2.6.25.16-smp #1 SMP Thu Aug 21 10:39:41 CST 2008 i686
Build Date Sep 26 2008 23:30:13
Configure Command './configure' '--with-apxs2=/usr/local/apache/bin/apxs' '--enable-ftp' '--enable-inline-optimization' '--enable-safe-mode' '--enable-track-vars' '--enable-trans-sid' '--enable-xml' '--with-mysql' '--with-xml'
Server API Apache 2.0 Handler
Virtual Directory Support disabled
Configuration File (php.ini) Path /usr/local/lib/php.ini
PHP API 20020918
PHP Extension 20020429
Zend Extension 20050606
Debug Build no
Zend Memory Manager enabled
Thread Safety disabled
Registered PHP Streams php, http, ftp
Finally, 俺们的灯泡 (L.A.M.P.) 终於安装成功了。恭喜!
[ 本帖最后由 lqjs 于 2008-9-28 23:45 编辑 ] 还不错,但是注意mysql的处理,# rm -fr /var/lib/mysql/* 这一句慎用,如果以前安装过mysql一句会造成原来的数据全部丢失。
# rm -fr /var/lib/mysql/*
# rm /var/lock/subsys/mysql
# killall mysqld
# service mysql start
这四句的执行顺序改成
# killall mysqld
# rm -fr /var/lib/mysql/*
# rm /var/lock/subsys/mysql
# service mysql start
比较妥当 凡是prefix不是/usr或者/usr/local的一律鄙视100遍! 哪抄来的旧文章,我早不用apache,而使用lighttpd,因为lighttpd更符合一个服务器编程调试平台或小型内部网络的需要,apache则适用于工作的服务器。 肯定是抄的,这点没跑。 鼓励一下,magic的人气需要大家来保持! :lol: :lol: 实事求是的讲,是合成了几个文章加上我自己的工作实际。
贴上我的mysql err文件!
支持magic liunx!!!
080927 07:55:06mysqld started
nohup: ignoring input
0809277:55:06 option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
0809277:55:06 option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
0809277:55:06 option 'thread_stack': unsigned value 65536 adjusted to 131072
0809277:55:07InnoDB: Started; log sequence number 0 43655
0809277:55:07 /usr/local/mysql/libexec/mysqld: ready for connections.
Version: '5.0.67'socket: '/usr/local/mysql/mysql.sock'port: 13309Source distribution
Status information:
Current dir: /usr/local/mysql/var/
Running threads: 0Stack size: 131072
Current locks:
lock: 0x892cac4:
lock: 0x8918534:
lock: 0x891d98c:
Key caches:
default
Buffer_size: 16384
Block_size: 1024
Division_limit: 100
Age_limit: 300
blocks used: 0
not flushed: 0
w_requests: 0
writes: 0
r_requests: 0
reads: 0
handler status:
read_key: 0
read_next: 0
read_rnd 0
read_first: 3
write: 0
delete 0
update: 0
Table status:
Opened tables: 12
Open tables: 3
Open files: 6
Open streams: 0
Alarm status:
Active alarms: 0
Max used alarms: 1
Next alarm time: 0
0809278:04:57 /usr/local/mysql/libexec/mysqld: Normal shutdown
0809278:04:57InnoDB: Starting shutdown...
0809278:04:58InnoDB: Shutdown completed; log sequence number 0 43655
0809278:04:58 /usr/local/mysql/libexec/mysqld: Shutdown complete
Memory status:
Non-mmapped space allocated from system: 4251648
Number of free chunks: 15
Number of fastbin blocks: 0
Number of mmapped regions: 8
Space in mmapped regions: 13729792
Maximum total allocated space: 0
Space available in freed fastbin blocks: 0
Total allocated space: 4148848
Total free space: 102800
Top-most, releasable space: 86848
Estimated memory (with thread stack): 17981440
:mrgreen: :mrgreen: 昨天晚上整到凌晨2点,同志们要厚道!!!
继续贴俺的mysql err
80926 22:27:41mysqld started
nohup: ignoring input
080926 22:27:41 option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
080926 22:27:41 option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
080926 22:27:41InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'create'.
InnoDB: Cannot continue operation.
080926 22:27:41mysqld ended
080926 22:30:10mysqld started
nohup: ignoring input
080926 22:30:10 option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
080926 22:30:10 option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
080926 22:30:10InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'create'.
InnoDB: Cannot continue operation.
080926 22:30:10mysqld ended
080926 22:39:02mysqld started
nohup: ignoring input
080926 22:39:02 option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
080926 22:39:02 option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
080926 22:39:02InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'create'.
InnoDB: Cannot continue operation.
080926 22:39:02mysqld ended
080926 22:44:27mysqld started
nohup: ignoring input
080926 22:44:27 option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
080926 22:44:27 option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
080926 22:44:27InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
080926 22:44:28InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
080926 22:44:28InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
080926 22:44:29InnoDB: Started; log sequence number 0 0
080926 22:44:29 /usr/local/mysql/libexec/mysqld: ready for connections.
Version: '5.0.67'socket: '/tmp/mysql.sock'port: 3306Source distribution
A mysqld process already exists at五 9月 26 22:48:43 CST 2008
0809270:16:09 /usr/local/mysql/libexec/mysqld: Normal shutdown
0809270:16:10InnoDB: Starting shutdown...
0809270:16:10InnoDB: Shutdown completed; log sequence number 0 43655
0809270:16:10 /usr/local/mysql/libexec/mysqld: Shutdown complete
080927 00:16:10mysqld ended
080927 00:32:05mysqld started
nohup: ignoring input
0809270:32:05 option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
0809270:32:05 option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
0809270:32:06InnoDB: Started; log sequence number 0 43655
0809270:32:06 /usr/local/mysql/libexec/mysqld: ready for connections.
Version: '5.0.67'socket: '/tmp/mysql.sock'port: 3306Source distribution
A mysqld process already exists at六 9月 27 00:32:27 CST 2008
A mysqld process already exists at六 9月 27 00:36:30 CST 2008
0809270:56:14 /usr/local/mysql/libexec/mysqld: Normal shutdown
0809270:56:14InnoDB: Starting shutdown...
0809270:56:14InnoDB: Shutdown completed; log sequence number 0 43655
0809270:56:14 /usr/local/mysql/libexec/mysqld: Shutdown complete
080927 00:56:14mysqld ended
080927 07:55:06mysqld started
[ 本帖最后由 lqjs 于 2008-9-27 20:55 编辑 ] 呵呵,支持。这个东西肯定要参考其它人的。
不过对magic来讲,本来应该是使用仓库的更好,可惜没时间打包和测试了。 谢谢版主,再补充点。。。
找到my.cnf配置文件
如果/etc/目录下没有my.cnf配置文件,请到/usr/share/mysql/下找到*.cnf文件,拷贝其中一个到/etc/并改名为my.cnf)中。命令如下:
# cp /usr/share/mysql/my-medium.cnf /etc/my.cnf
编辑MySQL的配置文件/etc/my.cnf
为保证MySQL能够正常工作,需要指明mysql.sock文件的产生位置。修改socket=/var/lib/mysql/mysql.sock一行中等号右边的值为: /usr/local/mysql/mysql.sock 。操作如下:
vi my.cnf (用vi工具编辑my.cnf文件,找到下列数据修改之)
# The MySQL server
port = 3306
#socket = /var/lib/mysql/mysql.sock(原内容,为了更稳妥用“#”注释此行)
socket = /usr/local/mysql/mysql.sock (加上此行)
修改MySQL启动脚本/etc/init.d/mysql
最后,需要修改MySQL启动脚本/etc/init.d/mysql,把其中datadir=/var/lib/mysql一行中,等号右边的路径改成你现在的实际存放路径: /usr/local/mysql。 其实这个过程可以用脚本或者用打包的方式进行,比这样的文章要精准的多。 mysql加入
chown -R mysql.mysql /usr/local/mysql
chown -R mysql.mysql /var/lib/mysql
mysql加入自动启动
#cp support-files/mysql.server /etc/rc.d/init.d/mysqld
# chkconfig --add mysqld
# chkconfig --level 345 mysqld on
# chkconfig --list mysqld
:mrgreen:
页:
[1]