搭建ubuntu arm/arm64的本地源
<p><span style="font-family: 楷体; font-size: 18px">参考:</span></p><p><span style="font-family: 楷体; font-size: 18px">搭建apt源</span></p>
<p><span style="font-family: 楷体; font-size: 18px">Ubuntu ARM更改为国内源</span></p>
<p class="postTitle"><span style="font-family: 楷体; font-size: 18px">使用Qemu运行Ubuntu文件系统(1)</span></p>
<p><span style="font-family: 楷体; font-size: 18px"> </span></p>
<p><span style="font-family: 楷体; font-size: 18px">针对arm和arm64,使用的是http://ports.ubuntu.com/ubuntu-ports/。下面以搭建arm64的本地源为例。</span></p>
<h1><span style="font-family: 楷体; font-size: 18px">概述</span></h1>
<p><span style="font-family: 楷体; font-size: 18px">有些私有云环境不允许连接互联网,这样的话云平台的虚拟机安装软件比较困难,因此就需要自己搭建apt源才行</span></p>
<h1><span style="font-family: 楷体; font-size: 18px">步骤</span></h1>
<p><span style="font-family: 楷体; font-size: 18px">我们使用apt-mirror制作apt源,因为会把包文件同步到本地,所以建议创建一个至少200G的磁盘,单独挂载用于存储数据。</span></p>
<h2><span style="font-family: 楷体; font-size: 18px">服务端配置</span></h2>
<h3><span style="font-family: 楷体; font-size: 18px">1、安装apt-mirror</span></h3>
<div class="cnblogs_code">
<pre><span style="font-family: 楷体; font-size: 18px">apt-get <span style="color: rgba(0, 0, 255, 1)">install</span> apt-mirror</span></pre>
</div>
<h3><span style="font-family: 楷体; font-size: 18px">2、修改apt-mirror配置文件</span></h3>
<div class="cnblogs_code">
<pre><span style="font-family: 楷体; font-size: 18px">vim /etc/apt/mirror.list</span></pre>
</div>
<p><span style="font-family: 楷体; font-size: 18px">参考以下配置文件:</span></p>
<div class="cnblogs_code">
<pre><span style="font-family: 楷体; font-size: 18px"><span style="color: rgba(0, 0, 0, 1)"># 以下注释的内容都是默认配置,如果需要自定义,取消注释修改即可
############# config ##################
set base_path </span>/gitlab/ubuntu_port_mirror/data_arm64/<span style="color: rgba(128, 0, 128, 1)">16.04</span><span style="color: rgba(0, 0, 0, 1)">
# set base_path </span>/var/spool/apt-<span style="color: rgba(0, 0, 0, 1)">mirror
#
# 镜像文件下载地址
# set mirror_path $base_path</span>/<span style="color: rgba(0, 0, 0, 1)">mirror
# 临时索引下载文件目录,也就是存放软件仓库的dists目录下的文件(默认即可)
# set skel_path $base_path</span>/<span style="color: rgba(0, 0, 0, 1)">skel
# 配置日志(默认即可)
# set var_path $base_path</span>/<span style="color: rgba(0, 0, 0, 1)">var
# clean脚本位置
# set cleanscript $var_path</span>/clean.<span style="color: rgba(0, 0, 255, 1)">sh</span><span style="color: rgba(0, 0, 0, 1)">
# 架构配置,armhf</span>/<span style="color: rgba(0, 0, 0, 1)">arm64,默认的话会下载跟本机相同的架构的源
set defaultarch arm64
# set postmirror_script $var_path</span>/postmirror.<span style="color: rgba(0, 0, 255, 1)">sh</span><span style="color: rgba(0, 0, 0, 1)">
# set run_postmirror </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">
# 下载线程数
set nthreads </span><span style="color: rgba(128, 0, 128, 1)">20</span><span style="color: rgba(0, 0, 0, 1)">
set _tilde </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">
#
############# end config ##############
#可以使用Ali yun的apt源(这里没有添加deb</span>-<span style="color: rgba(0, 0, 0, 1)">src的源)
deb https:</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">mirrors.aliyun.com/ubuntu-ports xenial main restricted universe multiverse</span>
deb https:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">mirrors.aliyun.com/ubuntu-ports xenial-security main restricted universe multiverse</span>
deb https:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">mirrors.aliyun.com/ubuntu-ports xenial-updates main restricted universe multiverse</span>
deb https:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">mirrors.aliyun.com/ubuntu-ports xenial-proposed main restricted universe multiverse</span>
deb https:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">mirrors.aliyun.com/ubuntu-ports xenial-backports main restricted universe multiverse</span></span></pre>
</div>
<h3><span style="font-family: 楷体; font-size: 18px">3、开始同步</span></h3>
<p><span style="font-family: 楷体; font-size: 18px">执行apt-mirror,然后就开始进行同步了,同步的镜像文件目录为/gitlab/ubuntu_port_mirror/data_arm64/16.04/mirror/mirrors.aliyun.com/ubuntu/,当然如果增加了其他的源,在/gitlab/ubuntu_port_mirror/data_arm64/16.04/mirror目录下还有其他的地址为名的目录。</span></p>
<h3><span style="font-family: 楷体; font-size: 18px">4、安装apache2</span></h3>
<div class="cnblogs_code">
<pre><span style="font-family: 楷体; font-size: 18px">apt-get <span style="color: rgba(0, 0, 255, 1)">install</span> apache2</span></pre>
</div>
<p><span style="font-family: 楷体; font-size: 18px">由于Apache2的默认网页文件目录位于/var/www/html,因此,可以做个软链接</span></p>
<div class="cnblogs_code">
<pre><span style="font-family: 楷体; font-size: 18px"><span style="color: rgba(0, 0, 255, 1)">ln</span> -s /gitlab/ubuntu_port_mirror/data_arm64/<span style="color: rgba(128, 0, 128, 1)">16.04</span>/mirror/mirrors.aliyun.com/ubuntu-ports /var/www/html/ubuntu160406/arm64/ubuntu-ports</span></pre>
</div>
<p><span style="font-family: 楷体; font-size: 18px">然后就可以通过如下地址访问了。</span></p>
<p><span style="font-family: 楷体; font-size: 18px">http://:/ubuntu #ip和port是自己本机的,其中端口默认为80。在测试时可能遇到打不开的情况,查看下本机和云平台的防火墙规则是否打开相关端口或者selinux的问题。</span></p>
<h3><span style="font-family: 楷体; font-size: 18px">5、服务器配置(可选)</span></h3>
<p><span style="font-family: 楷体; font-size: 18px">安装apache2,配置文件/etc/apache2/sites-enabled/000-default.conf,或者直接加一个新的配置文件,文件内容:</span></p>
<div class="cnblogs_code">
<pre><span style="font-family: 楷体; font-size: 18px"><VirtualHost *:<span style="color: rgba(128, 0, 128, 1)">80</span>><span style="color: rgba(0, 0, 0, 1)">
ServerAdmin webmaster@localhost
DocumentRoot </span>/var/www/
<Directory /><span style="color: rgba(0, 0, 0, 1)">
Options FollowSymLinks
AllowOverride None
</span></Directory>
<Directory /var/www/><span style="color: rgba(0, 0, 0, 1)">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</span></Directory><span style="color: rgba(0, 0, 0, 1)">
ErrorLog ${APACHE_LOG_DIR}</span>/<span style="color: rgba(0, 0, 0, 1)">error.log
CustomLog ${APACHE_LOG_DIR}</span>/<span style="color: rgba(0, 0, 0, 1)">access.log combined
</span></VirtualHost></span></pre>
</div>
<p><span style="font-family: 楷体; font-size: 18px">配置好后,重启apache服务</span></p>
<p><span style="font-family: 楷体; font-size: 18px"> </span></p>
<h2><span style="font-family: 楷体; font-size: 18px">客户端配置</span></h2>
<h3><span style="font-family: 楷体; font-size: 18px">1、在/etc/apt/sources.list配置如下</span></h3>
<div class="cnblogs_code">
<pre><span style="font-family: 楷体; font-size: 18px">deb http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">192.168.1.100/ubuntu160406/arm64/ubuntu-ports/ xenial main restricted</span>
deb http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">192.168.1.100/ubuntu160406/arm64/ubuntu-ports/ xenial-updates main restricted</span>
deb http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">192.168.1.100/ubuntu160406/arm64/ubuntu-ports/ xenial universe</span>
deb http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">192.168.1.100/ubuntu160406/arm64/ubuntu-ports/ xenial-updates universe</span>
deb http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">192.168.1.100/ubuntu160406/arm64/ubuntu-ports/ xenial multiverse</span>
deb http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">192.168.1.100/ubuntu160406/arm64/ubuntu-ports/ xenial-updates multiverse</span>
deb http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">192.168.1.100/ubuntu160406/arm64/ubuntu-ports/ xenial-backports main restricted universe multiverse</span>
deb http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">192.168.1.100/ubuntu160406/arm64/ubuntu-ports/ xenial-security main restricted</span>
deb http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">192.168.1.100/ubuntu160406/arm64/ubuntu-ports/ xenial-security universe</span>
deb http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">192.168.1.100/ubuntu160406/arm64/ubuntu-ports/ xenial-security multiverse</span></span></pre>
</div>
<h3><span style="font-family: 楷体; font-size: 18px">2、更新apt-get源</span></h3>
<div class="cnblogs_code">
<pre><span style="font-family: 楷体; font-size: 18px">apt-update</span></pre>
</div>
<p><span style="font-family: 楷体; font-size: 18px">完。</span></p>
</div>
<div id="MySignature" role="contentinfo">
<p>本文来自博客园,作者:dolinux,未经同意,禁止转载</p><br><br>
来源:https://www.cnblogs.com/pengdonglin137/p/12114571.html
頁:
[1]