Hardware: MacBook Pro 15-inch, mid-December 2012
System: OS X 10.8.3
Software: virtualbox 4.2.10 r84104 + ubuntu-12.04.2-server-i386 + xcode 4.6.2
Objective: To build a SVN server using virtualbox on a Mac, there is no practical application, mainly to learn related operations.
1. Install virtualbox
Double-click virtualbox. PKG and follow the general steps for installing software on Mac.
After the installation is complete, no such information is displayed.
2. Install Ubuntu-Server
Click "new" to create a virtual computer named "svnserver", whose type is "Linux" and whose version is "ubuntu". Click "continue"
Set the "memory size". It does not need to be too large here. Use the recommended value.
Add a virtual hard disk and select "create virtual hard disk now (c )"
Select VDI,
"Dynamic Allocation" or "fixed size", select the former
Select the virtual hard disk file name and the location to save, and set the maximum size of the virtual hard disk. In fact, there is no need to 32 GB, but it is enough to manage the source code.
After completing the preceding steps, the main page is displayed as follows:
Note that the network is displayed as Nat
Optional: click "network" to check the connection method "Network Address Translation (NAT)". No problem. The Nat method is effective for the automatic network configuration in the early stage, however, after configuring the svn service, we need to change the connection method to make it easier for the host to access the svn server. At this time, we do not need to change the NAT mode.
Choose "Settings"> "Storage"> "no cd"> "Assign drive (d)" from the virtualbox main interface, select the Ubuntu-server CD image file
Click OK and return to the virtualbox main interface. Click the "Start" button to start the virtual computer and go to the Ubuntu installation page. Select "Chinese (simplified)" here. Of course, this will pose a hidden danger in the future, however, I will ignore it now. Selecting Simplified Chinese is the next few steps to facilitate reading. If the English is good, it would be nice to directly select "English.
OK. Go to the Ubuntu installation main interface. Please read the options carefully.
Optional: Press "FN" + "F4" on the keyboard at the same time, enable the "Mode" option, and select "install a minimum Virtual Machine", because only the personal SVN server is used for testing, so there is no need to be that big
After selecting the language, click "enter" to start installation. A language selection warning is displayed. Ignore it and click "yes" to continue.
The next step is "configure the keyboard"
Select English for keyboard layout (USA)
Next, configure the network.
Set user name and password
If the password is less than 8 characters long, a warning is displayed. Ignore it.
Configure encryption for the main directory
Clock Validation
Disk Partition
OK, and finally enter the basic system for Installation
The "configuration Package Manager" exists in the middle. If an HTTP proxy is available, ignore it.
Automatic update?
Software selection. Here I have selected several more installation packages. In order to configure other services in the future, it is not necessary to select so many as SVN servers.
Because the selected package contains database-related information, the following dialog box is displayed: Enter and confirm Database Password.
Install grub on the hard disk and select "yes"
The installation is complete. As virtualbox has automatically launched the image disc, you can simply "continue ".
Login successful
3. A minor problem with VIM + subversion +
Ping Baidu and check if the network is connected. (Google is used to query information and Baidu is used to test connectivity. Haha !)
Smooth connection: ifconfig to view local information
This is Shenma! Chinese characters are garbled !! Well, after careful consideration, I understand that this is why the system language has chosen Chinese. The following are some modifications.
Optional: Install VIM: sudo apt-Get install Vim (for later convenience, if you are familiar with Vi, you can directly use VI to perform the following operations)
After installation is complete
Sudo Vim/var/lib/locales/supported. d/local
Delete the first line "zh_cn gb2312", retain only the "en_US.UTF-8 UTF-8"
Continue Modification
Sudo Vim/etc/default/locale
Set the following content
Lang = "zh_CN.UTF-8"
Language = "zh_cn: ZH"
To:
Lang = "en_US.UTF-8"
Language = "en_us: en"
Run sudo locale-gen
Sudo shutdown-R now restart immediately and log on to ifconfig again,
OK. Everything works. Next.
Sudo apt-Get install Subversion
The prompt "Subversion is already the newest version!" is displayed! It seems that a previously selected software package already contains the Subversion Installation File. Of course, if you have not made any choice before, executing this command will also install the Subversion smoothly.
4. Configure Subversion
Create SVN directory
Sudo mkdir/var/SVN
Create SVN Repository
Sudo svnadmin create/var/SVN
Complete the above two steps
Run the following LS command after CD/var/SVN:
The version repository has been created.
Next
Sudo Vim/var/SVN/CONF/svnserve. conf
Remove the # Before [general], anon-access, Auth-access, and password-dB, and modify anon-access = none to prevent unauthenticated users from reading SVN. Note: all rows must have the top level; otherwise, an error is returned.
Continue to sudo Vim/var/SVN/CONF/passwd
Remove the # sign before [users]
Add a line of luanqunmo = 123456 (add a user with the username luanqunmo and password 123456)
Start the Subversion server after saving AND EXITING
Sudo svnserve-d-r/var/SVN -- listen-host 10.0.2.15.
-D Indicates running in the background, and-R specifies the root directory of the server, so that you can directly access the server using SVN: // server IP address.
5. Import subversion + a small problem
Ping the MAC system.
Ping failure! The first time I encountered this problem, I got stuck for a long time and failed to solve several problems. However, I finally solved the problem.
First, sudo shutdown-H now
Click "set"> "network" on the main interface of virtualbox, change "connection mode" to "bridge nic", and "all allowed" to "all allowed", as shown in figure
Click "OK" and restart the VM. After logging on to the VM, view the changes in ifconfig as follows:
Go back to Mac and start the terminal.
Ping 192.168.1.7
OK. Ping successfully.
Return to the virtual machine and restart the svnserve service.
Sudo svnserve-d-r/var/SVN -- listen-host 192.168.1.7
Next
Use xcode to create a test project on Mac
Enter the project root directory and run the following command:
SVN import SVN: // 192.168.1.7 -- username luanqunmo -- password 123456
The following two errors may be reported:
(1) Can't open file 'xxxxxxxxdbtxn-current-lock': access is denied.
(2) The system prompts that the luanqunmo-related key is not found in the pop-up box.
Solution:
Return to the VM and run the following command on/var/SVN:
Sudo chmod-r o + RW/var/SVN
Go back to Mac and execute
SVN import SVN: // 192.168.1.7 -- username luanqunmo -- password 123456
Prompt committed Revision 1. Smooth import testsvnproject project!
6. Checkout Subversion
Open xcode-> select window-> select Organizer-> Repositories
Click "+" in the lower left corner and select "add repository... enter name and location. If the word authentication required is displayed, the connection is successful. If the correct location is entered, the word authentication required is not displayed.
Click Next and enter the user name and password in the pop-up box.
OK. Click the added testprojectsvn on the left side of repositories. Everything works.
Next, click testprojectsvn-> root-> checkout-> Select Directory-> end!
So far, all the operations have ended. I have not made any effort to optimize SVN management, SET related IP addresses, and complete the structure of the uploaded code.