Linux Operation learning------svn/rpm Packaging

Source: Internet
Author: User
Tags svn svn update version control system rpmbuild

1. Subversion Basic operation
is a free/open source version control system (SVN)
Multi-person collaboration documentation and tracking of changes made
1.1 Basic Concepts:
Repository: Is the core of version control; any number of clients; clients share code by writing a database
Subversion features: Record every change
1.2 Version Model
The core task of the version control system is collaborative editing and data sharing

1.3 Building Subversion Services
[Email protected] ~]# yum-y Install subversion #装包
[Email protected] ~]# MKDIR/VAR/SVN
[Email protected] ~]# svnadmin create/var/svn/project #创建共享目录
[Email protected] ~]# Ls/var/svn/project
Conf db format Hooks Locks README.txt
[Email protected] system]# Cd/usr/lib/systemd/system
#导入数据 (experiment with this path as data import)
[[Email protected] system]# SVN import. file:///var/svn/project/-M "First Code"
#-m "Comments"
[Email protected] ~]# SVN list file:///var/svn/project #查看共享目录内的内容
[Email protected] ~]# cd/var/svn/project/#这样是看不到的
1.4 Modifying a configuration file
[Email protected] ~]# vim/var/svn/project/conf/svnserve.conf
Anon-access = None #匿名无任何权限
auth-access = Write #输入密码的账户 (active account) readable and writable
Password-db = passwd #密码文件
Authz-db = Authz #ACL访问控制列表文件
[[email protected] ~]# vim/var/svn/project/conf/passwd #用户名, password file
[Email protected] ~]# Vim/var/svn/project/conf/authz #针对每个文件做权限
[/] #定义ACL访问控制= RW #所有人可以对共享目录rw
[/test] #对/test definition tom = rw #tom rw Harry = r #harry可r
[/ABC]
= #所有人不可以
For this case: [/] Tom = rw Harry = RW
1.5 Starting the Service (2 methods)
[[email protected] ~]# svnserve-d-r/var/svn/project/#指定一个目录共享出去-D background
[Email protected] ~]# systemctl start Svnserve #所有目录都共享出去
1.6 Client Testing
[Email protected] ~]# cd/tmp
[[Email protected] tmp]# SVN co--username Tom--password 123456 svn://192.168.2.100/
Code #co: Checkout (check download) user name password where to download the stored directory (automatically create local copy)
[Email protected] code]# vim User.slice #在目录code下随便修改一个文件
[Email protected] code]# svn ci-m "Code2" #改完之后上传 ci (comit)
There are 2 versions of the files that are saved on the server side
1.7 Other commands
[[email protected] code] #svn update #更新数据
[Email protected] ~]# SVN info svn://192.168.2.100 #查看版本仓库信息
[Email protected] ~]# SVN log svn://192.168.2.100 #查看版本修改历史
Add command
Write two scripts test.sh test1.sh
[Email protected] ~]# Cd/tmp/code #需要在本地副本内操作
[[email protected] code] #svn add + filename #本地版本库添加新文件
The current location must be the location of the download file, and the new file needs to be placed in the directory
[[Email protected] code]# SVN list svn://192.168.2.100 | grep test #添加的test. SH did not find
[[Email protected] code]# svn ci-m "add Test"
[[Email protected] code]# SVN list svn://192.168.2.100 | grep test
test.sh
test1.sh
mkdir command
[[Email protected] ~] #svn mkdir + directory
[[Email protected] code]# SVN mkdir test
[[Email protected] code]# CD test
[Email protected] test]# echo "Add test File" > Abc.txt
[[Email protected] test]# SVN add abc.txt
[[Email protected] test]# svn ci-m "mkdir and Add File"
del command
[[Email protected] ~] #svn del + file
#不会自动提交到版本库, local deleted, still exists on the server, requires SVN ci-m
[Email protected] code]# svn ci-m "del test.sh" #真正在库内删除
List command
[[Email protected] ~] #svn list svn://192.168.2.100 #文件列表
[[Email protected] ~] #svn mv/cp/rm
[[email protected] code] #svn diff #本地副本库和服务器中文件对比

