ubuntu和centos下关于lamp的一些常规操作

本文中centos环境是在root账户下操作的

安装Apache, MySQL, PHP

sudo apt-get install apache2 mysql-server-5.0 php5 libapache2-mod-php5 php5-mysql ...(需要别的模块自己添加)
yum -y install httpd php mysql mysql-server php-mysql httpd-manual mod_ssl mod_perl mod_auth_mysql php-mcrypt php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc mysql-connector-odbc mysql-devel libdbi-dbd-mysql...(相关模块自己取舍,需要再加)

重启apache服务(其他服务类似)

sudo /etc/init.d/apache2 restart(或sudo service apache2 restart)
/etc/init.d/httpd restart(或 service httpd restart)

Apache相关配置

路径:

/etc/apache2/apache2.conf
/etc/httpd/conf/httpd.conf

虚拟主机配置

可以直接写到上述配置文件中,也可以单独写,我在centos中是直接写到apache主配置文件的,在ubuntu中,配置文件同路径中有两个文件夹,分别是

sites-available和sites-enabled,具体作用不言而喻(同目录中的mods-available和mods-enable文件夹也类似)

在sites-available中配好相关虚拟主机,我一般单独文件一个主机,然后运行

sudo a2ensite 虚拟主机配置文件名

然后restart或者reload apache服务都可以使配置生效。

用户和组

centos下一般是apache:apache

ubuntu下一般是www-data:www-data

CentOS下搭建SVN服务端

安装

yum install subversion

新建目录

mkdir -p /home/svn

新建项目

svnadmin create /home/svn/test

编辑配置文件
1. /home/svn/test/conf/svnserve.conf
将下列去掉注释:
anon-access = none
auth-access = write
password-db = passwd
authz-db = authz

realm = test

 

2. /home/svn/test/conf/passwd 添加账号密码

3. /home/svn/test/conf/authz 添加账号认证

具体案例看文章最后的附录

启动svnserver

/usr/bin/svnserve -d -r /home/svn/

加入到启动项

echo /usr/bin/svnserve -d -r /home/svn/ >> /etc/rc.d/rc.local

修改密码、添加新项目等都不需要重启svn进程;
上述test项目的默认svn地址为: svn://xxx.xxx.xxx/test (其中xxx.xxx.xxx为服务器ip)

附录:
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

pass

### 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

root  = xxxxx

authz

### This file is an example authorization file for svnserve.
### Its format is identical to that of mod_authz_svn authorization
### files.
### As shown below each section defines authorizations for the path and
### (optional) repository specified by the section name.
### The authorizations follow. An authorization line can refer to a
### single user, to a group of users defined in a special [groups]
### section, or to anyone using the '*' wildcard.  Each definition can
### grant read ('r') access, read-write ('rw') access, or no access
### ('').

[groups]
# harry_and_sally = harry,sally

# [/foo/bar]
# harry = rw
# * =

# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r

[/]
root = rw

(r表示可读,w表示可写)