`
zxwwjs
  • 浏览: 9825 次
  • 来自: ...
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

Fedora 7(Linux)下 Apache+PHP+MySQL+Subversion 开发测试环境配置过程

 
阅读更多

安装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 0
l1:1:wait:/etc/rc.d/rc 1
l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3
l4:4:wait:/etc/rc.d/rc 4
l5:5:wait:/etc/rc.d/rc 5
l6:6:wait:/etc/rc.d/rc 6

# Trap CTRL-ALT-DELETE
ca::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 runlevels
1:2345:respawn:/sbin/mingetty tty1
2:2345:respawn:/sbin/mingetty tty2
3:2345:respawn:/sbin/mingetty tty3
4:2345:respawn:/sbin/mingetty tty4
5:2345:respawn:/sbin/mingetty tty5
6:2345:respawn:/sbin/mingetty tty6

# Run xdm in runlevel 5
x:5:respawn:/etc/X11/prefdm -nodaemon

安装所需软件

装完Fedora 7后默认已经安装了Apache,所以我们需要安装的是php和Mysql以及subversion:

安装PHP

[root@webapp ~]# yum install php
Loading "installonlyn" plugin
Setting up Install Process
Parsing package install arguments
primary.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 out
Trying 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 M
Installing 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 M
Is this ok [y/N]: y
Downloading 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 4f2a6fd2
Importing GPG key 0x4F2A6FD2 "Fedora Project <fedora@redhat.com>" from /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
Is this ok [y/N]: y
Importing GPG key 0xDB42A60E "Red Hat, Inc <security@redhat.com>" from /etc/pki/rpm-gpg/RPM-GPG-KEY
Is this ok [y/N]: y
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: php-common ######################### [1/3]
Installing: php-cli ######################### [2/3]
Installing: php ######################### [3/3]

Installed: php.i386 0:5.2.2-3
Dependency Installed: php-cli.i386 0:5.2.2-3 php-common.i386 0:5.2.2-3
Complete!

安装Mysql 5

[root@webapp ~]# yum install mysql-server
Loading "installonlyn" plugin
Setting up Install Process
Parsing package install arguments
Resolving 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 M
Installing 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 M
Is this ok [y/N]: y
Downloading 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 out
Trying 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 Test
Finished Transaction Test
Transaction Test Succeeded
Running 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.fc7
Dependency 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.fc7
Complete!

安装Subversion

[root@webapp ~]# yum install subversion
Loading "installonlyn" plugin
Setting up Install Process
Parsing package install arguments
fedora 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 M
Installing 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 M
Is this ok [y/N]: y
Downloading 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 Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: neon ######################### [1/2]
Installing: subversion ######################### [2/2]

Installed: subversion.i386 0:1.4.3-4
Dependency Installed: neon.i386 0:0.25.5-6
Complete!

安装php-mysql链接库

[root@dev ~]# yum install php-mysql
Loading "installonlyn" plugin
Setting up Install Process
Parsing package install arguments
Resolving 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 k
Installing 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 k
Is this ok [y/N]: y
Downloading 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 Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: php-pdo ######################### [1/2]
Installing: php-mysql ######################### [2/2]

Installed: php-mysql.i386 0:5.2.2-3
Dependency Installed: php-pdo.i386 0:5.2.2-3
Complete!

配置mysql

编辑/etc/my.cnf

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql

# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
default-character-set=utf8

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-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 = none
auth-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/ -a
total 24
drwxr-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 ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or /g.
Your MySQL connection id is 5
Server version: 5.0.37 Source distribution

Type 'help;' or '/h' for help. Type '/c' to clear the buffer.

mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> 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>

完成。

分享到:
评论

相关推荐

    linux下安装apache+php+mysql的最简步骤

    在Linux系统中,构建一个基于Apache、PHP和MySQL的服务器环境,通常被称为LAMP(Linux、Apache、MySQL、PHP)架构。这是一种常见的Web开发平台,适用于动态网站和应用程序的部署。下面将详细介绍如何在Linux环境下...

    Apache+Php+Mysql整合配置

    本文将详细介绍如何在UNIX系统环境下,具体是FreeBSD5.4,进行Apache、PHP与MySQL的整合配置。以下步骤将指导你完成从软件准备到最终配置的全过程。 **一、环境准备** - **操作系统:** FreeBSD5.4 - **软件版本:** ...

    linux+apache+mysql+php 组合做出一个开源免费的网站

    Linux、Apache、MySQL和PHP(通常称为LAMP)是一个经典的开源软件组合,用于构建功能强大的Web应用程序和动态网站。这个组合充分利用了各自组件的优势,提供了一个稳定、灵活且成本效益高的平台。 首先,Linux是...

    FC6下配置apache+mysql+php.

    在本篇内容中,我们将深入探讨如何在Fedora Core 6(简称FC6)系统上配置Apache、MySQL和PHP环境,这一过程对于学习Linux环境下的Web服务器搭建具有重要意义。通过以下步骤,您将能够顺利安装并配置这三大组件,从而...

    Linux Fedora6 + JDK6 + mysql5 + tomat5.5+MyEclipse5.5环境搭建.docx

    在本文中,我们将详细讨论如何在Linux Fedora 6系统上搭建一个包含JDK 6、MySQL 5、Tomcat 5.5和MyEclipse 5.5的开发环境。首先,我们需要准备相应的安装文件: 1. jdk-6u11-linux-i586-rpm.bin:这是Oracle JDK 6...

    Linux+Nginx+MySQL+PHP一体化安装脚本

    LNMP一键安装包是一个用Linux Shell编写的可以为CentOS/RadHat/Fedora、Debian/Ubuntu/Raspbian VPS(VDS)或独立主机安装LNMP(Nginx/MySQL/PHP)、LNMPA(Nginx/MySQL/PHP/Apache)、LAMP(Apache/MySQL/PHP)生产环境的...

    linux下安装配置apache+php.pdf

    通过以上步骤,用户可以在Linux环境下获得自定义配置的Apache和PHP环境,从而满足特定的性能和功能需求。不过,需要注意的是,编译安装虽然可以获取最新版本,但维护起来也更为复杂,因为需要手动管理依赖和更新。...

    为CentOS / Fedora / Debian / Ubuntu安装LAMP(Linux + Apache + MySQL / MariaDB / Percona Server + PHP)-PHP开发

    为CentOS / Debian / Ubuntu安装LAMP(Linux + Apache + MySQL / MariaDB / Percona Server + PHP)描述LAMP是一个功能强大的bash脚本,用于安装Apache + PHP + MySQL / MariaDB / Percona Server等。 您可以通过...

    CentOS7+apache+php7+mysql5.7配置教程详解

    在本教程中,我们将深入探讨如何在CentOS7操作系统上配置一个完整的Web服务器环境,包括Apache Web服务器、PHP7和MySQL5.7数据库。这个环境是许多网站和应用程序的基础,对于开发者和系统管理员来说,了解如何正确...

    Fedora Linux Toolbox - 1000+ Commands for Fedora, CentOS and Red Hat Power Users

    Fedora Linux Toolbox - 1000+ Commands for Fedora, CentOS and Red Hat Power Users

    Fedora 9、CentOS 5下设置Apache+SVN

    在Linux系统中,配置Apache服务器与Subversion(SVN)集成是一项常见的任务,尤其对于开发团队来说,这能够提供一个便捷的代码版本控制系统。本教程将详细介绍如何在Fedora 9和CentOS 5环境下进行Apache与SVN的配置...

    PHP+Apache+Mysql+Centos5.5安装图文教程

    在本教程中,我们将深入探讨如何在CentOS 5.5操作系统上安装PHP、Apache和MySQL,这是一个经典的LAMP(Linux、Apache、MySQL、PHP)堆栈,是开发Web应用程序的基础。以下是详细的步骤: 首先,确保你的系统是最新的...

    在CentOS上安装搭建PHP+Apache+Mysql的服务器环境

    以下安装过程是基于centos下,使用yum安装搭建PHP+Apache+Mysql的服务器环境 一:安装MySQL 1.安装 yum install mysql mysql-server mysql-devel 2.启动 MySQL /etc/init.d/mysqld start 3.设置M

    apache for linux安装

    7. **配置Apache**:Apache的配置文件通常位于`/etc/apache2`(Debian/Ubuntu)或`/etc/httpd`(CentOS/Fedora)目录下。你可以根据需求修改`httpd.conf`或`apache2.conf`等配置文件。 8. **安全与优化**:为了增强...

    linux+nginx+mysql+php搭建高性能web服务器

    在构建高性能的Web服务器时,Linux、Nginx、MySQL和PHP(LNMP)的组合是一种常见的选择。这种架构能够提供高效、稳定且可扩展的服务,尤其适合处理高流量的PHP应用。以下是对标题和描述中涉及的知识点的详细解释: ...

    Linux下jdk1.6,apache,tomacat7,mysql基本安装说明文档

    在Linux环境下,搭建Java开发和部署环境通常涉及四个关键组件:JDK(Java Development Kit)、Apache HTTP Server、Tomcat(一个流行的Java应用服务器)以及MySQL(一个关系型数据库管理系统)。以下是对这些组件...

    配置fedora下php环境.doc

    "搭建Fedora下PHP环境...搭建 Fedora 下 PHP 环境需要安装 Apache、Mysql、PHP、phpMyAdmin 等组件,并需要配置各个组件的设置。通过本文的指导,读者可以一步步搭建 Fedora 下 PHP 环境,并成功地部署 Web 应用程序。

    Linux实验指导书详细版-安装与配置Apache服务器

    Fedora8环境下的Apache服务器安装与配置知识点: Fedora8作为Linux发行版之一,其在服务器部署和应用方面有着广泛的应用。安装与配置Apache服务器是Linux网络管理及服务器搭建过程中的一项重要技能。以下详细介绍了...

    Fedora 10下整合安装mysql-5.1.31、httpd-2.0.63 、php-5.2.6

    在Fedora 10操作系统中搭建LAMP(Linux, Apache, MySQL, PHP)服务器是许多开发者和系统管理员常做的任务,因为这是一个强大的平台,用于构建动态网页应用。本指南将详细讲解如何在Fedora 10上安装和配置MySQL ...

Global site tag (gtag.js) - Google Analytics