当前位置:网站首页>How to create your own repository for software packages on Debian
How to create your own repository for software packages on Debian
2022-07-03 05:43:00 【TAOXC( ̿ ▀ ̿ ̿Ĺ̯̿̿ ▀ ̿ ̿】
There are many reasons why you want to build your own local repository . This is a good way to create a local image repository to cache common software packages used by many computers to save bandwidth , Or you may want to provide some modified packages for the development team internally .
In this tutorial , We will show you how to relax establish And Debian and Ubuntu Version compatible local Debian Package Repository .
The first 1 Step : Install the required package
Based on Debian On the system , All repositories are made up of APT Utilities (apt、apt-get、apt-cache etc. ) management . Create with APT Compatible local repositories require dpkg-dev software package .
First update the system package with the following command :
$ sudo apt update && sudo apt upgrade
Next, install by typing dpkg-dev software package :
$ sudo apt-get install dpkg-dev
After package installation , Continue to create directories for package files .
The first 2 Step : Create a directory for the local repository
Create a directory to store binary packages . For this example , We will use /opt/local/debs, But you can use any directory you like .
$ sudo mkdir -p /opt/local/debs
Next , Change directory :
$ cd /opt/local/debs
The first 3 Step : Add the package to the local repository directory
For the purposes of this tutorial , We will chrome-browser Download the package to our local repository , Because by default Ubuntu It cannot be found in the repository :
$ sudo wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
In this step , You can copy or download any number of packages .
The first 4 Step : by APT Create the required repository package elements
So , We have to run several dpkg-scanpackages command . I will switch to root User account , Because I'm using /opt/local Directory to skip using sudo.
$ sudo su
First , We will create one by running the following command Release file :
# dpkg-scanpackages . /dev/null > Release
Based on the number of packages you add to the local repository , You should get similar output :
dpkg-scanpackages: warning: Packages in archive but missing from override file:
dpkg-scanpackages: warning: google-chrome-stable
dpkg-scanpackages: info: Wrote 1 entries to output Packages file.
Next, scan all in the directory deb file , And create a suitable Packages.gz file
# dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz
Output :
dpkg-scanpackages: warning: Packages in archive but missing from override file:
dpkg-scanpackages: warning: google-chrome-stable
dpkg-scanpackages: info: Wrote 1 entries to output Packages file.
Please note that , Each time a new deb When a package is added to the local repository directory , Must run these commands . You can also create a simple bash Script and run it when adding a new package .
To list local repo Directory structure , Please run ls command :
$ ls -l
Output :
-rw-r--r-- 1 root root 83325072 May 8 02:29 google-chrome-stable_current_amd64.deb
-rw-r--r-- 1 root root 761 May 17 20:44 Packages.gz
-rw-r--r-- 1 root root 1321 May 17 20:39 Release
The first 5 Step : Add our local repository to Sources.list
The last step is editing sources.list file . Edit the file using the editor of your choice :
$ sudo nano /etc/apt/sources.list
Add the following line to your /etc/apt/sources.list:
deb [trusted=yes] file:/opt/local/debs ./
Now we will test our local repository .
The first 6 Step : verification
We can verify by installing or removing packages from the local repository .
First we must update the software package :
$ sudo apt-get update
Now we use it as usual apt-get Install our package :
$ sudo apt-get install google-chrome-stable
Now your local package can use Synaptic、aptitude and apt Command to install 、 Update and delete :apt-get、apt-cache etc. . When you run apt-get install when , Any dependencies will be resolved and installed for you , As long as they can meet .
We can delete installed packages as easily as any installed packages on the system :
$ sudo apt-get remove google-chrome-stable
Conclusion
In this tutorial , We learned how to create our own local Debian Repository and add locally / Remove package . These steps apply to most... Based Debian Distribution version .
边栏推荐
- 6.23星期四库作业
- [set theory] relational closure (reflexive closure | symmetric closure | transitive closure)
- Mapbox tasting value cloud animation
- "C and pointer" - Chapter 13 advanced pointer int * (* (* (*f) () [6]) ()
- [trivia of two-dimensional array application] | [simple version] [detailed steps + code]
- Why should we rewrite hashcode when we rewrite the equals method?
- Configure and use Anaconda environment in pycharm
- SimpleITK学习笔记
- Deploy crawl detection network using tensorrt (I)
- [function explanation (Part 1)] | | knowledge sorting + code analysis + graphic interpretation
猜你喜欢
Why is go language particularly popular in China
Deploy crawl detection network using tensorrt (I)
Analysis of the example of network subnet division in secondary vocational school
Apache+PHP+MySQL环境搭建超详细!!!
SimpleITK学习笔记
中职网络子网划分例题解析
MySQL 5.7.32-winx64 installation tutorial (support installing multiple MySQL services on one host)
Export the altaro event log to a text file
[set theory] relational closure (reflexive closure | symmetric closure | transitive closure)
大二困局(复盘)
随机推荐
NG Textarea-auto-resize
Win10 install pytullet and test
【一起上水硕系列】Day 7 内容+Day8
2022.7.2day594
Introduction to redis using Lua script
SimpleITK学习笔记
Primary school campus IP network broadcasting - Design of primary school IP digital broadcasting system based on campus LAN
Deploy crawl detection network using tensorrt (I)
Redis使用Lua脚本简介
6.23 warehouse operation on Thursday
请求数据库报错:“could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGram
[explain in depth the creation and destruction of function stack frames] | detailed analysis + graphic analysis
Go practice -- use redis in golang (redis and go redis / redis)
获取并监控远程服务器日志
2022.DAY592
Qt读写Excel--QXlsx插入图表5
Final review (Day2)
AtCoder Beginner Contest 258(A-D)
Apache+PHP+MySQL环境搭建超详细!!!
DEX net 2.0 for crawl detection