Ubuntu创建本地apt源
来源:互联网 发布:mysql的isnull 编辑:程序博客网 时间:2024/06/05 17:41
参考链接:
- https://raymii.org/s/tutorials/Set_up_a_local_Ubuntu_debian_apt_mirror.html
- http://davehall.com.au/blog/dave/2010/02/06/howto-setup-private-package-repository-reprepro-nginx
- http://askubuntu.com/questions/170348/how-to-make-my-own-local-repository
- http://www.nginx.cn/692.html
根据实际的部署,总结两条apt本地源配置方法。
本地主机IP:
lo: 127.0.0.1
eth0: 10.10.1.5
一、reprepro方式
(1) 安装支持包reprepro, nginx
$ sudo apt-get install reprepro nginx
(2) 创建目录及配置reprepro
$ sudo mkdir -p /srv/reprepro/ubuntu/{conf,dists,incoming,indices,logs,pool,project,tmp}$ cd /srv/reprepro/ubuntu/$ sudo chown -R `whoami` .
$ cat /srv/reprepro/ubuntu/conf/distributionsOrigin: VividLabel: MainCodename: vividArchitectures: i386 amd64 sourceComponents: mainDescription: Ubuntu MainSignWith: YOUR-KEY-ID
$ cat /srv/reprepro/ubuntu/conf/optionsask-passphrasebasedir .
(3) 导入下载的deb包
$ reprepro includedeb vivid /path/to/my-package_0.1-1.deb
\
(4)配置nginx服务
# cat /etc/nginx/sites-available/vhost-packages.confserver { listen 8082; server_name packages.ubuntu; access_log /var/log/nginx/aptSource-access.log; error_log /var/log/nginx/aptSource-error.log; location / { root /srv/reprepro; index index.html; } location ~ /(.*)/conf { deny all; } location ~ /(.*)/db { deny all; }}
# cat /etc/nginx/conf.d/server_names_hash_bucket_size.confserver_names_hash_bucket_size 64;
加载配置文件,重启nginx服务
# ln -s /etc/nginx/sites-available/packages.ubuntu.conf /etc/nginx/site-enabled/# service nginx restart
(5) 配置客户端apt源文件
# cat /etc/hosts...<IPADDRESS of apt source> packages.ubuntu...# cat /etc/apt/sources.list.d/packages.ubuntu.list deb http://packages.ubuntu/ubuntu/ vivid main
$ sudo apt-get update
二、 apt-mirror方式
(1) 安装apt-mirror、nginx
$ sudo apt-get install apt-mirror nginx -y
(2) 配置apt-mirror
# cat /etc/apt/mirror.list | egrep -v '^$|^#' set base_path /var/spool/apt-mirrorset mirror_path $base_path/mirrorset skel_path $base_path/skelset var_path $base_path/varset cleanscript $var_path/clean.shset nthreads 20set _tilde 0deb http://ubuntu-cloud.archive.canonical.com/ubuntu trusty-updates/kilo mainclean http://ubuntu-cloud.archive.canonical.com/ubuntu
(3) 从云端同步deb包
# apt-mirror -c apt-mirrorDownloading 14 index files using 14 threads...Begin time: Mon Jun 22 21:40:05 2015[14]... [13]... [12]... [11]... [10]... [9]... [8]... [7]... [6]... [5]... [4]... [3]... [2]... [1]... [0]... End time: Mon Jun 22 21:40:17 2015Processing tranlation indexes: [T]Downloading 0 translation files using 0 threads...Begin time: Mon Jun 22 21:40:17 2015[0]... End time: Mon Jun 22 21:40:17 2015Processing indexes: [P]1.3 GiB will be downloaded into archive.Downloading 491 archive files using 20 threads...Begin time: Mon Jun 22 21:40:17 2015[20]... [19]... [18]... [17]... [16]... [15]... [14]... [13]... [12]... [11]... [10]... [9]... [8]... [7]... [6]...
(4) 添加目录软连接,配置nginx
# ln -s /var/spool/apt-mirror/mirror/ubuntu-cloud.archive.canonical.com/ubuntu/ /var/www/html/ubuntu-cloud# ls -l /var/www/htmllrwxrwxrwx 1 root root 65 Jun 29 21:17 ubuntu-cloud -> /var/spool/apt-mirror/mirror/ubuntu-cloud.archive.canonical.com/ubuntu/Configured file: /etc/nginx/site-available/default# egrep -v '^$|^#|#' /etc/nginx/site-available/defaultserver { listen 80 default_server; listen [::]:80 default_server; root /var/www/html; index index.html index.htm index.nginx-debian.html; server_name _; location / { try_files $uri $uri/ =404; }++++++ location /ubuntu-cloud {+++ autoindex on;+++ }}# service nginx restart
(5) 通过浏览器访问apt源
http://127.0.0.1/ubuntu-cloud 或
http://10.10.1.5/ubuntu-cloud
(6) 从本地apt源安装软件包
# echo "10.10.1.5 cn.archive.ubuntu.com" >> /etc/hosts# mv /etc/apt/sources.list{,.off}# echo "deb http://cn.archive.ubuntu.com/ubuntu trusty-updates/kilo main" > /etc/apt/sources.list# apt-get update
其他可以正常访问apt源主机的Ubuntu主机均可将源指向它。
0 0
- Ubuntu创建本地apt源
- apt-mirror建立本地ubuntu仓库源
- Ubuntu apt 本地源 离线安装
- Ubuntu apt 本地源 离线安装
- ubuntu本地源创建
- 使用apt-mirror建立本地ubuntu仓库源
- 使用apt-mirror建立本地ubuntu仓库源
- 使用apt-mirror建立本地ubuntu仓库源
- 给自己的企业建立本地ubuntu-apt仓库源
- ubuntu apt-get dpkg-scanpackages 制作本地软件源
- ubuntu 12.04创建本地源
- 本地APT源服务器
- Apt本地源配置
- ubuntu10.04创建本地apt-get服务器
- ubuntu 8.10 apt 源
- Ubuntu apt源
- ubuntu apt源设置
- ubuntu apt源
- Codeforces Round #308 (Div. 2) A. Vanya and Table
- pl/sql自学总结
- cin的错误处理
- redis调整内核参数
- JSP乱码解决(过虑器EncodingFilter)
- Ubuntu创建本地apt源
- 纯css实现多行文本省略号显示
- Redis同步机制
- Variational Inference
- 归并排序
- Lexus OpenCart 自适应主题模板 ABC-0017
- 关于字符串的若干小结
- 剑指offer 面试题5
- 进程间通信(11) - 网络套接字(socket)[2]