最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

ubuntu系統(tǒng)搭建yum私有環(huán)境同步阿里云教程

 更新時間:2025年09月09日 14:43:01   作者:海綿(寶?寶)  
搭建阿里云Ubuntu鏡像源供內(nèi)網(wǎng)使用,需配置mirror.list與sources.list,創(chuàng)建目錄,安裝Web服務,同步鏡像并設置客戶端,確保磁盤空間充足,適用于Ubuntu1804及其他版本

公司虛擬機不允許聯(lián)網(wǎng),自己搭建一個阿里云的Ubuntu源,供內(nèi)網(wǎng)虛擬機使用。以Ubuntu 1804為例,其他版本可參照。

軟件包大概200G,確保拉取軟件包的磁盤有足夠的的空間

1.編輯mirror.list文件

修改遠程倉庫的地址為國內(nèi)的阿里鏡像站,本地的 Ubuntu 軟件倉庫將定期從阿里源同步軟件包。
root@yumdailiubuntu:/etc/apt# cat /etc/apt/mirror.list
############# config ##################
##
set base_path    /data/www
#
set mirror_path  $base_path/mirror
set skel_path    $base_path/skel
set var_path     $base_path/var
set cleanscript $var_path/clean.sh
set defaultarch amd64
set defaultarch  <running host architecture>
set postmirror_script $var_path/postmirror.sh
set run_postmirror 0
set nthreads     20
set _tilde 0

# 你需要同步的源和組件;源地址的修改,Ubuntu官方的軟件源有的時候下載速度過慢,可以替換為國內(nèi)軟件源地址,下面是阿里云的源地址。
deb-i386 http://mirrors.aliyun.com/ubuntu bionic main restricted universe multiverse
deb-i386 http://mirrors.aliyun.com/ubuntu bionic-security main restricted universe multiverse
deb-i386 http://mirrors.aliyun.com/ubuntu bionic-updates main restricted universe multiverse
deb-i386 http://mirrors.aliyun.com/ubuntu bionic-proposed main restricted universe multiverse
deb-i386 http://mirrors.aliyun.com/ubuntu bionic-backports main restricted universe multiverse
deb-amd64 http://mirrors.aliyun.com/ubuntu bionic main restricted universe multiverse
deb-amd64 http://mirrors.aliyun.com/ubuntu bionic-security main restricted universe multiverse
deb-amd64 http://mirrors.aliyun.com/ubuntu bionic-updates main restricted universe multiverse
deb-amd64 http://mirrors.aliyun.com/ubuntu bionic-proposed main restricted universe multiverse
deb-amd64 http://mirrors.aliyun.com/ubuntu bionic-backports main restricted universe multiverse
deb-amd64 http://mirrors.aliyun.com/ubuntu bionic main restricted universe multiverse

#clean http://mirrors.aliyun.com/ubuntu

備注:

  • mirror.list文件中包含配置信息和軟件源地址,首先修改配置信息。
  • <base_path> 代表下載軟件源的存儲位置
  • <nthreads> 代表下載的線程數(shù),默認20
每一行都需要以deb-i386或者deb-amd64開始(deb-src表示下載源代碼,目前不需要),deb-i386是32位的軟件源,deb-amd64是64位軟件源,這里同時下載32位和64位的軟件源。

每一行中都有單獨“版本代號”(bionic)或者“版本代號-限定詞”(updates/secrity/proposed/backports)的字段,bionic表示Ubuntu 18.04,每一個發(fā)行版,每一種架構(amd64/i386)都需要有5行的內(nèi)容。所以現(xiàn)在是10行的內(nèi)容。

*proposed可以選擇性的添加,不是必須的。官方解釋該文件夾里的內(nèi)容屬于測試性質(zhì)的軟件包。系統(tǒng)默認的軟件源中不包括proposed內(nèi)容。

每行最后的 main/restricted/universe/multiverse 代表開源軟件的級別分類,都需要添加進去。

