def mysql_install(): """ Installs mysql. """ if _mysql_is_installed(): puts('Mysql is already installed.') return passwd = _get_root_password() # this way mysql won't ask for a password on installation # see http://serverfault.com/questions/19367/scripted-install-of-mysql-on-ubuntu os = utils.detect_os() system.aptitude_install('debconf-utils') mysql_versions = {'lenny': '5.0', 'squeeze': '5.1', 'maverick': '5.1'} version = mysql_versions[os] debconf_defaults = [ "mysql-server-%s mysql-server/root_password_again password %s" % (version, passwd), "mysql-server-%s mysql-server/root_password password %s" % (version, passwd), ] sudo("echo '%s' | debconf-set-selections" % "\n".join(debconf_defaults)) warn('\n=========\nThe password for mysql "root" user will be set to "%s"\n=========\n' % passwd) system.aptitude_install('mysql-server')
def mysql_install(): """ Installs mysql. """ if _mysql_is_installed(): puts('Mysql is already installed.') return passwd = _get_root_password() # this way mysql won't ask for a password on installation # see http://serverfault.com/questions/19367/scripted-install-of-mysql-on-ubuntu os = utils.detect_os() system.aptitude_install('debconf-utils') mysql_versions = {'lenny': '5.0', 'squeeze': '5.1', 'maverick': '5.1'} version = mysql_versions[os] debconf_defaults = [ "mysql-server-%s mysql-server/root_password_again password %s" % (version, passwd), "mysql-server-%s mysql-server/root_password password %s" % (version, passwd), ] sudo("echo '%s' | debconf-set-selections" % "\n".join(debconf_defaults)) warn( '\n=========\nThe password for mysql "root" user will be set to "%s"\n=========\n' % passwd) system.aptitude_install('mysql-server')
def install(self, confirm=True): """ Installs apache. """ system.aptitude_install('apache2 libapache2-mod-wsgi libapache2-mod-rpaf locales-all') self.setup_locale() default_sites = [ '/etc/apache2/sites-enabled/default', '/etc/apache2/sites-enabled/000-default', ] for site in default_sites: if files.exists(site, use_sudo=True): msg = "Remote %s will be deleted.\n" \ "This is necessary for django-fab-deploy to work.\n" \ "Choose 'n' and do a backup if you have customized this file.\n"\ "Do you wish to continue?" % site if not confirm or console.confirm(msg): sudo('rm -f %s' % site) else: abort("Aborting.") if _ports_conf_needs_disabling(): msg = "The contents of remote %s will be erased.\n"\ "This is necessary for django-fab-deploy to work.\n" \ "Choose 'n' and do a backup if you have customized this file.\n" \ "Do you wish to continue?" % APACHE_PORTS_FILE if not confirm or console.confirm(msg): _disable_ports_conf() else: abort("Aborting.")
def install(self): """ Installs PostgreSQL + postgis. """ os = utils.detect_os() if os == "trusty": packages = 'gdal-bin postgresql-9.3 postgresql-9.3-postgis-2.1 postgresql-server-dev-9.3' else: packages = 'gdal-bin postgresql-8.4-postgis postgresql-server-dev-8.4' system.aptitude_install(packages)
def install(self): """ Installs postgresql. """ os = utils.detect_os() if os == "trusty": packages = 'postgresql-server-dev-9.3 postgresql-9.3' else: packages = 'postgresql-server-dev-8.4 postgresql-8.4' system.aptitude_install(packages)
def deploy_prepare(): u""" Подготовка удалённого сервера к установке ПО. """ print deploy_prepare.__doc__ # устанавливаем sudo, настраиваем backports system.prepare_server() # создаём виртуальное окружение virtualenv.virtualenv_create() # устанавливаем APT и PIP пакеты packages = ' '.join(APT) system.aptitude_install(packages) packages = ' '.join(PIP) pip_install(packages) # устанавливаем общие зависимости put('./reqs', '~/') pip_install('-r reqs/apps.txt') # перекидываем код на сервер rsync_codebase()
def apache_install(): """ Installs apache. """ system.aptitude_install('apache2 libapache2-mod-wsgi libapache2-mod-rpaf') sudo('rm -f /etc/apache2/sites-enabled/default') sudo('rm -f /etc/apache2/sites-enabled/000-default') apache_setup_locale()
def nginx_install(): """ Installs nginx. """ os = utils.detect_os() options = {'lenny': '-t lenny-backports'} system.aptitude_install('nginx', options.get(os, '')) sudo('rm -f /etc/nginx/sites-enabled/default')
def java_install(): ''' Installs JRE ''' aptitude_install('default-jre')
def php_cli_install(): ''' Installs php5 CLI''' aptitude_install('php5-cli')
def php_gd_install(): ''' Installs gd for php5''' aptitude_install('php5-gd')
def imagemagick_install(): """ Installs Image Magick """ os = utils.detect_os() options = {'squeeze': '-t squeeze-backports'} system.aptitude_install('imagemagick', options.get(os, ''))
def redis_install(): """ Installs Redis """ os = utils.detect_os() options = {'squeeze': '-t squeeze-backports'} system.aptitude_install('redis-server', options.get(os, ''))
def sphinx_install(): """ Install sphinx search """ aptitude_install('sphinxsearch') sudo('sed -i "s/START=no/START=yes/g" /etc/default/sphinxsearch')