Two types of modified replicas
1, local modification, not submitted
[Email protected] code]# vim Zram.service #本地删除里面数据
[Email protected] code]# svn revert zram.service #数据恢复
"Zram.service" has been restored
Revert local copy is modified but not CI committed, data recovery can be
2, local modification, submit
[Email protected] code]# svn merge-r7:5 zram.service #将7版本还原为5版本
[Email protected] tmp]# SVN-R1 Co svn://192.168.2.100 code2
Take out the first version and put it in Code2.

More than 1.8 people collaborate:
Environment: Operations that are logged on by different users on different clients
1. Modify different files
[[Email protected] code]# SVN update
[[Email protected] code]# SVN update
#两台保持相同内容
Web1 Modify a file and upload the version update +1
WEB2 modify another file, upload, version update +2
At this time Web1 modified WEB2 not modified, WEB2 modified WEB1 not modified
The same version of SVN update, respectively, relative to the original +2
2. Modify different contents of the same file
Web1 Modify a file and upload the version update +1
WEB2 Modify the same file, upload, prompt expires, SVN update version update +1 (modified place is not overwritten!!) ), and upload version update +1 (total +2)
WEB1 SVN update Version +1
3, modify the same content of the same file (conflict, think resolved)
Web1 Modify a file and upload the version update +1
WEB2 Modify the same file, upload, prompt expires, SVN update, hint: In "/tmp/code/user.slice" found conflict.
Select: (P) defer, (DF) Show all differences, (e) Edit,
(MC) My version, (TC) Other people's version,
(s) Show all options:
Select p after a few more versions in the directory, delete the not, and then upload

[Email protected] code]# svnadmin dump/var/svn/project/> My.bak #所有版本都进行了备份
[Email protected] code]# svnadmin load/var/svn/project2/< My.bak #还原

2. RPM Package
1). RPM is a compressed package (source after the installation of the directory)
2). RPM contains some descriptive information
2.1 Implementation steps:
1) Install the Rpm-build package
[Email protected] ~]# yum-y install Rpm-build
2) Generate RPMBUILD directory structure
[Email protected] ~]# Rpmbuild-ba xx.spec #生成rpmbuild目录以及子目录
[[email protected] ~]# ls rpmbuild/
BUILD buildroot RPMS SOURCES SPECS SRPMS
SOURCES: directory where source packages are stored
SPECS: Configuration file (basic information, source installation)
BuildRoot: Rhizoids (for rpmbuild This software, packed under this root, does not affect the real root)
RPMS: The position of the finished product, RPM package
3) Prepare to copy the source software to the sources directory
In the case of Nginx source package:
[email protected] ~]# CP lnmp_soft/nginx-1.8.0.tar.gz/root/rpmbuild/sources/
4) Create and modify spec configuration file
[Email protected] ~]# vim Rpmbuild/specs/nginx.spec
Fill in the Software information
LICENSE:GPL #此软件定义为开源
%prep #源码包解包, and CD in
%setup-q

%build #配置编译
%configure #模块化配置, can be replaced by./configure--with-http_ssl_module
Make%{?_smp_mflags}

%files
%doc
/usr/local/nginx/* #将该路径下所有打包
5) Installation Dependencies and packaging
[Email protected] ~]# yum-y install gcc pcre-devel zlib-devel
Openssl-devel (http_ssl_module) need to install this
[Email protected] ~]# CD rpmbuild/
[Email protected] rpmbuild]# Rpmbuild-ba Specs/nginx.spec
[[email protected] ~]# ls rpmbuild/rpms/x86_64/
nginx-1.8.0-40.x86_64.rpm nginx-debuginfo-1.8.0-40.x86_64.rpm
6) can use custom Yum Warehouse installation

Linux Operation learning------svn/rpm Packaging

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.