Cookie Notice
This site utilizes cookies to improve your browsing experience, analyze the type of traffic we receive, and serve up proper content for you. If you wish to continue browsing, you must agree to allow us to set these cookies. If not, please visit another website.
Setup SVN With Attached Drives on CentOS
These are the step that I took to create a SVN server using CentOS 7, while attaching drives as repositories instead of creating a monstrous system drive and importing everything there.
If you follow to a “T”, you too can have the play-ground I have =)
I will lay out my exact steps, including creating the virtual machine I used for this. If you are currently using a VM or dedicated machine then you can skip those steps. I imagine this would work on CentOS 5 and up, but don’t quote me on that.
- Create VirtualBox Virtual Machine
- Have a CentOS ISO ready
- I chose v7 as the latest
- Setup with 20G hard disk, Bridged Networking, 4G Ram, 2 Processors, 3 – 1GB test disks, no sound, minimal video memory
- Install CentOS as Basic Web Server, no GUI
- Include PHP, Perl, Python, NFS during initial install
- No need for CPanel
- Reboot
- Run yum update
- Run systemctl start httpd.service
- Run systemctl enable httpd.service
- Run the following 3 to allow ports 80 and 443 through the firewall
- firewall-cmd –permanent –zone=public –add-service=http
- firewall-cmd –permanent –zone=public –add-service=https
- Have a CentOS ISO ready
- firewall-cmd –reload
- Now change SELinux to disabled in /etc/selinux/config, change SELINUX=enforcing to SELINUX=disabled
- Run yum install subversion mod_dav_svn
- Run the following
- mkdir /svn
- mkdir /var/www/svn
- chown –R apache:apache /svn
- chown –R apache:apache /var/www/svn
- Now we need to configure SVN
- Run nano /etc/httpd/conf.modules.d/10-subversion.conf
- Add In:
Alias /svn /var/www/svn
<Location /svn>
DAV svn
SVNParentPath /svn/
AuthType Basic
AuthName “Emagine Repositories”
AuthUserFile /etc/svn-auth-users
Require valid-user
</Location>
- The save the file by hitting CTRL-O, then CTRL-X to exit nano
- Now we need to setup user access
- Only the first user created needs the –c flag, all the rest need only the –m flag
- Run htpasswd –cm /etc/svn-auth-users kpirnie
- For some reason, I had to run this command twice
- Type in the new password twice
- And now the fun begins… I made 3 1GB dummy disks before, when setting up the VM, now we need to partition, format, mount them
- Run the following commands on each disk (NOTE: You can skip this step if simply attaching storage, run fdisk –l to see what’s attached for disks)
- fdisk /dev/sdb
- n
- Run the following commands on each disk (NOTE: You can skip this step if simply attaching storage, run fdisk –l to see what’s attached for disks)
- default the next 4 to create a primary partition using all space
- w
- mkfs.ext4 /dev/sdb1 (sdc1, sdd1 as well)
- Mount the disks
- mkdir /mnt/Disk1 (also for Disk2 and Disk3)
- nano /etc/fstab
- add in a line for each disk, and make sure there is an empty line at the end of the file
- /dev/sdb1 /mnt/Disk1 ext4 defaults 0 0
- Repeat as necessary for each disk attached
- Remount everything with mount –a
- You can use step b above to mount any disk you have attached to the server
- Now we add the proper permissions
- Run the following for each disk added (replace Disk* for your mount point)
- chown -R apache:apache /mnt/Disk1
- chcon -h system_u:object_r:httpd_sys_content_t /mnt/Disk1
- chcon -h apache:object_r:httpd_sys_content_t /mnt/Disk1
- Now create & import the repos (replace Disk* with each disk you mounted, or whatever you want to name it)
- mkdir –p /mnt/Disk1/{trunk,branches,tags}
- Copy all content from the disk to the ‘trunk’ directory we just created
- svnadmin create /svn/Disk1
- mkdir –p /mnt/Disk1/{trunk,branches,tags}
- Run the following for each disk added (replace Disk* for your mount point)
- svn import –m “Initial Import” /mnt/Disk1 file:///svn/Disk1