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