腾讯云轻量级服务器搭建svn"/>
如何在腾讯云轻量级服务器搭建svn
首先进入服务器控制面板:
://console.cloud.tencent/lighthouse/instance/index
点击服务器进入详情面板,如下图所示
如果不是linux,可以点击上图所示的红框内的重置应用,将系统更换为CentOS,当然其他的系统也可以装svn,但是不适合这个教程了。
点击这里的重置密码
然后就使用软件连接服务器,我这里使用的是xshell,一款个人免费的远程连接服务。
点击连接输入对应的Ip地址,直接连接即可,然后根据提示输入用户名和密码,连接即可,如果不在服务器那里设置密码的话,就只能用密钥连接。
1.然后安装svn
yum -y installl subversion
几秒之后显示如下图,Complete! 表示安装已经完成。
2.确认svn安装完成
svnserve --version
3.创建svn的版本库
mkdir /usr/local/svn
输入以上命令,mkdir是linux命令,意思是在usr目录的local目录下,创建一个文件夹svn,没有提示就是对了
如果安装了xftp的话,点击xftp到对应的路径下,就可以看到对应的文件夹。
可以看到一个svn的空文件夹。
4.创建svn版本库下文件存放地址
svnadmin create /usr/local/svn/firstTest
5.修改配置文件,也可以用xftp直接在对应的路径上修改文件
进入对应的路径
cd /usr/local/svn/firstTest
cd 是linux命令,进入 /usr/local/svn/firstTest
输入ls,ls也是Liunx命令,展示当前目录下的文件
ls
conf就是配置文件,进入之后修改
cd conf
ls
vi authz
修改账号控制信息,这里都是liunx的操作命令,如果感觉不好修改的话,也可以使用xftp直接在文件上修改,vi 打开并修改当前文件。按i进入编辑模式。
i
在末尾添加,注意等号两边有空格
[/]
hu = rw
[/] 表示控制的路径是全部,hu 是账号名, rw 表示的权限 可读写,按Esc退出编辑模式
Esc
:wq
输入 :wq 表示保存并推出,:是英文的冒号:
6.添加账号信息
vi passwd
i
添加刚才的账号信息,注意输入数字的时候,要用字母上的数字,不要用小键盘的数字
hu = hu123456
Esc
:wq
7.开放权限
vi svnserve.conf
[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 = read
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.
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
-- INSERT --
将下图所示的配置前面的#去掉即可,如果不好修改,建议使用xftp直接在对应的文件的也好。
anon-access = read
auth-access = writepassword-db = passwd
authz-db = authz
realm = My First Repository
Esc
:wq
8.启动svn,这里到 第三步 3.创建svn的版本库即可
svnserve -d -r /usr/local/svn
确定是否启动
netstat -apn | grep 3690
如下图所示,3690是svn的默认端口
然后在控制面板中开启端口,我这里直接开启全部的端口
9.检出文件
创建一个存放svn的路径,检出,注意这里是 4.创建svn版本库下文件存放地址的最好创建的路径,svn:ip:3690/firstTest
输入对应的用户名和密码即可。
提交之后发现查看不了版本信息,日期选择不了永远是1970/1/1
修改svn上的svnserve.conf
anon-access=none
清理svn客户端的cache即可,TortoiseSVN --> settings
删除这里的即可。
更多推荐
如何在腾讯云轻量级服务器搭建svn
发布评论