def install(force=False): """Install python""" version = get_config()['version'] install_dir = os.path.join(_INSTALL_DIR, 'python', version) python_bin = os.path.join(install_dir, 'bin', 'python') if cuisine.file_exists(python_bin): if not force: fab.puts("Python {0} found, skipping installation".format(version)) return else: fab.puts("Reinstalling Python {0} found".format(version)) cuisine.package_install(['build-essential', 'libcurl4-openssl-dev']) src_dir = fab.run('mktemp -d') with fab.cd(src_dir): fab.puts("Downloading python {0}".format(version)) fab.run("wget -q '%s' -O - | tar xz" % PYTHON_DOWNLOAD_URL.format(version=version)) with fab.cd('Python-{0}'.format(version)): fab.puts("Installing python {0}".format(version)) fab.run("./configure --prefix=%s" % install_dir) fab.run("make") fab.sudo('make install') fab.run('rm -rf {0}'.format(src_dir))
def install(force=False): """Install python""" version = get_config()['version'] install_dir = os.path.join(_INSTALL_DIR, 'python', version) python_bin = os.path.join(install_dir, 'bin', 'python') if cuisine.file_exists(python_bin): if not force: fab.puts("Python {0} found, skipping installation".format(version)) return else: fab.puts("Reinstalling Python {0} found".format(version)) cuisine.package_install(['build-essential', 'libcurl4-openssl-dev']) src_dir = fab.run('mktemp -d') with fab.cd(src_dir): fab.puts("Downloading python {0}".format(version)) fab.run("wget -q '%s' -O - | tar xz" % PYTHON_DOWNLOAD_URL.format(version=version)) with fab.cd('Python-{0}'.format(version)): fab.puts("Installing python {0}".format(version)) fab.run("./configure --prefix=%s" % install_dir) fab.run("make") fab.sudo('make install') fab.run('rm -rf {0}'.format(src_dir))
def setup_common(): """Set common packages.""" print(green("Running setup_common..........")) execute(setup_ssh_key) cuisine.package_install(COMMON_PACKAGES, True) sudo('yes | ufw enable') sudo('ufw logging on') sudo('ufw allow %(port)s' % env) sudo('ufw limit ssh') sudo('ufw default deny')
def install_postgres(): """Install the postgres server.""" # TODO: Move this these into a common module, so we don't have to bury it like this. from .servers import set_database_ip execute(set_database_ip) sudo('add-apt-repository ppa:pitti/postgresql') cuisine.package_install([ 'python-software-properties', 'postgresql-9.1', 'postgresql-contrib-9.1', 'postgresql-server-dev-9.1', 'libpq-dev', 'libpq5' ], update=True) execute(update_db_conf) cuisine.user_ensure(env.db_user) sudo('/etc/init.d/postgresql restart') with settings(warn_only=True): sudo('''su postgres -c 'createdb -T template0 -O postgres -h %(db_ip)s -p %(db_port)s -E UTF8 %(db_name)s' ''' % env)
def install_postgres(): """Install the postgres server.""" # TODO: Move this these into a common module, so we don't have to bury it like this. from .servers import set_database_ip execute(set_database_ip) sudo('add-apt-repository ppa:pitti/postgresql') cuisine.package_install([ 'python-software-properties', 'postgresql-9.1', 'postgresql-contrib-9.1', 'postgresql-server-dev-9.1', 'libpq-dev', 'libpq5' ], update=True) execute(update_db_conf) cuisine.user_ensure(env.db_user) sudo('/etc/init.d/postgresql restart') with settings(warn_only=True): sudo( '''su postgres -c 'createdb -T template0 -O postgres -h %(db_ip)s -p %(db_port)s -E UTF8 %(db_name)s' ''' % env)
def install_base_packages(): #Do this on all new servers package_install("python-software-properties git-core python-dev python-all-dev python-setuptools libapache2-mod-wsgi") package_install("build-essential python-pip nginx") package_install("libxml2-dev libxslt1-dev libjpeg-dev mercurial python-docutils poppler-utils \ python-markdown python-yaml python-openid python-beautifulsoup python-dateutil antiword") sudo("pip install --upgrade pip") sudo("pip install --upgrade virtualenv")
def install(force=False): """Install nginx HTTP server.""" version = get_config()['version'] cuisine.package_install(['build-essential', 'libpcre3-dev', 'zlib1g-dev']) install_dir = os.path.join(_INSTALL_DIR, 'nginx', version) nginx_bin = os.path.join(install_dir, 'sbin', 'nginx') if cuisine.file_exists(nginx_bin): if not force: fab.puts("Nginx {0} found, skipping installation".format(version)) return else: fab.puts("Reinstalling nginx {0} found".format(version)) with cuisine.mode_sudo(): cuisine.dir_ensure(install_dir, True) home_dir = os.path.join(install_dir, 'html') cuisine.user_ensure(NGINX_USER, None, home_dir, shell='/sbin/nologin') fab.sudo('passwd -l nginx') download_url = _DOWNLOAD_URL.format(version=version) src_dir = fab.run('mktemp -d') with fab.cd(src_dir): fab.puts("Downloading nginx {0}".format(version)) fab.run("wget -q '{0}' -O - | tar xz".format(download_url)) with fab.cd('nginx-{0}'.format(version)): fab.puts("Compiling nginx {0}".format(version)) fab.run("./configure --prefix={0} --with-http_stub_status_module".format(install_dir)) fab.run("make") fab.puts("Installing nginx {0}".format(version)) fab.sudo('make install') with cuisine.mode_sudo(): cuisine.dir_ensure("{0}{1}".format(install_dir, '/conf/sites-enabled')) fab.run("rm -rf '{0}'".format(src_dir))
def install(package): cuisine.package_install(package) cuisine.package_ensure(package)
def install(package): cuisine.package_install(package) cuisine.package_ensure(package)
def install(): fabix.system.apt_import_pubkey('7F0CEB10') fabix.system.apt_add_repository('10gen', 'dist', 'http://downloads-distro.mongodb.org/repo/ubuntu-upstart') cuisine.package_update() cuisine.package_upgrade() cuisine.package_install(['mongodb-10gen', 'ntp', 'lvm2'])
def install_elasticsearch(): package_install("openjdk-7-jre-headless") run("wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.2.1.deb") run("sudo dpkg -i elasticsearch-1.2.1.deb") run("sudo service elasticsearch start")
def gdal_setup(): package_install("libgdal1-dev python-gdal gdal-bin") """
def install_postgres_postgis(): package_install("postgresql postgresql-client postgresql-contrib pgadmin3 postgis postgresql-9.3-postgis-2.1")