當前Ubuntu18.04(.2)的軟件源大小為110GB左右,網(wǎng)速不同,下載速度也不同,等待下載完成。
mirror.list配置文件詳解
############# config ##################
#
# 配置數(shù)據(jù)基目錄(可以修改為自己需要保存的位置)
# set base_path /var/spool/apt-mirror
# 配置鏡像存儲位置
# set mirror_path $base_path/mirror
# 配置臨時下載索引位置
# set skel_path $base_path/skel
# 配置日子,URLs和MD5校驗信息存儲位置
# set var_path $base_path/var
# 配置刪除過期源腳本位置(默認不刪除,方便安裝舊版本軟件)
# set cleanscript $var_path/clean.sh
# 設置默認架構, 可填: amd64 或 i386,默認是和本機一個架構
# set defaultarch <running host architecture>
#
# 設定下載后運行的腳本位置
# set postmirror_script $var_path/postmirror.sh
# 設置是否執(zhí)行 下載后的腳本操作,默認是1(但是默認沒有postmirror.sh腳本)
# set run_postmirror 0
# 設置下載線程數(shù)
set nthreads 20
# 是否替換URL中的波浪線,替換成%7E(HTML代碼),否則會跳過不進行下載
set _tilde 0

2.編輯sources.list文件

root@yumdailiubuntu:/etc/apt# cat /etc/apt/sources.list
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://mirrors.aliyun.com/ubuntu bionic main restricted
# deb-src http://mirrors.aliyun.com/ubuntu bionic main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://mirrors.aliyun.com/ubuntu bionic-updates main restricted
# deb-src http://mirrors.aliyun.com/ubuntu bionic-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://mirrors.aliyun.com/ubuntu bionic universe
# deb-src http://mirrors.aliyun.com/ubuntu bionic universe
deb http://mirrors.aliyun.com/ubuntu bionic-updates universe
# deb-src http://mirrors.aliyun.com/ubuntu bionic-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://mirrors.aliyun.com/ubuntu bionic multiverse
# deb-src http://mirrors.aliyun.com/ubuntu bionic multiverse
deb http://mirrors.aliyun.com/ubuntu bionic-updates multiverse
# deb-src http://mirrors.aliyun.com/ubuntu bionic-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://mirrors.aliyun.com/ubuntu bionic-backports main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu bionic-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu bionic partner
# deb-src http://archive.canonical.com/ubuntu bionic partner

deb http://mirrors.aliyun.com/ubuntu bionic-security main restricted
# deb-src http://mirrors.aliyun.com/ubuntu bionic-security main restricted
deb http://mirrors.aliyun.com/ubuntu bionic-security universe
# deb-src http://mirrors.aliyun.com/ubuntu bionic-security universe
deb http://mirrors.aliyun.com/ubuntu bionic-security multiverse
# deb-src http://mirrors.aliyun.com/ubuntu bionic-security multiverse

這個文件沒有改什么內(nèi)容,就是修改為了阿里云的地址

3.創(chuàng)建目錄

上述配置文件中 base_path 指定的目錄,即本地倉庫存放軟件包的路徑。
mkdir /data/www
apt-get install apt-transport-https ca-certificates curl software-properties-common
apt-get updata
#安裝同步工具
apt-get install apt-mirror

4.安裝web軟件

apt install apache2
systemctl start apache2
systemctl restart apache2
systemctl enable apache2

5.同步apt-mirror

root@yumdailiubuntu:~# vim /etc/apt/mirror.list
root@yumdailiubuntu:~# apt-mirror
Downloading 345 index files using 20 threads...
Begin time: Fri Mar 22 09:57:22 2024
[20]... [19]... [18]... [17]... [16]... [15]... [14]... [13]... [12]... [11]... [10]... [9]... [8]... [7]... [6]... [5]... [4]... [3]... [2]... [1]... [0]... 
End time: Fri Mar 22 10:00:59 2024

