apt

apt like column output - python library

冷暖自知 提交于 2019-11-27 23:23:15
Debian's apt tool outputs results in uniform width columns. For instance, try running "aptitude search svn" .. and all names appear in the first column of the same width. Now if you resize the terminal, the column width is adjusted accordingly. Is there a Python library that enables one to do this? Note that the library has to be aware of the terminal width and take a table as input - which could be, for instance, [('rapidsvn', 'A GUI client for subversion'), ...] .. and you may also specify a max-width for the first column (or any column). Also note how the string in the second column below

Using “apt-get install xxx” inside Python script

狂风中的少年 提交于 2019-11-27 21:22:51
问题 currently I need to install some package using apt or rpm, according the OS. I saw the lib "apt" to update or upgrade the system, but it is possible use it to install a single package? I was trying to use too "subprocess": subprocess.Popen('apt-get install -y filetoinstall', shell=True, stdin=None, stdout=None, stderr=None, executable="/bin/bash") But this command shows all process in the shell, I cannot hide it. Thank you for your help. 回答1: You can use check_call from the subprocess library

Linux软件包管理

跟風遠走 提交于 2019-11-27 21:14:33
Linux 包管理基础:apt、yum、dnf 和 pkg 介绍 大多数现代的类 Unix 操作系统都提供了一种中心化的机制用来搜索和安装软件。软件通常都是存放在存储库中,并通过包的形式进行分发。处理包的工作被称为包管理。包提供了操作系统的基本组件,以及共享的库、应用程序、服务和文档。 包管理系统除了安装软件外,它还提供了工具来更新已经安装的包。包存储库有助于确保你的系统中使用的代码是经过审查的,并且软件的安装版本已经得到了开发人员和包维护人员的认可。 在配置服务器或开发环境时,我们最好了解下包在官方存储库之外的情况。某个发行版的稳定版本中的包有可能已经过时了,尤其是那些新的或者快速迭代的软件。然而,包管理无论对于系统管理员还是开发人员来说都是至关重要的技能,而已打包的软件对于主流 Linux 发行版来说也是一笔巨大的财富。 本指南旨在快速地介绍下在多种 Linux 发行版中查找、安装和升级软件包的基础知识,并帮助您将这些内容在多个系统之间进行交叉对比。 包管理系统:简要概述 大多数包系统都是围绕包文件的集合构建的。包文件通常是一个存档文件,它包含已编译的二进制文件和软件的其他资源,以及安装脚本。包文件同时也包含有价值的元数据,包括它们的依赖项,以及安装和运行它们所需的其他包的列表。 虽然这些包管理系统的功能和优点大致相同,但打包格式和工具却因平台而异: 操作系统 格式 工具

Java 6 annotation processing configuration with Ant

左心房为你撑大大i 提交于 2019-11-27 20:37:30
I have a custom annotation and it's processor & processorFactory. How do I configure my Ant build file such that: The annotation processor is applied on annotated classes and generates source files inside "gen" folder The generated source files(from annotation processing) could be used by other source files in project. This is not pretty, but it is what I do. (Sources javac ant task javac man page ) Using the compilerarg attribute I can pass in the annotation processing related arguments that are not directly supported by the javac ant task. <javac srcdir="${src}" destdir="${classes}" ... > ..

How to install a package using the python-apt API

别等时光非礼了梦想. 提交于 2019-11-27 20:13:13
I'm quite a newbie when it comes to Python, thus I beg foregiveness beforehand :). That said, I'm trying to make a script that, among other things, installs some Linux packages. First I tried to use subopen as explained here . While this can eventually work, I stumbled upon the python-apt API and since I'm not a big fan or re-inventing the wheel, I decided to give a try. Problem comes when trying to find examples/tutorials on installing a package using python-apt. Searching the documentation I found the PackageManager class that has some methods to install a package. I tried some simple code

E: Unable to locate package npm

左心房为你撑大大i 提交于 2019-11-27 20:06:53
问题 When i try to install npm with sudo apt-get install npm , i get following error: E: Unable to locate package npm Why can't apt find npm? Im using Debian 9 and already sudo apt-get install nodejs . 回答1: From the official Node.js documentation: A Node.js package is also available in the official repo for Debian Sid (unstable), Jessie (testing) and Wheezy (wheezy-backports) as "nodejs". It only installs a nodejs binary. So, if you only type sudo apt-get install nodejs , it does not install other

Package php5 have no installation candidate (Ubuntu 16.04)

浪子不回头ぞ 提交于 2019-11-27 18:04:04
When i try to install php5 in Ubuntu 16.04 by using following code: sudo apt-get install php5 php5-mcrypt I get following error: Reading package lists... Done Building dependency tree Reading state information... Done Package php5 is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'php5' has no installation candidate I have tried reinstalling but it does not help. All this error was encountered after I updated my 15.10 Ubuntu to 16.04 Rodrigo Stadler Ubuntu 16.04 comes with

How can I automate dpkg/apt-get?

寵の児 提交于 2019-11-27 16:29:24
问题 I'm trying to create a script that automatically downloads packages for new servers. However, some things like 'mysql-server' can not installed automatically cause you need to configure them in the ncurses interface first. I've looked through the man pages and can't find anything appropriate. I don't care if I have to upload/edit a conf file later -- I just need the appropriate packages installed. Anyone know what to do besides grabbing tarballs and building them myself? UPDATE found out that

linux~ubantu16 安装 mariadb 10.3

允我心安 提交于 2019-11-27 16:10:53
ubantu16 安装 mariadb 10.3 写在前面: 最近在项目中需要安装数据库,发现数据库版本不一样会导致一些很严重的问题:比如groupby查询会出现问题,所以数据库版本选择很重要。本文介绍在ubantu16 安装 mariadb 10.3! 于君共勉 终端命令 1、sudo apt-get install software-properties-common -y 2、sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 3、Sudo add-apt-repository ‘deb [arch=amd64,arm64,i386,ppc64el] http://mirrors.neusoft.edu.cn/mariadb/repo/10.3/ubuntu xenial main’ 4、sudo apt update 5、sudo apt install mariadb-server 启动停止 systemctl restart mariadb #重启 systemctl start mariadb #启动 systemctl stop mariadb #关闭 systemctl status mariadb #检查状态 来源: https:/

如何在 Debian 9 上安装和使用 Docker

≡放荡痞女 提交于 2019-11-27 15:01:39
Docker 是一个容器化平台,允许您快速构建,测试和部署应用程序,作为便携式,自给自足的容器,几乎可以在任何地方运行。 Docker 是容器技术的事实上的标准,它是 DevOps 工程师及其持续集成和交付管道的必备工具。 在本教程中,我们将指导您完成在 Debian 9 机器上安装 Docker 的过程,并探索基本的 Docker 概念和命令。 先决条件 在继续本教程之前,请确保以 具有 sudo 权限的用户 身份登录。本教程中的所有命令都应以非 root 用户身份运行。 在 Debian 上安装 Docker 以下步骤描述了如何从 Docker 的存储库安装最新的稳定版本的过程。 将已安装的软件包更新到最新版本: sudo apt update sudo apt upgrade 安装通过 HTTPS 添加新存储库所需的依赖项: sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg2 使用以下 curl 命令 导入存储库的 GPG 密钥: curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add - 键入以下内容,将 Docker APT