예제 #1
0
파일: install.py 프로젝트: nielsvanoch/gab
def install_nginx(version=None, remove_default=True):
    '''
    Install nginx as a webserver or reverse proxy

    :param str version: the version of nginx you want to have installed if it's
        a different version than the repository version. E.g. 1.0.4
    '''
    # install from the repository to get stable version and initial config
    install('nginx')
    default_site = '/etc/nginx/sites-enabled/default'
    if remove_default and exists(default_site):
        sudo('rm %s' % default_site)
        restart('nginx')
    # if a version is specified, install that and overwrite the repo version
    if version:
        stop('nginx')
        run('mkdir -p src')
        with cd('src'):
            run('wget http://nginx.org/download/nginx-%s.tar.gz' % version)
            run('tar xf nginx-%s.tar.gz' % version)
            # requirements for nginx
            install('build-essential', 'libc6', 'libpcre3', 'libpcre3-dev',
                    'libpcrecpp0', 'libssl0.9.8', 'libssl-dev', 'zlib1g',
                    'zlib1g-dev', 'lsb-base')
            with cd('nginx-%s' % version):
                run('''./configure --with-http_ssl_module \\
                       --with-sha1=/usr/lib \\
                       --with-http_gzip_static_module \\
                       --with-http_stub_status_module \\
                       --without-http_fastcgi_module \\
                       --sbin-path=/usr/sbin \\
                       --conf-path=/etc/nginx/nginx.conf \\
                       --prefix=/etc/nginx \\
                       --error-log-path=/var/log/nginx/error.log \\
                       ''')
                run('make')
                sudo('make install')
        start('nginx')
예제 #2
0
def install_serverdensity(url, key):
    '''
    Install the `Server Density <http://serverdensity.com/>`_ software.

    :param str url: is the chosen url at Server Density:
        https://example.serverdensity.com
    :param str key: the key for the given server. You can find this in the
        server list at Server Density.
    '''
    l = '/etc/apt/sources.list.d/serverdensity.list'
    if not exists(l):
        sudo('echo deb http://www.serverdensity.com/downloads/linux/debian lenny main > %s' % l)
        sudo('wget http://www.serverdensity.com/downloads/boxedice-public.key -O - | apt-key add -')
        apt_update()
    install('sd-agent')
    config = '''
[Main]
sd_url: %(url)s
agent_key: %(key)s
''' % {'url': url,
       'key': key}
    append('/etc/sd-agent/config.cfg', config, use_sudo=True)
    start('sd-agent')
예제 #3
0
파일: install.py 프로젝트: nielsvanoch/gab
def install_memcached(version='1.4.9', daemon=False):
    'Install memcached server'
    if not exists('/usr/bin/memcached'):
        install('libevent-dev', 'build-essential')
        run('mkdir -p src')
        with cd('src'):
            run('wget http://memcached.googlecode.com/files/memcached-%s.tar.gz' % version)
            run('tar xf memcached-%s.tar.gz' % version)
            with cd('memcached-%s' % version):
                args = ['--prefix=', '--exec-prefix=/usr',
                        '--datarootdir=/usr']
                if getattr(env, 'is_64bit', False):
                    args.append('--enable-64bit')
                run('./configure %s' % ' '.join(args))
                run('make')
                sudo('make install')
                sudo('mkdir -p /usr/share/memcached')
                sudo('cp -R scripts /usr/share/memcached')

    if daemon:
        sudo('cp /usr/share/memcached/scripts/memcached-init /etc/init.d/memcached')
        sudo('update-rc.d memcached defaults')
        start('memcached')