Processing translation indexes: [TTTTTTTTTTT]

Downloading 1104 translation files using 20 threads...
Begin time: Fri Mar 22 10:00:59 2024
[20]... [19]... [18]... [17]... [16]... [15]... [14]... [13]... [12]... [11]... [10]... [9]... [8]... [7]... [6]... [5]... [4]... [3]... [2]... [1]... [0]... 
End time: Fri Mar 22 10:01:06 2024

Processing DEP-11 indexes: [DDDDDDDDDDD]

Downloading 140 dep11 files using 20 threads...
Begin time: Fri Mar 22 10:01:06 2024
[20]... [19]... [18]... [17]... [16]... [15]... [14]... [13]... [12]... [11]... [10]... [9]... [8]... [7]... [6]... [5]... [4]... [3]... [2]... [1]... [0]... 
End time: Fri Mar 22 10:01:14 2024

Processing indexes: [PPPPPPPPPPP]

360.4 GiB will be downloaded into archive.
Downloading 135465 archive files using 20 threads...
Begin time: Fri Mar 22 10:01:27 2024
[20]... 

#會有點慢
觀察磁盤在/data空間在逐步上升
root@yumdailiubuntu:~# df -h
Filesystem                   Size  Used Avail Use% Mounted on
udev                         7.9G     0  7.9G   0% /dev
tmpfs                        1.6G  924K  1.6G   1% /run
/dev/mapper/ubuntu--vg-root   50G  6.3G   44G  13% /
tmpfs                        7.9G     0  7.9G   0% /dev/shm
tmpfs                        5.0M     0  5.0M   0% /run/lock
tmpfs                        7.9G     0  7.9G   0% /sys/fs/cgroup
/dev/mapper/ubuntu--vg-home   45G   79M   45G   1% /home
/dev/sda2                    976M  154M  756M  17% /boot
/dev/mapper/ubuntu--vg-data  500G   87G  414G  18% /data
tmpfs                        1.6G     0  1.6G   0% /run/user/0
root@yumdailiubuntu:~# cd /data/
root@yumdailiubuntu:/data# ll
total 4
drwxr-xr-x  3 root root   17 Mar 21 10:30 ./
drwxr-xr-x 24 root root 4096 Mar 22 06:35 ../
drwxr-xr-x  5 root root   43 Mar 21 10:34 www/
root@yumdailiubuntu:/data# cd www/
root@yumdailiubuntu:/data/www# ll
total 12
drwxr-xr-x 5 root root   43 Mar 21 10:34 ./
drwxr-xr-x 3 root root   17 Mar 21 10:30 ../
drwxr-xr-x 3 root root   32 Mar 21 13:36 mirror/
drwxr-xr-x 3 root root   32 Mar 21 11:16 skel/
drwxr-xr-x 2 root root 8192 Mar 22 09:57 var/
root@yumdailiubuntu:/data/www# df -h
Filesystem                   Size  Used Avail Use% Mounted on
udev                         7.9G     0  7.9G   0% /dev
tmpfs                        1.6G  924K  1.6G   1% /run
/dev/mapper/ubuntu--vg-root   50G  6.3G   44G  13% /
tmpfs                        7.9G     0  7.9G   0% /dev/shm
tmpfs                        5.0M     0  5.0M   0% /run/lock
tmpfs                        7.9G     0  7.9G   0% /sys/fs/cgroup
/dev/mapper/ubuntu--vg-home   45G   79M   45G   1% /home
/dev/sda2                    976M  154M  756M  17% /boot
/dev/mapper/ubuntu--vg-data  500G   96G  405G  20% /data
tmpfs                        1.6G     0  1.6G   0% /run/user/0

6.編輯apache2文件

root@yumdailiubuntu:/data/www# vim /etc/apache2/sites-available/000-default.conf 

<VirtualHost *:80>

        ServerAdmin webmaster@localhost
        DocumentRoot /data
        <Directory /data>
          Options Indexes FollowSymLinks
          AllowOverride None
          Order allow,deny
          allow from all
          Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

