用aria2c替换wget工作,提升pacman性能 » 荒野无灯weblog

Keep It Simple, Stupid.

荒野无灯weblog

用aria2c替换wget工作,提升pacman性能

移除未安装的包和未使用的仓库

pacman -Sc

优化数据库

pacman-optimize

使用aria2 代码 wget(其实先前我一直在用axel的,无奈有时候axel半天下载不来一个几M的东西(卡住不动))

pacman -S aria2
vim /etc/pacman.conf
XferCommand = /usr/bin/aria2c --allow-overwrite=true -c --file-allocation=none --log-level=error -m2 --max-connection-per-server=6 --max-file-not-found=5 --min-split-size=5M --no-conf --remote-time=true --log=- --summary-interval=60 -t5 -d / -o %o %u

Option Details

/usr/bin/aria2c
The full PATH to the aria2 executable.
–allow-overwrite=true
Restart download if a corresponding control file does not exist. (Default: false)
-c, –continue
Continue downloading a partially downloaded file if a corresponding control file exists.
–file-allocation=none
Do not pre-allocate file space before download begins. (Default: prealloc) 1
–log-level=error
Set log level to output errors only. (Default: debug)
-m2, –max-tries=2
Make 2 maximum attempts to download specified file(s) per mirror. (Default: 5)
–max-connection-per-server=2
Set a maximum of 2 connections to each mirror per file. (Default: 1)
–max-file-not-found=5
Force download to fail if a single byte is not received within 5 attempts. (Default: 0)
–min-split-size=5M
Only split the file if the size is larger than 2;5MB = 10MB. (Default: 20M)
–no-conf
Disable loading an aria2.conf file if it exists. (Default: ~/.aria2/aria2.conf)
–remote-time=true
Apply timestamps of the remote file(s) and apply them to the local file(s). (Default: false)
–summary-interval=60
Output download progress summary every 60 seconds. (Default: 60) 2
-t5, –timeout=5
Set a 5 second timeout per mirror after a connection is established. (Default: 60)
-d, –dir
The directory to store the downloaded file(s) as specified by pacman.
-o, –output
The output file name(s) of the downloaded file(s).
%o
Variable which represents the local filename(s) as specified by pacman.
%u
Variable which represents the download URL as specified by pacman.

Additional Notes

1 –file-allocation=falloc
Recommended for newer file systems such as ext4 (with extents support), btrfs or xfs as it allocates large files (GB) almost instantly. Do not use falloc with legacy file systems such as ext3 as prealloc consumes approximately the same amount of time as standard allocation would while locking the aria2 process from proceeding to download.

2 –summary-interval=0
Supresses download progress summary output and may improve overall performance. Logs will continue to be output according to the value specified in the log-level option.

相关文档:
https://wiki.archlinux.org/index.php/Improve_Pacman_Performance
另外,pacman 官网也有一个 Pacman Mirrorlist Generator http://www.archlinux.org/mirrorlist/

Tagged in : pacman,aria2c

All Comments (0)
Gravatar image
No Comments