安装Fedora 7
我是使用Fedora 7 Live在VMWare 6种安装的,具体的安装过程参见:http://0123.blog.163.com/blog/478831200751884210367.track
技巧:如果使用Live并且在VMWare中安装,那么在安装的时候分配内存尽量的多,这样可以加快安装速度。安装完后再分配给128M或者256M内存进行使用就可以了(视自己情况)。
注意:VMWare 5.5/VMWare Server 1.03以及更低的版本SCSI硬盘在Fedora 7中不被支持。建议升级到VMWare 6,如果由于其他原因不能升级的,可以把虚拟机中的SCSI硬盘换成IDE硬盘进行安装。
关闭图形界面
因为用于开发测试使用,所以没有必要使用图形环境,固将其关闭,以减少资源占用。
编辑/etc/inittab文件:
[root@webapp ~]# cat /etc/inittab ## inittab This file describes how the INIT process should set up# the system in a certain run-level.## Author: Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org># Modified for RHS Linux by Marc Ewing and Donnie Barnes#
# Default runlevel. The runlevels used by RHS are:# 0 - halt (Do NOT set initdefault to this)# 1 - Single user mode# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)# 3 - Full multiuser mode# 4 - unused# 5 - X11# 6 - reboot (Do NOT set initdefault to this)# id:3:initdefault:
# System initialization.si::sysinit:/etc/rc.d/rc.sysinit
l0:0:wait:/etc/rc.d/rc 0l1:1:wait:/etc/rc.d/rc 1l2:2:wait:/etc/rc.d/rc 2l3:3:wait:/etc/rc.d/rc 3l4:4:wait:/etc/rc.d/rc 4l5:5:wait:/etc/rc.d/rc 5l6:6:wait:/etc/rc.d/rc 6
# Trap CTRL-ALT-DELETEca::ctrlaltdel:/sbin/shutdown -t3 -r now
# When our UPS tells us power has failed, assume we have a few minutes# of power left. Schedule a shutdown for 2 minutes from now.# This does, of course, assume you have powerd installed and your# UPS connected and working correctly. pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down"
# If power was restored before the shutdown kicked in, cancel it.pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled"
# Run gettys in standard runlevels1:2345:respawn:/sbin/mingetty tty12:2345:respawn:/sbin/mingetty tty23:2345:respawn:/sbin/mingetty tty34:2345:respawn:/sbin/mingetty tty45:2345:respawn:/sbin/mingetty tty56:2345:respawn:/sbin/mingetty tty6
# Run xdm in runlevel 5x:5:respawn:/etc/X11/prefdm -nodaemon
安装所需软件
装完Fedora 7后默认已经安装了Apache,所以我们需要安装的是php和Mysql以及subversion:
安装PHP
[root@webapp ~]# yum install phpLoading "installonlyn" pluginSetting up Install ProcessParsing package install argumentsprimary.sqlite.bz2 100% |=========================| 56 kB 00:44 http://fr2.rpmfind.net/linux/fedora/releases/7/Everything/i386/os/repodata/primary.sqlite.bz2: [Errno 4] Socket Error: timed outTrying other mirror.primary.sqlite.bz2 100% |=========================| 3.8 MB 12:26 updates 100% |=========================| 1.9 kB 00:00 primary.sqlite.bz2 100% |=========================| 770 kB 02:05 Resolving Dependencies--> Running transaction check---> Package php.i386 0:5.2.2-3 set to be updated--> Processing Dependency: php-common = 5.2.2-3 for package: php--> Processing Dependency: php-cli = 5.2.2-3 for package: php--> Restarting Dependency Resolution with new changes.--> Running transaction check---> Package php-common.i386 0:5.2.2-3 set to be updated---> Package php-cli.i386 0:5.2.2-3 set to be updated
Dependencies Resolved
============================================================================= Package Arch Version Repository Size =============================================================================Installing: php i386 5.2.2-3 fedora 1.3 MInstalling for dependencies: php-cli i386 5.2.2-3 fedora 2.5 M php-common i386 5.2.2-3 fedora 205 k
Transaction Summary=============================================================================Install 3 Package(s) Update 0 Package(s) Remove 0 Package(s)
Total download size: 4.0 MIs this ok [y/N]: yDownloading Packages:(1/3): php-cli-5.2.2-3.i3 100% |=========================| 2.5 MB 08:15 (2/3): php-common-5.2.2-3 100% |=========================| 205 kB 00:38 (3/3): php-5.2.2-3.i386.r 100% |=========================| 1.3 MB 04:44 warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 4f2a6fd2Importing GPG key 0x4F2A6FD2 "Fedora Project <fedora@redhat.com>" from /etc/pki/rpm-gpg/RPM-GPG-KEY-fedoraIs this ok [y/N]: yImporting GPG key 0xDB42A60E "Red Hat, Inc <security@redhat.com>" from /etc/pki/rpm-gpg/RPM-GPG-KEYIs this ok [y/N]: yRunning Transaction TestFinished Transaction TestTransaction Test SucceededRunning Transaction Installing: php-common ######################### [1/3] Installing: php-cli ######################### [2/3] Installing: php ######################### [3/3]
Installed: php.i386 0:5.2.2-3Dependency Installed: php-cli.i386 0:5.2.2-3 php-common.i386 0:5.2.2-3Complete!
安装Mysql 5
[root@webapp ~]# yum install mysql-serverLoading "installonlyn" pluginSetting up Install ProcessParsing package install argumentsResolving Dependencies--> Running transaction check---> Package mysql-server.i386 0:5.0.37-2.fc7 set to be updated--> Processing Dependency: libmysqlclient_r.so.15 for package: mysql-server--> Processing Dependency: libmysqlclient.so.15 for package: mysql-server--> Processing Dependency: libmysqlclient.so.15(libmysqlclient_15) for package: mysql-server--> Processing Dependency: perl(DBI) for package: mysql-server--> Processing Dependency: mysql = 5.0.37-2.fc7 for package: mysql-server--> Processing Dependency: libmysqlclient_r.so.15(libmysqlclient_15) for package: mysql-server--> Processing Dependency: perl-DBI for package: mysql-server--> Processing Dependency: perl-DBD-MySQL for package: mysql-server--> Restarting Dependency Resolution with new changes.--> Running transaction check---> Package mysql.i386 0:5.0.37-2.fc7 set to be updated---> Package perl-DBD-MySQL.i386 0:3.0008-1.fc7 set to be updated---> Package perl-DBI.i386 0:1.53-2.fc7 set to be updated---> Package mysql-libs.i386 0:5.0.37-2.fc7 set to be updated
Dependencies Resolved
============================================================================= Package Arch Version Repository Size =============================================================================Installing: mysql-server i386 5.0.37-2.fc7 fedora 10 MInstalling for dependencies: mysql i386 5.0.37-2.fc7 fedora 2.0 M mysql-libs i386 5.0.37-2.fc7 fedora 1.5 M perl-DBD-MySQL i386 3.0008-1.fc7 fedora 148 k perl-DBI i386 1.53-2.fc7 fedora 611 k
Transaction Summary=============================================================================Install 5 Package(s) Update 0 Package(s) Remove 0 Package(s)
Total download size: 14 MIs this ok [y/N]: yDownloading Packages:(1/5): mysql-libs-5.0.37- 100% |=========================| 0 B 00:57 http://ftp.hostrino.com/pub/fedora/linux/releases/7/Everything/i386/os/Fedora/mysql-libs-5.0.37-2.fc7.i386.rpm: [Errno 4] Socket Error: timed outTrying other mirror.(1/5): mysql-libs-5.0.37- 100% |=========================| 1.5 MB 06:52 (2/5): perl-DBI-1.53-2.fc 100% |=========================| 611 kB 02:17 (3/5): perl-DBD-MySQL-3.0 100% |=========================| 148 kB 00:45 (4/5): mysql-5.0.37-2.fc7 100% |=========================| 2.0 MB 07:47 (5/5): mysql-server-5.0.3 100% |=========================| 10 MB 31:09 Running Transaction TestFinished Transaction TestTransaction Test SucceededRunning Transaction Installing: mysql-libs ######################### [1/5] Installing: perl-DBI ######################### [2/5] Installing: mysql ######################### [3/5] Installing: perl-DBD-MySQL ######################### [4/5] Installing: mysql-server ######################### [5/5]
Installed: mysql-server.i386 0:5.0.37-2.fc7Dependency Installed: mysql.i386 0:5.0.37-2.fc7 mysql-libs.i386 0:5.0.37-2.fc7 perl-DBD-MySQL.i386 0:3.0008-1.fc7 perl-DBI.i386 0:1.53-2.fc7Complete!
安装Subversion
[root@webapp ~]# yum install subversionLoading "installonlyn" pluginSetting up Install ProcessParsing package install argumentsfedora 100% |=========================| 2.1 kB 00:00 updates 100% |=========================| 1.9 kB 00:00 Resolving Dependencies--> Running transaction check---> Package subversion.i386 0:1.4.3-4 set to be updated--> Processing Dependency: libneon.so.25 for package: subversion--> Restarting Dependency Resolution with new changes.--> Running transaction check---> Package neon.i386 0:0.25.5-6 set to be updated
Dependencies Resolved
============================================================================= Package Arch Version Repository Size =============================================================================Installing: subversion i386 1.4.3-4 fedora 2.3 MInstalling for dependencies: neon i386 0.25.5-6 fedora 95 k
Transaction Summary=============================================================================Install 2 Package(s) Update 0 Package(s) Remove 0 Package(s)
Total download size: 2.4 MIs this ok [y/N]: yDownloading Packages:(1/2): neon-0.25.5-6.i386 100% |=========================| 95 kB 00:22 (2/2): subversion-1.4.3-4 100% |=========================| 2.3 MB 07:27 Running Transaction TestFinished Transaction TestTransaction Test SucceededRunning Transaction Installing: neon ######################### [1/2] Installing: subversion ######################### [2/2]
Installed: subversion.i386 0:1.4.3-4Dependency Installed: neon.i386 0:0.25.5-6Complete!
安装php-mysql链接库
[root@dev ~]# yum install php-mysqlLoading "installonlyn" pluginSetting up Install ProcessParsing package install argumentsResolving Dependencies--> Running transaction check---> Package php-mysql.i386 0:5.2.2-3 set to be updated--> Processing Dependency: php-pdo for package: php-mysql--> Restarting Dependency Resolution with new changes.--> Running transaction check---> Package php-pdo.i386 0:5.2.2-3 set to be updated
Dependencies Resolved
============================================================================= Package Arch Version Repository Size =============================================================================Installing: php-mysql i386 5.2.2-3 fedora 78 kInstalling for dependencies: php-pdo i386 5.2.2-3 fedora 58 k
Transaction Summary=============================================================================Install 2 Package(s) Update 0 Package(s) Remove 0 Package(s)
Total download size: 136 kIs this ok [y/N]: yDownloading Packages:(1/2): php-mysql-5.2.2-3. 100% |=========================| 78 kB 00:02 (2/2): php-pdo-5.2.2-3.i3 100% |=========================| 58 kB 00:01 Running Transaction TestFinished Transaction TestTransaction Test SucceededRunning Transaction Installing: php-pdo ######################### [1/2] Installing: php-mysql ######################### [2/2]
Installed: php-mysql.i386 0:5.2.2-3Dependency Installed: php-pdo.i386 0:5.2.2-3Complete!
配置mysql
编辑/etc/my.cnf
[mysqld]datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sockuser=mysql# Default to using old password format for compatibility with mysql 3.x# clients (those using the mysqlclient10 compatibility package).old_passwords=1default-character-set=utf8 [mysqld_safe]log-error=/var/log/mysqld.logpid-file=/var/run/mysqld/mysqld.pid[client]default-character-set=utf8
配置subversion
我的svn库位置放在 /shanmin/svn,请根据自己保存的位置更改相应的命令
创建svn库:svnadmin create /shanmin/svn/
编辑/shanmin/svn/conf/svnserve.conf,把匿名权限设置为none,验证权限设置为write,并且使用passwd验证用户,修改完的代码:
[root@dev conf]# cat svnserve.conf ### This file controls the configuration of the svnserve daemon, if you### use it to allow access to this repository. (If you only allow### access through http: and/or file: URLs, then this file is### irrelevant.)
### Visit http://subversion.tigris.org/ for more information.
[general]### These options control access to the repository for unauthenticated### and authenticated users. Valid values are "write", "read",### and "none". The sample settings below are the defaults.anon-access = noneauth-access = write### The password-db option controls the location of the password### database file. Unless you specify a path starting with a /,### the file's location is relative to the conf directory.### Uncomment the line below to use the default password file.password-db = passwd### The authz-db option controls the location of the authorization### rules for path-based access control. Unless you specify a path### starting with a /, the file's location is relative to the conf### directory. If you don't specify an authz-db, no path-based access### control is done.### Uncomment the line below to use the default authorization file.# authz-db = authz### This option specifies the authentication realm of the repository.### If two repositories have the same authentication realm, they should### have the same password database, and vice versa. The default realm### is repository's uuid.# realm = My First Repository
设置passwd文件
[root@dev conf]# cat passwd ### This file is an example password file for svnserve.### Its format is similar to that of svnserve.conf. As shown in the### example below it contains one section labelled [users].### The name and password for each user follow, one account per line.
[users]harry = harryssecret# sally = sallyssecret
passwd文件中,格式是 用户名=密码
设置自动发布.这个是用于我们远程提交到svn的代码,自动的发布到apache的目录下,这样我们就可以把提交代码和ftp合并成一个了(这也是我为什么在整个安装过程未提及FTP的原因)。
在/shanmin/svn/hooks下增加post-commit文件。(这里我的web目录为/var/www/html)
[root@dev hooks]# cat post-commit#!/bin/sh
export LANG=en_US.UTF-8/usr/bin/svn update /var/www/html
把这个文件设置成可执行文件。例如:chmod 777 post-commit
打开所需服务,关闭无用服务
根据我的习惯,我使用setup关闭和打开了几个服务。(注:因为我把Fedora7放在VMWare里面,所以我尽量的让Fedora7少占资源,把能关的服务都关掉)(从默认开始)
autofs 关闭。不使用移动存储设备就关掉这个。
bluetooth 关闭。没有蓝牙设备,没有任何用处。
cpuspeed 关闭。用于CPU降速的,如果CPU不支持降速就关掉这个。
httpd 打开
iptables 关闭。因为是在内网开发测试使用,所以防火墙基本上没有什么用途。
ip6tables 关闭。没有使用ipv6
isdn 关闭。没有使用ISDN
irqbalance 关闭。不在多CPU环境下,这个服务没有什么用处。
mysqld 打开
netfs 关闭。如果不使用网络挂接就关掉。
yum-updatest 关闭。这个用于自动升级提醒,不进图形界面就没有用处。
运行Subversion服务
默认没有给svn提供一个开启的服务,所以我们得手动添加到rc.local文件中(其实完全可以不使用svn服务,而使用Apache。但是因为开发测试环境也在Apache下,我会影响开发,所以一直使用单独的svn服务)。
编辑/etc/rc.local文件,加入svn服务器运行命令
[root@dev ~]# cat /etc/rc.local #!/bin/sh## This script will be executed *after* all the other init scripts.# You can put your own initialization stuff in here if you don't# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
svnserve -d -r /shanmin/svn
重起服务器,做最后设置和测试
把svn中的数据取到apache目录下:
[root@dev ~]# svn checkout svn://127.0.0.1/ /var/www/html/
验证是否正常取出
[root@dev ~]# ll /var/www/html/ -atotal 24drwxr-xr-x 3 root root 4096 2007-06-24 17:08 .drwxr-xr-x 6 root root 4096 2007-05-26 03:46 ..drwxr-xr-x 6 root root 4096 2007-06-24 17:08 .svn
如果有.svn目录证明正常取出。
配置mysql远程管理,默认mysql的root在本机管理,简单起见,我都是把localhost改为%
[root@dev ~]# mysqlWelcome to the MySQL monitor. Commands end with ; or /g.Your MySQL connection id is 5Server version: 5.0.37 Source distribution
Type 'help;' or '/h' for help. Type '/c' to clear the buffer.
mysql> use mysqlReading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -A
Database changedmysql> update user set host='%' where host='localhost' and user='root';Query OK, 1 row affected (0.04 sec)Rows matched: 1 Changed: 1 Warnings: 0
mysql> flush privileges;Query OK, 0 rows affected (0.01 sec)
mysql>
完成。
