centOS8如何安装svn
首页 / 频道 / 显示主题:centOS8如何安装svn

centOS8如何安装svn


时间:2021年03月26日 16:10:28点击:1244类别:解决方案

安装
CentOS7通过yum安装subversion。
yum install subversion
1
CentOS8还可以dnf安装,同yum安装一样

dnf install subversion
1
subversion安装在/bin目录:

which svnserve #查看目录命令/usr/bin/svnserve
1
检查一下subversion是否安装成功。不要使用1.8版本

svnserve --version
svnserve, version 1.7.14 (r1542130)
1
2
建立版本库
subversion默认以/var/svn作为数据根目录,可以通过/etc/sysconfig/svnserve修改这个默认位置。
vim /etc/sysconfig/svnserve
1
文件内容
OPTIONS="-r /var/svn"
可修改

使用svnadmin建立版本库doc。

mkdir -p /var/svn/doc //递归创建多个目录
svnadmin create /var/svn/doc
1
2
ll /var/svn/doc //查看目录中内容
1
drwxr-xr-x. 2 root root 51 Nov 10 14:42 conf
drwxr-sr-x. 6 root root 4096 Nov 10 14:42 db
-r–r--r–. 1 root root 2 Nov 10 14:42 format
drwxr-xr-x. 2 root root 4096 Nov 10 14:42 hooks
drwxr-xr-x. 2 root root 39 Nov 10 14:42 locks
-rw-r–r--. 1 root root 229 Nov 10 14:42 README.txt

配置
cd /var/svn/doc
1
a、编辑用户文件passwd,新增两个用户:admin和guest。

vim conf/passwd
1
[users]
admin = admin
guest = guest
b、编辑权限文件authz,用户admin设置可读写权限,guest设置只读权限。

vim conf/authz
1
[/]
admin = rw
guest = r
c、编辑svnserve.conf:

vim conf/svnserve.conf
1
[general]
anon-access = none #控制非鉴权用户访问版本库的权限
auth-access = write #控制鉴权用户访问版本库的权限
password-db = passwd #指定用户名口令文件名
authz-db = authz #指定权限配置文件名
//realm = svntest #指定版本库的认证域,即在登录时提示的认证域名称 //测试不需要
4. SVN服务
启动SVN服务。

systemctl start svnserve.service
1
检查服务是否启动成功。

ps aux | grep svn
1
root 16349 0.0 0.1 162180 900 ? Ss 15:01 0:00 /usr/bin/svnserve --daemon --pid-file=/run/svnserve/svnserve.pid -r /opt/svn
通过netstat可以看到SVN打开了3690端口。

netstat -tnlp
1
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN 16349/svnserve
设置成开机启动。

systemctl enable svnserve.service
1
启动svn

svnserve -d -r /var/svn/doc
1
#查询svn启动情况

ps -ef|grep svn
1
#查询svn配置

egrep "\-access|\-db =" svnserve.conf
1
更改防火墙设置
大坑,注意阿里云\华为云\腾讯云都要要开相应端口3690的安全组
firewall-cmd --add-port=3690/tcp --permanent
firewall-cmd --reload //重新启动防火墙
1
2
以下为配置示例
authz

[aliases]
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average

