Личный блог: Linux установите SVN для реализации автоматической синхронизации с веб-каталогом
Я: установите SVN 1. Проверьте, установлен ли SVN на сервере
svn --version
Installed:
svn, version 1.6.11 (r934486)
compiled Aug 17 2015, 08:37:43
Copyright (C) 2000-2009 CollabNet.
Subversion is open source software, see http://subversion.tigris.org/
This product includes software developed by CollabNet (http://www.Collab.Net/).
The following repository access (RA) modules are available:
* ra_neon : Module for accessing a repository via WebDAV protocol using Neon.
- handles 'http' scheme
- handles 'https' scheme
* ra_svn : Module for accessing a repository using the svn network protocol.
- with Cyrus SASL authentication
- handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
- handles 'file' scheme
Not installed:
-bash: svn: command not found2. Он не устанавливается и не устанавливается с помощью yum
yum install subversion
3. Создайте каталог склада (каталог склада может быть изменен на другие каталоги, в зависимости от ваших пожеланий)
mkdir –p /svn
4. Создать библиотеку версий проекта
Svnadmin create / SVN / davesvn -- davesvn is the version library name
5. Введите каталог библиотеки версий после создания
cd /svn/davesvn Ls view files generated in the directory Conf directory to store the configuration files used by the version Library DB version datastore directory Format stores an integer file representing the library hierarchy version Hooks store version library hook subdirectory Locks repository lock directory, used to track library visitors README.txt
6. Затем начните настраивать SVN
cd conf ls Authz | permission profile Passwd | username password file Svnserve.conf | SVN service configuration file //Configuration password XXX = XXX vim password [users] zhan = 123456 //Configuration authority XXX = XXX vim authz [/] zhan = rw //Configure svnserve.conf to uncomment the following note without spaces vim svnserve.conf Anon access = read - anonymous user readable Auth access = write ා authorized user can write Password DB = passwd - which file to use as the account file Authz DB = authz ා which file to use as the permission file Realm = / SVN / davesvn ා authentication space name, the directory where the version library is located
7. Запустите службу SVN
svnserve -d -r /svn/davesvn -D stands for background operation -R specifies that the directory is / SVN / davesvn If prompt: svnserve: can't bind server socket: address already in use Indicates that the service has started, stop the service first ps -ef | grep svn Kill - 9 [process number] kill the process
2. Реализовать автоматическое развертывание проектов 1. Используйте post commit для реализации автоматического развертывания
Create the post commit file under / SVN / davesvn / hooks, and set the executable permissions cp post-commit.tmpl post-commit chmod 755 post-commit
2. Откройте файл фиксации записи, очистите содержимое фиксации записи и добавьте следующее содержимое
!/bin/sh export LANG=zh_CN.UTF-8 Svn co SVN: // [your IP address] / davesvn [web actual directory] LOG_PATH=/tmp/svn_test.log Web = [web actual directory] REPOS="$1" REV="$2" Svn update -- username [SVN user name just set] - password [SVN password just set] $web -- no auth cache > > $log_path
3. Наконец-то вернулся в шелл
Svn co SVN: // your IP / davesvn [web directory] Input the account password according to the prompt to realize automatic synchronization
Три, использовать
Svn check out: check whether it can be checked out normally Svn: // server IP: 3690 / davesvn After checking out normally, submit to check whether the web directory has synchronized content
Ямы:
Svn error: Post commit hook failed (exit code 1) with output
1. Check whether the character code set in post commit is correct
It was originally "export lang = zh CN. GBK"
Modify it to export lang = en_us.utf-8 (the default value of SVN server is utf8)
2. Check whether the account password set in post commit and the account password in SVN configuration are correct
3255 error: is post commit authorized
4. Check whether port 3690 of the server is on
4. At last, no matter what you are doing, the most important thing is to be careful. Read the wrong information and don't panic