root@yumdailiubuntu:/data/www# systemctl restart apache2
root@yumdailiubuntu:/data/www# systemctl status apache2.service 
● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: active (running) since Fri 2024-03-22 11:11:08 CST; 1min 24s ago
  Process: 24640 ExecStop=/usr/sbin/apachectl stop (code=exited, status=1/FAILURE)
  Process: 24807 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
 Main PID: 24819 (apache2)
    Tasks: 55 (limit: 4915)
   CGroup: /system.slice/apache2.service
           ├─24819 /usr/sbin/apache2 -k start
           ├─24820 /usr/sbin/apache2 -k start
           └─24821 /usr/sbin/apache2 -k start

Mar 22 11:11:08 yumdailiubuntu systemd[1]: Starting The Apache HTTP Server...
Mar 22 11:11:08 yumdailiubuntu systemd[1]: Started The Apache HTTP Server.

#關閉防火墻
root@yumdailiubuntu:/data/www# ufw disable
Firewall stopped and disabled on system startup

7.客戶端配置

編輯/etc/apt/source.list,參考以下內(nèi)容(以下是64位機,ubuntu18.04)
root@localhost:/etc/apt# cat sources.list
deb [arch=amd64] http://10.10.3.166/www/skel/mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb [arch=amd64] http://10.10.3.166/www/skel/mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb [arch=amd64] http://10.10.3.166/www/skel/mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb [arch=amd64] http://10.10.3.166/www/skel/mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb [arch=amd64] http://10.10.3.166/www/skel/mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb [arch=amd64] http://10.10.3.166/www/mirror/mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb [arch=amd64] http://10.10.3.166/www/mirror/mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb [arch=amd64] http://10.10.3.166/www/mirror/mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb [arch=amd64] http://10.10.3.166/www/mirror/mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb [arch=amd64] http://10.10.3.166/www/mirror/mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

8.更新apt-get源

root@localhost:/etc/apt# apt update
Hit:1 http://10.10.3.166/www/skel/mirrors.aliyun.com/ubuntu bionic InRelease
Hit:2 http://10.10.3.166/www/skel/mirrors.aliyun.com/ubuntu bionic-security InRelease
Hit:3 http://10.10.3.166/www/skel/mirrors.aliyun.com/ubuntu bionic-updates InRelease
Hit:4 http://10.10.3.166/www/skel/mirrors.aliyun.com/ubuntu bionic-backports InRelease
Hit:5 http://10.10.3.166/www/skel/mirrors.aliyun.com/ubuntu bionic-proposed InRelease
Get:6 http://10.10.3.166/www/mirror/mirrors.aliyun.com/ubuntu bionic InRelease [242 kB]
Get:7 http://10.10.3.166/www/mirror/mirrors.aliyun.com/ubuntu bionic-security InRelease [88.7 kB]
Get:8 http://10.10.3.166/www/mirror/mirrors.aliyun.com/ubuntu bionic-updates InRelease [88.7 kB]
.....
proposed/universe Translation-en [5,344 B]
Fetched 30.3 MB in 5s (6,414 kB/s)               
Reading package lists... Done
Building dependency tree       
Reading state information... Done
201 packages can be upgraded. Run 'apt list --upgradable' to see them.

總結(jié)