[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe
# 创建了一个admin组和一个user组,方便管理
admin=lzyats
user=zsf
# [/foo/bar]
# harry = rw
# &joe = r
# * =

# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
# 指定组权限
[/]
@admin=rw
[zsf:/]
@user=rw
#[zsf:/]
#zsf=rw

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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

lzyats=123456
zsf=123456

1
2
3
4
5
6
7
8
9
10
11
12
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.apache.org/ for more information.

[general]
### The anon-access and auth-access options control access to the
### repository for unauthenticated (a.k.a. anonymous) users and
### authenticated users, respectively.
### Valid values are "write", "read", and "none".
### Setting the value to "none" prohibits both reading and writing;
### "read" allows read-only access, and "write" allows complete
### read/write access to the repository.
### The sample settings below are the defaults and specify that anonymous
### users have read-only access to the repository, while authenticated
### users have read and write access to the repository.
### 禁止匿名访问,
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 directory containing
### this configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### 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
### directory containing this file. The specified path may be a
### repository relative URL (^/) or an absolute file:// URL to a text
### file in a Subversion repository. 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.
### 用户密码使用了sasl加密
authz-db = authz
### The groups-db option controls the location of the file with the
### group definitions and allows maintaining groups separately from the
### authorization rules. The groups-db file is of the same format as the
### authz-db file and should contain a single [groups] section with the
### group definitions. If the option is enabled, the authz-db file cannot
### contain a [groups] section. Unless you specify a path starting with
### a /, the file's location is relative to the directory containing this
### file. The specified path may be a repository relative URL (^/) or an
### absolute file:// URL to a text file in a Subversion repository.
### This option is not being used by default.
#groups-db = groups
### 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
### The force-username-case option causes svnserve to case-normalize
### usernames before comparing them against the authorization rules in the
### authz-db file configured above. Valid values are "upper" (to upper-
### case the usernames), "lower" (to lowercase the usernames), and
### "none" (to compare usernames as-is without case conversion, which
### is the default behavior).
# force-username-case = none
### The hooks-env options specifies a path to the hook script environment
### configuration file. This option overrides the per-repository default
### and can be used to configure the hook script environment for multiple
### repositories in a single file, if an absolute path is specified.
### Unless you specify an absolute path, the file's location is relative
### to the directory containing this file.
# hooks-env = hooks-env

[sasl]
### 用于标识是否进行SASL加密处理
### This option specifies whether you want to use the Cyrus SASL
### library for authentication. Default is false.
### Enabling this option requires svnserve to have been built with Cyrus
### SASL support; to check, run 'svnserve --version' and look for a line
### reading 'Cyrus SASL authentication is available.'
#use-sasl = true
### These options specify the desired strength of the security layer
### that you want SASL to provide. 0 means no encryption, 1 means
### integrity-checking only, values larger than 1 are correlated
### to the effective key length for encryption (e.g. 128 means 128-bit
### encryption). The values below are the defaults.
# min-encryption = 0
# max-encryption = 256

————————————————
需要注意的是,每个版本库需要单独设置authz passwd svnserve。conf文件

楼主低端人口9527

喜欢:(1244)  回复:(4)

0

以下为回复内容


读后有收获可以添加作者微信共同交流
打赏作者

1#楼的低端人口95272022年06月01日 10:09:34回复道:

安装
yum -y install vsftpd
1
配置vsftpd.conf
vim /etc/vsftpd/vsftpd.conf
1
添加:
pasv_enable=YES
pasv_min_port=22222
pasv_max_port=22232
allow_writeable_chroot=YES
listen_port=21
tcp_wrappers=YES
#系统用户登录后的根目录-根据实际情况修改
local_root=/home/oas/file/download
#匿名用户登录后的根目录-根据实际情况修改
anon_root=/home/oas/file/download
#设置用户独立配置文件保存目录
user_config_dir=/etc/vsftpd/userconfig/

关闭:
#connect_from_port_20=YES

关闭:
#chroot_local_user=YES
#chroot_list_enable=YES
#chroot_list_file=/etc/vsftpd/chroot_list

修改:
listen=YES
listen_ipv6=NO

修改vsftpd
vim /etc/pam.d/vsftpd
1
将pam_shells.so替换为pam_nologin.so


重启vsftpd
systemctl enable vsftpd
systemctl restart vsftpd
1
2
vsftpd用户创建
useradd ftpuser -s /sbin/nologin
passwd ftpuser

 


————————————————

安装VSFTPD后, FTP连接报错:500 OOPS: tcp_wrappers is set to YES but no tcp wrapper support compiled in

解决方法
vim /etc/vsftpd/vsftpd.conf
找到 tcp_wrappers=YES 这一行, 注释掉它

 


2#楼的低端人口95272022年06月01日 10:09:30回复道:

大概在这个位置给www用户权限;添加这句:www ALL=(ALL) ALL;强制保存并退出:wq!
然后切换到www用户的家目录

cd /home/www
1
准备工作做完了,现在开始下载nginx源包,使用wget工具下载

wget http://nginx.org/download/nginx-1.6.3.tar.gz
1
如果执行这一步的时候出现了,命令不存在之类的错误信息,可能是因为wget工具未安装,需要使用yum工具安装一下wget工具

yum -y install wget
1
安装成功后在执行下载命令;
此时www的家目录中会有一个名为nginx-1.6.3.tar.gz的压缩文件
切换到www用户并解压这个文件

su - www
tar -xvf nginx-1.6.3.tar.gz
1
2
解压之后会有一个名为nginx-1.6.3的目录文件;
我们更改一下nginx-1.6.3及其子文件的属主和属组

chown -R www:www nginx-1.6.3
1
更改成功之后进入这个文件

cd nginx-1.6.3
1
执行配置命令

./configure
1
接下来编译文件,编译成功后,可以看到一个Makefile文件

make
1
一般在这里会出现问题,下面给出问题截图和解决方法
1、

问题原因:不知道
解决方法:进入到nginx-1.6.3目录下(解压的目录)
找到当前目录下找到objs文件夹,并进入,打开文件Makefile,

vim objs/Makefile
1
找到有一下内容的这行:(就在前几行)

CFLAGS = -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g 
1
-Werror: gcc将所有的警告当成错误进行处理把这行内容中的 “-Werror”去掉
2、
错误原因:不知道
解决方法:编辑这个文件

vim /home/www/nginx-1.6.3/src/os/unix/ngx_user.c
1
把这一行注释掉(35行左右)

重新执行编译命令,一般不会出问题了

make
1
执行编译安装

执行编译安装,即也就是将编译的文件,拷贝到指定的目录。(把/nginx-1.4.4目录下的文件拷贝到/usr/local/nginx/)。

因为需要在其它文件夹下创建文件夹,所以直接编写安装会报错,所以需要采用sudo方式安装。

sudo make install
1
启动nginx服务器,启动命令需要使用sudo完成。

sudo /usr/local/nginx/sbin/nginx
1
测试nginx服务器是否可用
访问服务器地址的80端口,确定是否能打开"welcome"页面。发现此时无法访问到欢迎界面(本机除外),原因是centos本地防火墙对外未打开80端口,需要在本地防火墙中将该端口打开。使用以下命令。

sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
sudo firewall-cmd --reload
1
2
此时再访问centos的80端口,就可查看到欢迎界面了。
最后给一张成功的截图
————————————————


3#楼的低端人口95272022年06月01日 10:09:26回复道:

https://www.runoob.com/django/django-nginx-uwsgi.html


4#楼的低端人口95272024年02月03日 13:10:42回复道:

mark一下

 

hooks下的post-commit,一定要修改chmod 755权限,否则会报错,切记!

然后是编写hook脚本

 

。。。。。。

 

记得去更新的根目录,用svn co第一次拉取代码,后面就不用了,直接svn up就行

 

 

血泪代价

 

 




也回复一个  举报