Detail the whole process of CentOS SVN server setup and automatic deployment
- 2020-05-24 06:40:04
- OfStack
Server setup
Installation services
yum install subversion
Configure the service
mkdir -p /data/wwwsvn/myrepo # create svn Inventory of warehouse
Here you can customize the directory you created, note that it is not the site's file directory.
svnadmin create /data/wwwsvn/myrepo # Same as the directory above.
Note here that the directory cannot be empty. Upon success, you will get the following files
# ls
conf db format hooks locks README.txt
Enter conf to modify the configuration file
vi passwd
Add at the end
[users]
# harry = harryssecret
# sally = sallyssecret
youname = yourpassword # Your user and password
vi authz
Add at the end
...
[/]
yourname = rw
vi svnserve.conf
Close comments and modify variables
anon-access = read # Anonymous user readable
auth-access = write # Authorized user writable
password-db = passwd # Which file to use as the account file
authz-db = authz # Which file to use as the permissions file
realm = /data/wwwsvn/myrepo # Authenticates the space name, the directory where the version library is located, and the previous 1 sample
Turn on and off services
svnserve -d -r /data/wwwroot/myrepo # open
killall svnserve # Shut down
ps aux | grep svnserve # See if it runs
Open port
This step is very important. If you have configured everything but cannot connect, then port 1 is not open. The default port is 3690.
iptables -I INPUT -i eth0 -p tcp --dport 3690 -j ACCEPT # Open ports
service iptables save # save iptables Rules (if you can't save them, use another method to save them)
Client connection
Windows
Use TortoiseSVN,url to fill in svn:// your server ip, account password just set.
Mac
Use CornerStone and url to fill in svn:// your server ip, and fill in the password just set.
Automatic deployment
The hook post-commit is executed every time commit submits the code. According to this principle, you can modify post-commit so that the web directory on the server will automatically update every time someone commit.
cd /data/wwwsvn/myrepo/hooks # Your version repository directory
cp post-commit.tmpl post-commit
vi post-commit
The following
mkdir -p /data/wwwsvn/myrepo # create svn Inventory of warehouse
0
Everything else in the hook file can be discarded. You can comment them out.
This works only if your yourWebDir is already checkout
mkdir -p /data/wwwsvn/myrepo # create svn Inventory of warehouse
1
So far, everything is done. Every time commit goes to the server, the website content will be updated automatically.
This is the first time since the server lost data last time.
conclusion
The above is the whole content of this article, I hope the content of this article to your study or work can bring 1 definite help, if you have questions you can leave a message to communicate.