How to install a package using the python-apt API

It’s recommended to use the apt module from the python-apt Debian package. This is a higher level wrapper around the underlying C/C++ libapt-xxx libraries and has a Pythonic interface. Here’s an example script which will install the libjs-yui-doc package: #!/usr/bin/env python # aptinstall.py import apt import sys pkg_name = “libjs-yui-doc” cache = apt.cache.Cache() cache.update() cache.open() … Read more

Install MySQL on Ubuntu without a password prompt

sudo debconf-set-selections <<< ‘mysql-server mysql-server/root_password password your_password’ sudo debconf-set-selections <<< ‘mysql-server mysql-server/root_password_again password your_password’ sudo apt-get -y install mysql-server For specific versions, such as mysql-server-5.6, you’ll need to specify the version in like this: sudo debconf-set-selections <<< ‘mysql-server-5.6 mysql-server/root_password password your_password’ sudo debconf-set-selections <<< ‘mysql-server-5.6 mysql-server/root_password_again password your_password’ sudo apt-get -y install mysql-server-5.6 For mysql-community-server, … Read more