Detailed steps for migrating SVN code base from old server to new server in Linux environment

Li Yang's Blog 2023-11-16 3.29 K Reading 1 Comments

Last article updated: November 17, 2023 Has exceeded one hundred and ninety-three No updates for days.

Once upon a time, I was also a fool. I didn't know whether it was because I was old or something else. When I encountered problems, I was not perfunctory. I always wanted to solve them. Just like this time, because the old host disk was full of renewal costs, I bought a new one while Alibaba was active. But the previous data was numerous and miscellaneous, and the project had SVN library, If it's a simple migration, it's OK. After all, the backup and recovery will be completed. This time, I wondered whether I could back up the SVN to the new server for direct use. Finally, after 36 hours of testing, I got the answer [Yes]. Otherwise, there would be no article. Ha ha~Maybe it's because it's stupid and takes a long time, Anyway, this SVN backup and migration is dust laden. The following is my backup and migration process.

 Detailed steps for migrating SVN code base from old server to new server in Linux environment Page 1

preparation:

First, back up the code and database of the website, but do not back up the [. svn] folder in the root directory of the website, because this svn has its own ID, which can not be directly used and is prone to errors. Normal backup and restore is enough. Then install and deploy the SVN function on the [New Server], and refer to【 Graphic and Text Tutorial of Building SVN Control System with Pagoda Linux Panel 】(Just refer to the database creation, and the later ones will not be used for the time being). In order to ensure that there is no error and memory confusion, it is recommended that the name of the SVN database be set the same as that of the [old server].
Then start to back up the website data and data to the new server, that is, the source code and database, and remember to delete the [. svn] folder in the root directory of the website after migration. It must be deleted, must be deleted, and must be deleted.

Operating Steps of Old Server

First, enter the directory of the SVN database to be backed up under [Old Server]. For example, if I want to back up [svngnqy], enter the code:

 cd /www/svndata/svngnqy

Run after entering the directory:

 svnadmin dump /www/svndata/svngnqy/ > svngnqy.dump

The code interpretation is to back up the SVN code base directory [svngnqy] on the [old server] to [svngnqy. dump]. In order to remember that the names I use are the same, the code is completed as shown in the figure below:

 Detailed steps for migrating the SVN code base from the old server to the new server in the Linux environment Page 2

Because I use the new SVN library for testing, the content is relatively small. At this time, if we go to the SVN library directory, we can see the backup file (shown in the figure below). After the backup is completed, there are two schemes to download,

The first (not recommended) scheme

Click the code and enter the code in [New Server]:

 Scp - v root @ IP address of the old server:/www/svndata/svngnqy/svngnqy.dump/www/svndata/svngnqy

Because we have completed the backup before, we now need to download it from the remote server to the new server. Because the previously created database has the same name, it is only for reference. Change the directory and name to the actual database name. In addition, when entering the root account password of the old server, use the [root] password instead of the SVN database. Don't ask me how to know, as shown in the figure:

 Detailed steps for migrating the SVN code base from the old server to the new server in the Linux environment Page 3

The second (suggested) scheme:

It is recommended to use FTP and other transmission tools for testing. After all, the svn database data I tested is small, and if it is large, it is a waste of time. As shown in the figure, it is completed using code migration, and the bottom is the backed up svn data. Download the backed up file and upload it to [New Server], as shown:

 Detailed steps for migrating the SVN code base from the old server to the new server in the Linux environment Page 4

[New Server] Operation Steps

Before restoring the SVN library, make sure that the source code and data of the website have been restored and the access is normal. This restoration is only for the data of the SVN library, not including the website and data. Don't make a mistake.

In [New Server], enter the directory where the SVN library is located again, as shown in the figure below. The first time, the SVN library was not created under the directory, so an error occurred. Here, it is said that the SVN library was established by preliminary preparations. If it was not established, you need to first create a new SVN library in the normal order. The name can be the same as the old server to avoid mistakes.

 cd /www/svndata/svngnqy

Then enter the restore command again:

 svnadmin load /www/svndata/svngnqy < svngnqy.dump

As shown in the figure, remember to enter the CD into the corresponding directory before entering the restore command.

 Detailed steps for migrating SVN code base from old server to new server in Linux environment Page 5

Write [svngnqy. dump]<(write) to the warehouse of [svngnqy] on the new server. The process depends on the size of the file. My file is small so it is fast, as shown in the figure.

 Detailed steps for migrating the SVN code base from the old server to the new server in the Linux environment Page 6

Up to now, [80%] of the backup and migration have been completed, and the remaining [20%] is simple, just not a reference【 Graphic and Text Tutorial of Building SVN Control System with Pagoda Linux Panel 】To create a new database, the next step is to set access permissions, course Yes, but there is a simple way, that is, directly download the [conf] file under the [old server] SVN library and the [post commit] file under the [/books/] directory, then give the [post commit] file [755] permission, and finally directly enter the synchronization code:

 Svn checkout svn://new server IP/svngnqy/www/wwwroot/liblog.cn

Where [svngnqy] is the name of the SVN database, [/www/wwwroot/liblog. cn] is the path to the website directory. Press Enter after confirmation, as shown in the figure:

 Detailed steps for migrating the SVN code base from the old server to the new server in the Linux environment Page 7

After the synchronization is completed, we just need to delete the [. svn] file in the local [look at the local. svn folder, don't delete the server] file directory, and then change the IP address of the [old server] to the IP address of the [new server], and then [check out]. What is not empty will be prompted. Click it to automatically synchronize. OK, so far, the tutorial steps have been explained in detail, Should I say no, I would like to call this article my best article of the year, not to mention the number of words, but this tutorial is a very successful one that I found after finding many articles. Of course, it may also be that I can't search and can't find a useful tutorial. In short, the tutorial is complete, and then I have to backup, download and restore one by one, I believe I will not see my article for a long time. Why? Because the work of article migration is big and boring, well, leave a message and feedback if there is a problem. Anyway, I can't solve it, so I will see that I don't speak!!!

Article copyright notice: unless otherwise noted Lao Li's Notes For original articles, reprints or copies, please use hyperlinks and indicate the source.

Comment

Quick reply: expression:
 Addoil Applause Badlaugh Bomb Coffee Fabulous Facepalm Feces Frown Heyha Insidious KeepFighting NoProb PigHead Shocked Sinistersmile Slap Social Sweat Tolaugh Watermelon Witty Wow Yeah Yellowdog
Comment List (Yes one Comments, three thousand two hundred and ninety People around)
 Netizen nickname: Li Yang Blog
Li Yang's Blog V Blogger  Sogou Explorer  Windows 10 x64 sofa
2023-11-14 From Liaoning reply
Believe me, I suggest you refer to it. If you can choose, I would rather rebuild in a new server than take the path of backup and migration...
 cancel
 WeChat QR code
 WeChat QR code
 Alipay QR code