repo 文件是 yum 源(软件仓库)的配置文件,通常一个 repo 文件定义了一个或者多个软件仓库的详细信息,例如我们将从哪里下载、安装、升级软件包,repo 文件中的设置将被 yum 读取和应用
以下就是搭建repo服务器端的步骤,有了它我们也能像Android项目那样在linux系统下同时管理几百个工程了。
Step 1. 构建git server (ip is 192.168.5.141).
Step 2. Run following commands to initialized manifest.git repository on the server machine with "Frank" user privilege.
mkdir repositoriescd repositories
git init --bare manifest.git
Step 3. Run following commands to initialized a test git repository in the same path with manifest.git with "Frank" user privilege.
cd repositoriesgit init --bare project1.git
Step 4. Run following command on the server machine with administrator privilege.(有什么用?)
sudo gedit /etc/sv/git-daemon/runModify the last line to:
exec git-daemon --verbose --enable=receive-pack --export-all <strong>--base-path=/home/Frank/repositories</strong>
Reboot the machine
Step 5. Customize manifest.git
Login a client machine, run following command to clone manifest.git repository:
mkdir MyRepocd MyRepo
git clone Frank@192.168.5.141:repositories/manifest.git
cd manifest
Create a default.xml file with following content:
<?xml version=<span
class="code-quote">"1.0"</span> encoding=<span
class="code-quote">"UTF-8"</span>?>
<strong><manifest></strong>
<remote name=<span class="code-quote">"korg"</span>
fetch=<span class="code-quote">"git:<span
class="code-comment">//192.168.5.141/"</span> review=<span
class="code-quote">"review.source.android.com"</span> />
</span>
<strong>
<<span class="code-keyword">default</span>
revision=<span class="code-quote">"master"</span>
remote=<span class="code-quote">"korg"</span> />
<project path=<span class="code-quote">"project1"</span>
name=<span class="code-quote">"project1"</span>
/></strong>
</manifest>
Run following command to commit default.xml file
git add --all
git commit -a -m <span class="code-quote">"add <span class="code-keyword">default</span>.xml"</span>
git push --all
Step 6. Customize Project1.git
Login a client machine, run following command to clone project1.git repository:
cd MyRepogit clone Frank@192.168.5.141:repositories/project1.git
cd project1
echo <span class="code-quote">"Hello Project1"</span> > Hello.txt
Run following command to commit Hello.txt file
git add --all
git commit -a -m <span class="code-quote">"add Hello.txt"</span>
git push --all
Step 7. Test the repo server
Run following command on the client machine side.
mkdir bin<pre>
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
Export ~/bin to system enviroment path.
mkdir MyProject
cd MyProject
<strong>
repo init -u git:</strong><span class="code-comment"><strong>//192.168.5.141/manifest.git</strong>
</span>
repo sync
使用yum进行安装,为了提高速度,最好先是修改为中国CentOS镜像服务器。目前国内有三个镜像可以选择,分别是:中国科学技术大学、163和Sohu的镜像,建议教育网用户选择中科大,电信用户选择163,他们的repo文件本博客作了备份如下:http://yupengyan.com/wp-content/uploads/2012/02/CentOS6-Base-163.repo_.txt
http://yupengyan.com/wp-content/uploads/2012/02/CentOS6-Base-sohu.repo_.txt
http://yupengyan.com/wp-content/uploads/2012/02/CentOS6-Base-ustc.repo_.txt
下面命令是备份CentOS-Base.repo文件,并修改使用163镜像作为yum源:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.save
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
mv CentOS6-Base-163.repo /etc/yum.repos.d/CentOS-Base.repo
欢迎分享,转载请注明来源:夏雨云
评论列表(0条)