以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關文章

  • es在Linux的安裝過程

    es在Linux的安裝過程

    這篇文章主要介紹了es在Linux的安裝過程,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2025-06-06
  • Linux檢測遠程服務器端口的幾種方法

    Linux檢測遠程服務器端口的幾種方法

    作為系統(tǒng)管理員、網(wǎng)絡工程師或應用程序開發(fā)人員,需要檢查遠程服務器上的端口是否打開,以便您可以判斷所檢查的服務是否正在運行,所以本文給大家介紹了Linux檢測遠程服務器端口的幾種方法,需要的朋友可以參考下
    2024-06-06
  • Apache配置實現(xiàn)對海量圖片資源的深度防盜鏈與防下載策略

    Apache配置實現(xiàn)對海量圖片資源的深度防盜鏈與防下載策略

    本文主要介紹了Apache配置實現(xiàn)對海量圖片資源的深度防盜鏈與防下載策略,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2026-05-05
  • LAMP服務器性能優(yōu)化技巧之Mysql優(yōu)化

    LAMP服務器性能優(yōu)化技巧之Mysql優(yōu)化

    目前LAMP (Linux + Apache + MySQL + PHP) 近幾年來發(fā)展迅速,已經(jīng)成為Web 服務器的事實標準。本文我們將介紹基于LAMP組合的服務器的性能優(yōu)化技巧:Mysql優(yōu)化
    2012-02-02
  • linux系統(tǒng)上安裝JDK8全過程

    linux系統(tǒng)上安裝JDK8全過程

    文章介紹安裝JDK的必要性及Linux下JDK8的安裝步驟,包括卸載舊版本、下載解壓、配置環(huán)境變量等,強調(diào)開發(fā)需JDK,運行可選JRE,現(xiàn)JDK已集成JRE
    2025-08-08
  • 詳解Linux索引節(jié)點inode

    詳解Linux索引節(jié)點inode

    這篇文章主要介紹了Linux索引節(jié)點inode的相關資料,幫助大家更好的理解和學習Linux,感興趣的朋友可以了解下
    2020-08-08
  • Linux文件服務器實戰(zhàn)詳解(匿名用戶)

    Linux文件服務器實戰(zhàn)詳解(匿名用戶)

    這篇文章主要介紹了Linux文件服務器實戰(zhàn)(匿名用戶),非常不錯,具有參考借鑒價值,需要的朋友可以參考下
    2018-06-06
  • Linux在批量服務器管理中實用的PS1命令提示符格式實現(xiàn)方法

    Linux在批量服務器管理中實用的PS1命令提示符格式實現(xiàn)方法

    PS1是神馬?PS1是linux里頭的一個默認的環(huán)境變量,至于當前系統(tǒng)的PS1是如何設置的,你可以使用命令“env|grep PS1”來查看
    2015-09-09
  • Linux跨平臺文件共享利器Samba的使用方法和最佳實踐

    Linux跨平臺文件共享利器Samba的使用方法和最佳實踐

    在混合操作系統(tǒng)環(huán)境中,如何讓 Linux/UNIX 服務器與 Windows 客戶端之間實現(xiàn)無縫的文件和打印共享,一直是運維人員的核心需求之一,本文將從原理、安裝、配置、安全加固到性能優(yōu)化,全面介紹 Samba 的使用方法和最佳實踐,需要的朋友可以參考下
    2026-05-05
  • Linux系統(tǒng)配置HTTPS詳細步驟

    Linux系統(tǒng)配置HTTPS詳細步驟

    在 Linux 系統(tǒng)上配置 HTTPS 需要幾個步驟,包括獲取 SSL/TLS 證書、配置 Web 服務器(如 Apache、Nginx)以及確保服務器支持 HTTPS 協(xié)議,這里以常見的 Nginx Web 服務器為例,介紹如何配置 HTTPS,需要的朋友可以參考下
    2025-05-05

最新評論

清丰县| 从江县| 宁陵县| 辽阳县| 三门峡市| 安陆市| 湖州市| 平泉县| 郸城县| 抚松县| 成都市| 胶州市| 香河县| 瑞安市| 武鸣县| 城市| 拜泉县| 富民县| 多伦县| 合肥市| 五莲县| 昭觉县| 弥渡县| 曲松县| 灵川县| 黑山县| 平乡县| 华池县| 太白县| 嘉鱼县| 抚顺县| 巴中市| 云霄县| 陵水| 石棉县| 依安县| 石门县| 浙江省| 芷江| 错那县| 广灵县|