ubuntu + subversion + apache2 设置

1.下载安装subversion,apache2

sudo apt-get update
sudo apt-get upgrade

sudo  apt-get install apache2
sudo apt-get install subversion
sudo a2enmod ssl
sudo a2ensite default-ssl

sudo apt-get install subversion libapache2-svn
sudo a2enmod dav_svn

/etc/apache2/mods-enabled下面有dav.load,dav_svn.load和dav_svn.conf三个文件


2. 设置apache2

sudo gedit /etc/apache2/mods-enabled/dav_svn.conf
编辑该文件使之如下:

<Location /svn>   (apache下的位置)
      DAV svn 
      SVNPath /home/svn/myproject   (指明资源库的路径)
      或
      SVNParentPath /home/svn   (如果有多个库,使用该选项)
      SVNListParentPath on     (打开这个选项可以列出ParentPath下面的所有库)

      AuthType Basic   (认证类型为基本认证 )
      AuthName "Subversion Repository"    (认证名称,将在IE界面弹出一个对话框,其标题)
      AuthUserFile /etc/apache2/dav_svn.passwd    (认证密码文件)
      # AuthzSVNAcessFile /etc/apache2/dav_svn.authz     (目录权限文件)

      Require valid-user    (要求验证用户,即不能匿名访问)
    </Location>

如果需要用户每次登录时都进行用户密码验证,就将<LimitExcept GET PROPFIND OPTIONS REPORT>与</LimitExcept>两行注释掉 

更改 /home/svn 到任何你要保存仓库的地址。如果没有的话就新建。

sudo mkdir /home/svn 
3.开启svn服务
sudo svnadmin  create /home/svn
 

4.是APache成为该仓库的所有者。 
sudo chown -R www-data /home/svn

5. 
建立密码文件     
sudo htpasswd -cm /etc/apache2/dav_svn.passwd abc (创建用户abc并按照提示设置密码,网页认证的时候使用该用户名和密码登录。后面再添加用户的时候去掉-c选项。)

abc是你想使用的用户名,然后输入两次密码。

6.重启Apache

sudo /etc/init.d/apache2 restart

7.测试

打开浏览器,

http://you.server/svn

导入版本库
把/var/www/下的内容导入版本号中:
sudo svn  import -m "第一次导入"  /var/www http://192.168.0.5/svn/project
========================================
系统提示:
认证领域: <http://192.168.0.5:80> myproject subversion repository
“root”的密码: 
认证领域: <http://192.168.0.5:80> myproject subversion repository
用户名: test
“test”的密码: 
增加           /var/www/index.html
-----------------------------------------------------------------------
注意!  你的密码,对于认证域:
   <http://192.168.0.5:80> myproject subversion repository

<Location /svn>

# Uncomment this to enable the repository
DAV svn

# Set this to the path to your repository
#SVNPath /home/svn
# Alternatively, use SVNParentPath if you have multiple repositories under
# under a single directory (/var/lib/svn/repo1, /var/lib/svn/repo2, ...).
# You need either SVNPath and SVNParentPath, but not both.
SVNParentPath /home/svn
SVNListParentPath on

# Access control is done at 3 levels: (1) Apache authentication, via
# any of several methods. A "Basic Auth" section is commented out
# below. (2) Apache <Limit> and <LimitExcept>, also commented out
# below. (3) mod_authz_svn is a svn-specific authorization module
# which offers fine-grained read/write access control for paths
# within a repository. (The first two layers are coarse-grained; you
# can only enable/disable access to an entire repository.) Note that
# mod_authz_svn is noticeably slower than the other two layers, so if
# you don't need the fine-grained control, don't configure it.

# Basic Authentication is repository-wide. It is not secure unless
# you are using https. See the 'htpasswd' command to create and
# manage the password file - and the documentation for the
# 'auth_basic' and 'authn_file' modules, which you will need for this
# (enable them with 'a2enmod').
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd

# To enable authorization via mod_authz_svn (enable that module separately):
#<IfModule mod_authz_svn.c>
#AuthzSVNAccessFile /etc/apache2/dav_svn.authz
#</IfModule>

# The following three lines allow anonymous read, but make
# committers authenticate themselves. It requires the 'authz_user'
# module (enable it with 'a2enmod').
#<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
#</LimitExcept>

</Location>

ubuntu上安装mysql非常简单只需要几条命令就可以完成。

  1. sudo apt-get install mysql-server
 
  2. apt-get isntall mysql-client
 
  3.  sudo apt-get install libmysqlclient-dev
 
  安装过程中会提示设置密码什么的,注意设置了不要忘了,安装完成之后可以使用如下命令来检查是否安装成功:
 
  sudo netstat -tap | grep mysql
 
  通过上述命令检查之后,如果看到有mysql 的socket处于 listen 状态则表示安装成功。
 
  登陆mysql数据库可以通过如下命令:
 
  mysql -u root -p 
 
  -u 表示选择登陆的用户名, -p 表示登陆的用户密码,上面命令输入之后会提示输入密码,此时输入密码就可以登录到mysql
 

GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' IDENTIFIED BY 'admin' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' IDENTIFIED BY 'admin' WITH GRANT OPTION;
FLUSH PRIVILEGES;

原文地址:https://www.cnblogs.com/hujihon/p/5677109.html