- Начало работы с SVN на Linux
- SVN Linux | Getting Started With Subversion on Linux
- 1. Connect via SSH
- 2. Update the OS Packages and Install SVN in Linux
- 3. Check SVN Version
- 4. Create a system user account
- 5. Create a new directory for your project/application/website files:
- 6. Configure permissions
- 7. Create a ‘passwd’ file
- 8. Create the conceptual groups, configure permissions
- 9. Other Commands for SVN in Linux
- Установка и настройка svn сервера под linux
- /srv/svn/conf/apache.conf
- /srv/svn/conf/users-access-file
- Simple guide to install SVN on Linux : Apache Subversion
- Install SVN on Linux
- Step 1- Install SVN
- Step 2 – Creating SVN directory
- Step 3 – Install Apache & mod_dav_svn
- Step 4– Enabling modules & configuring Apache server
- Step 5 – Creating SVN user accounts
- Step 6 – Accessing the SVN repository
Начало работы с SVN на Linux
Во- первых, установим SVN на Linux
Для того чтобы установить SVN, необходимо подключиться к Linux VPS через SSH.
Если вы используете Ubuntu, обновите пакеты ОС и установите SVN на сервере, используя следующие команды:
Если вы используете CentOS, вы можете использовать следующую команду для обновления пакетов ОС и установки SVN:
Чтобы проверить версию SVN, установленной на вашем сервере, используйте следующую команду:
Создайте учетную запись пользователя системы и переключитесь на этого пользователя:
Замените ‘someuser’ на действительное имя пользователя.
Создайте новый каталог для ваших файлов проекта/приложений/веб-сайта:
Создайте хранилище SVN с помощью следующей команды:
Установите соответствующие права доступа к файлам. Распределения на основе Debian, выполните следующую команду:
О распределении RPM на основе (при использовании Apache в качестве веб-сервера), выполните следующую команду:
Создайте файл ‘passwd’ в каталоге /home/someuser/svn/myapp/conf/passwd на сервере, который содержит информацию о аутентификации пользователя:
Если вы хотите добавить пользователей, используйте ту же команду, но без переключателя ‘-c‘, чтобы избежать перезаписи файла passwd.
Назначение разрешений для пользователей SVN с помощью файла authz (/home/someuser/svn/myapp/conf/authz):
Создание концептуальных групп, которые вам нужны, а затем добавить к нему пользователей:
Выберите уровень доступа с обоих разрешений и уровня проекта:
Чтобы дать разрешения для чтения и записи “allaccess” для пользователей, добавьте:
Для того, чтобы дать доступ только для чтения к “someaccess” пользователям к некоторому проекту нижнего уровня, добавьте:
Для того, чтобы скопировать неверсионное дерево вашего проекта/файлов веб-сайта и начать отслеживать в вашем хранилище SVN и создать промежуточные каталоги, введите следующие команды:
Вы можете создать единое хранилище для каждого проекта/сайта на каком – то центральном месте, где вся история.
Чтобы создать рабочую копию в другой локальный каталог, используйте:
Для того, чтобы отправить изменения из рабочей копии в хранилище, используйте:
Используйте команду ‘svn add /path/file’, чтобы добавить файл из рабочей копии в хранилище). Файл будет добавлен в хранилище, когда вы делаете commit SVN.
Чтобы удалить файл из рабочей копии (или хранилище), используйте:
и файл будет удален из хранилища после команды svn commit.
Чтобы обновить изменения из хранилища в рабочую копию, используйте:
При наличии нескольких авторов, работающих над проектом/веб-сайтом, они имеют локальные рабочие копии на нескольких машинах, всегда запускайте команду ‘svn update’ перед внесением изменений в файлы, доступные в вашей рабочей копии. После этого, вносите изменения в файлы, а затем зафиксируйте изменения в хранилище после того, как только файлы будут изменены.
Для того чтобы применить различия между двумя источниками на пути в рабочей копии, используйте:
Для того, чтобы увидеть различия между этими двумя конкретными версиями файла, используйте:
Если вы нашли ошибку, пожалуйста, выделите фрагмент текста и нажмите Ctrl+Enter.
Источник
SVN Linux | Getting Started With Subversion on Linux
We will show you how to install SVN in Linux. Subversion or commonly abbreviated as SVN is an open-source software versioning and revision control system. It allows users to maintain current and historical versions of files such as source code, web pages, documents, and other electronic data. Installing SVN in Linux, is not so complicated, just follow the steps in the tutorial below and you should have it done in 10 minutes. We are also going to show you, some basic SVN commands in Linux.
Table of Contents
1. Connect via SSH
Please remember to replace 1.1.1.1 with the IP address of your server and 2222 with the listening port of your server’s SSH daemon.
2. Update the OS Packages and Install SVN in Linux
If you are using an Ubuntu VPS, update the OS packages and install SVN on your server using the commands below:
If you are using a CentOS VPS, you can use the following command to update the OS packages and install SVN:
3. Check SVN Version
To check the version of SVN installed on your server, use the following command:
4. Create a system user account
Create a system user account and switch to that user:
Replace ‘someuser’ with the actual username.
5. Create a new directory for your project/application/website files:
Create an SVN repository using the following command:
6. Configure permissions
Set the proper file permissions. On Debian based distributions, run:
On RPM-based distributions (if using Apache as a web server), run:
7. Create a ‘passwd’ file
Create a ‘passwd’ file to the /home/someuser/svn/myapp/conf/passwd directory on your server which contains user authentication details:
If you want to add additional users, use the same command, but without the ‘-c’ switch to avoid overwriting the passwd file.
Assign permissions to SVN users using the authz file (/home/someuser/svn/myapp/conf/authz):
8. Create the conceptual groups, configure permissions
Create the conceptual groups you want, then add people to it:
Choose what access they have from both the permissions and project level:
To give read and write permissions to ‘allaccess’ users, add:
To only give read-only access to ‘someaccess’ users to some lower level project, add:
9. Other Commands for SVN in Linux
In order to copy an unversioned tree of your project/website files and begin tracking in your SVN repository and create intermediate directories, use the following command:
You can create a single repository for each project/website at some central place where all the history is and which you checkout and commit into.
To create a working copy to another local directory, use:
In order to send changes from your working copy to the repository, use:
Use ‘svn add /path/file’ command to add a file from the working copy to the repository). File will be added to the repository when you do an svn commit.
To delete a file from the working copy (or repository), use:
and the file will be deleted from the repository after the svn commit command.
To update changes from the repository into a working copy, use:
If there are multiple authors working on the project/website and they have local working copies on multiple machines, always run the ‘svn update’ command before making changes to files available in your working copy. After that, make changes to files, then commit changes to the repository once the files are done being modified.
In order to apply the differences between two sources to a working copy path, use:
To see the differences between the two specific revisions of a file, use:
Of course, you don’t have to Install SVN in Linux, if you use one of our Subversion Hosting services, in which case you can simply ask our expert Linux admins to install and configure SVN in Linux for you. They are available 24×7 and will take care of your request immediately.
PS . If you liked this post on how to install SVN in Linux, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.
Источник
Установка и настройка svn сервера под linux
sudo apt-get install subversion libapache2-svn
- subversion – svn сервер
- libapache2-svn – библиотека, которая добавляет модуль апача для его интеграции с svn
И на всякий случай уточню, что sudo означает, что команда запускается с права root’а. Вы можете в консоли предвариетльно просто написать su, ввести пароль и потом выполнять эту и последующие аналогичные команды без приставки sudo.
Теперь добавляем нового пользователя и группу SVN
sudo useradd -m -d /srv/svn/ -g svn svn
Тут первой строкой мы создали группу svn. А второй строкой мы создали пользователя svn и сразу добавили его в группу svn. Поясню про флаги команды useradd:
- -m -d /srv/svn – автоматическое создание домашнего каталога (флаг -m) и установка этого каталога как базового (-d) . В эту папку мы позже положим конфиги svn и репозитории так же будем тут размещать.
- -g svn— добавить нового пользователя в группу svn
- svn – имя пользователя
svnadmin create /srv/svn/repositories/firstproject/
Первой строкой мы перелогинились под пользователя svn. Затем создаём папку repositories. В этой папке будут храниться наши репозитории. Далее создали папку для нашего первого проекта. И наконец командой svnadmin create /srv/svn/repositories/firstproject/ мы создаём новый пустой репозиторий для нашего проекта по указанному пути.
Теперь создаём конфиги для нашего SVN сервера.
mkdir /srv/svn/conf/
cd /srv/svn/conf/
touch apache.conf
При помощи команды touch мы просто создаём новый пустой файл.
Теперь содержимое этих файлов:
/srv/svn/conf/apache.conf
# our access control policy
#try anonymous access first, resort to real
#authentication if necessary.
# how to authenticate a user
AuthName «Subversion repository on yas-desktop»
Вкратце по директивам.
- SVNParentPath /srv/svn/repositories/ – указываем путь к репозиториям
- AuthzSVNAccessFile /srv/svn/conf/users-access-file – путь к файлу, в котором указывается какого пользователя к какому проекту и с какими правами пускать (ниже будет чуть подробнее)
- AuthUserFile /srv/svn/conf/passwd – в этом файле хранятся зашифрованные пароли пользователей. Этот файл мы чуть ниже создадим при помощи утилитки htpasswd.
/srv/svn/conf/users-access-file
Первыми двумя строками мы запрещаем доступ анонимам к репозиториям. Т.е. мы как быговорим: «всем (*) доступ к корню репозиториев ([/]) пустой (т.к. после знака равно мы ничего не указали. А если бы там было r, то это означает чтение; w – запись)».
А затем мы даём для пользователя yas доступ на чтение и запись к репозиторию.Подробнее про то, как можно задавать различные права для разных пользователей и как создавать для удобства группы пользователей читайте тут
Идём дальше. Чтобы пользователь yas получил туда доступ, ему будети предложено авторизоваться. Для этого надо установить для него пароль. А для этого мы создадим файл /srv/svn/passwd (мы указывали этот файл в apache.conf для авторизации) при помощи утилиты htpasswd
Создаём /srv/svn/conf/passwd
htpasswd -c -m /srv/svn/conf/passwd yas
- -m – метод криптования будт использован MD5
- -c – означает, что файл надо создать. Используйте этот флагш только для того, чтобы создать этот файл впервые. Далее для добавления пользхователей используйте команду
htpasswd -m /srv/svn/conf/passwd newusername
- /srv/svn/conf/passwd – путь к файлу, куда сохранять пароль
- yas – имя пользователя
После ввода этой команды вам будет предложено ввести два раза пароль для вашего пользователя.
Источник
Simple guide to install SVN on Linux : Apache Subversion
Apache Subversion or as it is normally called, SVN, is a Software versioning & revision control system. It has been around since year 2000 & still is being used by organizations & open source communities worldwide. In fact many big open source projects like ruby, python, apache, source forge etc have been using SVN.
It is easy to setup & administer, also provide fast & flexible update commits. There are number of clients available to use for various operating systems for using SVN. But like any other software its not perfect & has some limitations, like when it comes to speed it tends to be bit slower than other & there is a known bug relating to renaming files and folders.
Though in latest times, SVN has lost its shine to GIT and other version control system but none the less many still prefer to use it. In this tutorial, we will learn to install SVN on Linux systems (Ubuntu & CentOS).
Install SVN on Linux
Step 1- Install SVN
Firstly, we will start by installing SVN on our system. To do that, execute the following command from your terminal,
For CentOS,
$ sudo yum update
$ sudo yum install subversion
For Ubuntu,
$ sudo apt-get update
$ sudo apt-get install subversion
Once we have installed SVN, next step is to create a directory for SVN & also modifying its permissions & ownership.
Step 2 – Creating SVN directory
We will be using ‘/var/www/svn’ as our SVN directory. Create the directory with the following command,
$ sudo mkdir /var/www/svn
Now create a new folder inside the SVN directory for our first repository,
$ cd /var/www/svn
Now we will create our first SVN repo inside the /var/www/svn folder with the following command,
$ sudo svnadmin /var/www/svn/first-repo
Next we will change the svn folder ownership to user and group for apache server,
$ sudo chown -R apache:apache /var/www/svn
For Ubuntu, apache user is ‘www-data’, so the command to change ownership of the svn folder will be,
$ sudo chown -R www-data:www-data /var/www/svn
Also, make sure that it has 755 permissions (usually it’s the default permissions),
$ sudo chmod -R 755 /var/www/svn
Step 3 – Install Apache & mod_dav_svn
Apache is a webserver & module mod_dav_svn is used to allow access to repository using HTTP i.e. apache webserver. Install both the packages with the following command,
For CentOS,
$ sudo yum install httpd mod_dav_svn
For Ubuntu
For Ubuntu, we need some other packages as well. Install them using the following command,
$ sudo apt-get install apache2 libapache2-mod-svn libapache2-svn
Step 4– Enabling modules & configuring Apache server
Now we will enable the module mod_dav_svn & also will make the configuration changes for enabling SVN repository on webserver. We will be configuring SVN with basic authentication, so that our repository in not open to all & can only be accesses by valid users.
Make the changes as follows
For CentOS,
$ sudo vi /etc/httpd/conf.modules.d/10-subversion.conf
& make the following entries into the file,
LoadModule authz_svn_module modules/mod_authz_svn.so
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule dontdothat_module modules/mod_dontdothat.so
DAV svn
SVNParentPath /var/www/svn
AuthType Basic
AuthName «SVN Repo”
AuthUserFile /etc/svnusers
Require valid-user
Now save the file & exit. Next step is to restart the apache service to implement the changes.
$ sudo systemctl restart httpd
For Ubuntu
To enable the module in apache, we need not make any file entries rather we need to execute the following command from our terminal,
$ sudo a2enmod dav
$ sudo a2enmod dav_svn
Next open the Apache svn config file, which for Ubuntu is located at following location “/etc/apache2/mods-enabled/dav_svn.conf” ,
$ sudo nano /etc/apache2/mods-enabled/dav_svn.conf
& make the following entry to the file,
DAV svn
SVNParentPath /var/www/svn
AuthType Basic
AuthName «SVN Repo»
AuthUserFile /etc/svnusers
Require valid-user
Save the file by pressing ‘CTRL+X’ & restart the apache service to implement the changes made,
$ sudo systemctl restart apache2
Step 5 – Creating SVN user accounts
We will now create couple of users to access the SVN server via http. Open terminal & run the following command to create users,
$ sudo htpasswd -cm /etc/svnusers svn1
$ sudo htpasswd -m /etc/svnusers svn2
We will be prompted to enter the password, provide one & than re-enter it to confirm. Also restart the Apache service, once you have added the users.
Step 6 – Accessing the SVN repository
We have now configured our first SVN repository & are now ready to access it. To access the SVN repository, open your web browser & enter the following URL,
http://127.0.0.1/svn/first-repo
This should open the SVN authentication page & upon successful authentication, we can access our SVN repo. Replace the IP address with the yours accessing it on remote systems.
That’s it guys, we now end our tutorial on how to install SVN on Linux machines. Please feel free to send in any queries/suggestions using the comment box below.
If you think we have helped you or just want to support us, please consider these :-
Donate us some of your hard earned money: [paypal-donation]
Linux TechLab is thankful for your continued support.
Источник