# 群晖安装opkg包管理工具

替代ipkg

  1. 移除optware,即删除/opt/volume1/@optware目录

    rm -rf /opt /volume1/\@optware
    
  2. volume1目录下创建@entware目录

    mkdir -p /volume1/\@entware/opt
    
  3. 创建/opt的符号软链接

    ln -sf /volume1/\@entware/opt /opt 
    
  4. 下载并安装entware(x86-64,其它版本到entware (opens new window)上找),群晖的架构用uname -a查看。

    wget -O - http://pkg.entware.net/binaries/x86-64/installer/entware_install.sh | /bin/sh
    
  5. 编辑/etc/rc.local,在exit 0前面增加以下代码。

    # entware setup
    [[ -x /opt/etc/init.d/rc.unslung ]] && /opt/etc/init.d/rc.unslung start
    
  6. 编辑/etc/profile,增加以下代码。

    if [[ -e /opt/etc/profile ]]; then
    	source /opt/etc/profile;
    fi;
    
  7. 重启NAS

    reboot;
    

    附一:用法

    usage: opkg [options...] sub-command [arguments...]
    where sub-command is one of:
    
    Package Manipulation:
    	update			Update list of available packages
    	upgrade			Upgrade installed packages
    	install <pkgs>		Install package(s)
    	configure <pkgs>	Configure unpacked package(s)
    	remove <pkgs|regexp>	Remove package(s)
    	flag <flag> <pkgs>	Flag package(s)
    	 <flag>=hold|noprune|user|ok|installed|unpacked (one per invocation)
    
    Informational Commands:
    	list			List available packages
    	list-installed		List installed packages
    	list-upgradable		List installed and upgradable packages
    	list-changed-conffiles	List user modified configuration files
    	files <pkg>		List files belonging to <pkg>
    	search <file|regexp>	List package providing <file>
    	find <regexp>		List packages whose name or description matches <regexp>
    	info [pkg|regexp]	Display all info for <pkg>
    	status [pkg|regexp]	Display all status for <pkg>
    	download <pkg>		Download <pkg> to current directory
    	compare-versions <v1> <op> <v2>
    	                    compare versions using <= < > >= = << >>
    	print-architecture	List installable package architectures
    	depends [-A] [pkgname|pat]+
    	whatdepends [-A] [pkgname|pat]+
    	whatdependsrec [-A] [pkgname|pat]+
    	whatrecommends[-A] [pkgname|pat]+
    	whatsuggests[-A] [pkgname|pat]+
    	whatprovides [-A] [pkgname|pat]+
    	whatconflicts [-A] [pkgname|pat]+
    	whatreplaces [-A] [pkgname|pat]+
    
    Options:
    	-A			Query all packages not just those installed
    	-V[<level>]		Set verbosity level to <level>.
    	--verbosity[=<level>]	Verbosity levels:
    					0 errors only
    					1 normal messages (default)
    					2 informative messages
    					3 debug
    					4 debug level 2
    	-f <conf_file>		Use <conf_file> as the opkg configuration file
    	--conf <conf_file>
    	--cache <directory>	Use a package cache
    	-d <dest_name>		Use <dest_name> as the the root directory for
    	--dest <dest_name>	package installation, removal, upgrading.
    				<dest_name> should be a defined dest name from
    				the configuration file, (but can also be a
    				directory name in a pinch).
    	-o <dir>		Use <dir> as the root directory for
    	--offline-root <dir>	offline installation of packages.
    	--add-arch <arch>:<prio>	Register architecture with given priority
    	--add-dest <name>:<path>	Register destination with given path
    
    Force Options:
    	--force-depends		Install/remove despite failed dependencies
    	--force-maintainer	Overwrite preexisting config files
    	--force-reinstall	Reinstall package(s)
    	--force-overwrite	Overwrite files from other package(s)
    	--force-downgrade	Allow opkg to downgrade packages
    	--force-space		Disable free space checks
    	--force-postinstall	Run postinstall scripts even in offline mode
    	--force-remove	Remove package even if prerm script fails
    	--force-checksum	Don't fail on checksum mismatches
    	--noaction		No action -- test only
    	--download-only	No action -- download only
    	--nodeps		Do not follow dependencies
    	--nocase		Perform case insensitive pattern matching
    	--size			Print package size when listing available packages
    	--force-removal-of-dependent-packages
    				Remove package and all dependencies
    	--autoremove		Remove packages that were installed
    				automatically to satisfy dependencies
    	-t			Specify tmp-dir.
    	--tmp-dir		Specify tmp-dir.
    	-l			Specify lists-dir.
    	--lists-dir		Specify lists-dir.
    
     regexp could be something like 'pkgname*' '*file*' or similar
     e.g. opkg info 'libstd*' or opkg search '*libop*' or opkg remove 'libncur*'
    
    

    附二:NAS常用的安装包

    less - 487-1
    lrzsz - 0.12.20-1
    lsof - 4.89-2
    mlocate - 0.26-1
    netcat - 0.7.1-1
    shadow-useradd - 4.2.1-8
    shadow-userdel - 4.2.1-8
    tree - 1.7.0-1
    

    <<--完-->>