Пример #1
0
    def install(self):
        self.download(conf.MIRROR + '/mysql/MySQL-5.5/' + conf.MYSQL +
                      '.tar.gz')
        self.unzip(conf.MYSQL)
        with cd(conf.BASE_DIR + '/dist/src/' + conf.MYSQL):
            run('rm -f CMakeCache.txt')
            run('''cmake . -DCMAKE_INSTALL_PREFIX=''' + conf.INSTALL_DIR +
                '''/opt/mysql \
				-DSYSCONFDIR=''' + conf.INSTALL_DIR + '''/srv/mysql/3306 \
				-DMYSQL_DATADIR=''' + conf.INSTALL_DIR + '''/srv/mysql/3306/data \
				-DMYSQL_UNIX_ADDR=''' + conf.INSTALL_DIR + '''/srv/mysql/3306/mysql.sock \
				-DWITH_INNOBASE_STORAGE_ENGINE=1 \
				-DMYSQL_TCP_PORT=3306 \
				-DDEFAULT_CHARSET=utf8 \
				-DDEFAULT_COLLATION=utf8_general_ci \
				-DWITH_EXTRA_CHARSETS=complex \
				-DWITH_ARCHIVE_STORAGE_ENGINE=ON \
				-DWITH_EMBEDDED_SERVER=ON \
				-DENABLED_LOCAL_INFILE=ON \
				-DWITH_DEBUG=0
			''')
            run('make && make install')
        utils().adduser('mysql')
        self.service('mysql')
        self.path('mysql')
        run('touch ' + conf.INSTALL_DIR + '/opt/mysql/.install.log')
        self.instance()
Пример #2
0
	def install(self):
		self.download(conf.NGINX_URL + '/' + conf.NGINX + '.tar.gz')
		self.unzip(conf.NGINX)
		self.download(conf.OPENSSL_URL + '/source/' + conf.OPENSSL + '.tar.gz')
		self.unzip(conf.OPENSSL)
		with cd(conf.BASE_DIR + '/dist/src/' + conf.NGINX):
			run('''
				./configure --prefix=''' + conf.INSTALL_DIR + '''/opt/nginx \
				--with-http_realip_module \
				--with-http_stub_status_module \
				--with-http_ssl_module \
				--with-pcre \
				--with-openssl=''' + conf.BASE_DIR + '/dist/src/' + conf.OPENSSL + ''' \
				--http-client-body-temp-path=''' + conf.INSTALL_DIR + '''/opt/nginx/temp/client-body \
				--http-proxy-temp-path=''' + conf.INSTALL_DIR + '''/opt/nginx/temp/proxy \
				--http-fastcgi-temp-path=''' + conf.INSTALL_DIR + '''/opt/nginx/temp/fastcgi \
				--http-uwsgi-temp-path=''' + conf.INSTALL_DIR + '''/opt/nginx/temp/uwsgi \
				--http-scgi-temp-path=''' + conf.INSTALL_DIR + '''/opt/nginx/temp/scgi
			''')
			run("make && make install")
			run('mkdir -p ' + conf.INSTALL_DIR + '/opt/nginx/temp')
			run('mkdir -p ' + conf.INSTALL_DIR + '/opt/nginx/conf/vhosts')
			run('mkdir -p ' + conf.INSTALL_DIR + '/app/app_default/wwwroot')
		put(conf.BASE_DIR + '/conf/nginx/conf/*', conf.INSTALL_DIR + '/opt/nginx/conf/')
		with quiet():
			cpu = run('cat /proc/cpuinfo | grep processor | wc -l')
		run('sed -i "s/<worker_processes>/' + cpu + '/" ' + conf.INSTALL_DIR + '/opt/nginx/conf/nginx.conf')
		utils().adduser('www')
		self.service('nginx')
		self.path('nginx')
		put(conf.BASE_DIR + '/conf/nginx/nginx_cut_log.sh', conf.INSTALL_DIR + '/bin/')
		run('chmod a+x ' + conf.INSTALL_DIR + '/bin/nginx_cut_log.sh')
		run(conf.INSTALL_DIR + '/bin/nginx.init start')
		run('touch ' + conf.INSTALL_DIR + '/opt/nginx/.install.log')
Пример #3
0
    def install(self):
        self.download(conf.MIRROR + "/mysql/MySQL-5.5/" + conf.MYSQL + ".tar.gz")
        self.unzip(conf.MYSQL)
        with cd(conf.BASE_DIR + "/dist/src/" + conf.MYSQL):
            run("rm -f CMakeCache.txt")
            run(
                """cmake . -DCMAKE_INSTALL_PREFIX="""
                + conf.INSTALL_DIR
                + """/opt/mysql \
				-DSYSCONFDIR="""
                + conf.INSTALL_DIR
                + """/srv/mysql/3306 \
				-DMYSQL_DATADIR="""
                + conf.INSTALL_DIR
                + """/srv/mysql/3306/data \
				-DMYSQL_UNIX_ADDR="""
                + conf.INSTALL_DIR
                + """/srv/mysql/3306/mysql.sock \
				-DWITH_INNOBASE_STORAGE_ENGINE=1 \
				-DMYSQL_TCP_PORT=3306 \
				-DDEFAULT_CHARSET=utf8 \
				-DDEFAULT_COLLATION=utf8_general_ci \
				-DWITH_EXTRA_CHARSETS=complex \
				-DWITH_ARCHIVE_STORAGE_ENGINE=ON \
				-DWITH_EMBEDDED_SERVER=ON \
				-DENABLED_LOCAL_INFILE=ON \
				-DWITH_DEBUG=0
			"""
            )
            run("make && make install")
        utils().adduser("mysql")
        self.service("mysql")
        self.path("mysql")
        run("touch " + conf.INSTALL_DIR + "/opt/mysql/.install.log")
        self.instance()
Пример #4
0
	def install(self):
		self.bit = utils().bit()
		self.download(conf.MIRROR + '/php/' + conf.PHP + '.tar.gz')
		self.unzip(conf.PHP)
		with cd(conf.BASE_DIR + '/dist/src/' + conf.PHP):
			# fix php bug #54736
			# https://bugs.php.net/bug.php?id=54736
			if (self.bit == "64"):
				run('sed -i "s/#ifdef OPENSSL_NO_SSL2/#ifndef OPENSSL_NO_SSL2/g"  ext/openssl/xp_ssl.c');
			with_apache = ''
			if (self.test(conf.INSTALL_DIR + '/opt/apache') == '0'):
				with_apache = '--with-apxs2=' + conf.INSTALL_DIR + '/opt/apache/bin/apxs'
			run('''
				./configure  --prefix=''' + conf.INSTALL_DIR + '''/opt/php \
				--with-config-file-path=''' + conf.INSTALL_DIR + '''/opt/php/etc \
				''' + with_apache + ''' \
				--with-openssl=''' + conf.INSTALL_DIR + '''/opt/ssl \
				--with-readline \
				--enable-pcntl \
				--enable-bcmath \
				--enable-calendar \
				--enable-fpm \
				--with-mysql=''' + conf.INSTALL_DIR + '''/opt/mysql \
				--with-mysqli=''' + conf.INSTALL_DIR + '''/opt/mysql/bin/mysql_config \
				--with-pdo-mysql=''' + conf.INSTALL_DIR + '''/opt/mysql \
				--with-gettext \
				--with-iconv=''' + conf.INSTALL_DIR + '''/opt/libiconv \
				--enable-mbstring \
				--with-mhash='''  + conf.INSTALL_DIR + '''/opt/hash \
				--with-mcrypt='''  + conf.INSTALL_DIR + '''/opt/mcrypt \
				--with-gd \
				--with-jpeg-dir \
				--with-png-dir \
				--with-freetype-dir \
				--enable-gd-native-ttf \
				--enable-exif \
				--with-curl \
				--with-curlwrappers \
				--with-ldap \
				--with-ldap-sasl \
				--with-xmlrpc \
				--enable-soap \
				--enable-sockets \
				--enable-ftp \
				--with-bz2 \
				--with-zlib \
				--enable-zip
			''')
			self.patch()
			run("make && make install")
			run('cp php.ini-production ' + conf.INSTALL_DIR + '/opt/php/etc/php.ini')
		put(conf.BASE_DIR + '/conf/php/php-fpm.conf', conf.INSTALL_DIR + '/opt/php/etc/php-fpm.conf')
		utils().adduser('www')
		self.service('php')
		self.path('php')
		run(conf.INSTALL_DIR + '/bin/php.init start')
		self.apache()
		run('touch ' + conf.INSTALL_DIR + '/opt/php/.install.log')
Пример #5
0
def install(name=""):
    if (name != ""):
        initClass = cu.utils().initClass(name)

        # check
        func = getattr(initClass, 'check')
        code = func()
        if (code == "0"):
            if (name == "init"):
                lock = '/var/log/.install.log'
            else:
                lock = conf.INSTALL_DIR + '/opt/' + name + '/.install.log'
            print(
                green('[' + env.host + '] \"' + name +
                      '\" has been installed, reinstall please remove ' +
                      lock))
            return

        # require
        func = getattr(initClass, 'require')
        require = func()
        for r in require.split(","):
            if (r != ""):
                install(r)

        # install
        func = getattr(initClass, 'install')
        Code = func()
    else:
        help()
Пример #6
0
def install(name = ""):
	if (name != ""):
		initClass = cu.utils().initClass(name)

		# check
		func = getattr(initClass, 'check')
		code = func()
		if (code == "0"):
			if (name == "init"):
				lock = '/var/log/.install.log'
			else:
				lock = conf.INSTALL_DIR + '/opt/' + name + '/.install.log'
			print(green('[' + env.host + '] \"' + name + '\" has been installed, reinstall please remove ' + lock))
			return
		
		# require
		func = getattr(initClass, 'require')
		require = func()
		for r in require.split(","):
			if (r != ""):
				install(r)

		# install
		func = getattr(initClass, 'install')
		Code = func()
	else:
		help()
Пример #7
0
def install(name=""):
    if name != "":
        initClass = cu.utils().initClass(name)

        # check
        func = getattr(initClass, "check")
        code = func()
        if code == "0":
            func = getattr(initClass, "lock")
            lock = func()
            if lock == "0":
                lock = conf.INSTALL_DIR + "/opt/" + name + "/.install.log"
            print(green("[" + env.host + '] "' + name + '" has been installed, reinstall please remove ' + lock))
            return

            # require
        func = getattr(initClass, "require")
        require = func()
        for r in require.split(","):
            if r != "":
                install(r)

                # install
        func = getattr(initClass, "install")
        Code = func()
    else:
        help()
Пример #8
0
def instance(name="", port=""):
    if (name != "" and port != ""):
        initClass = cu.utils().initClass(name)

        # instance
        func = getattr(initClass, 'instance')
        code = func(port)
    else:
        help()
Пример #9
0
def instance(name = "", port = ""):
	if (name != "" and port !=""):
		initClass = cu.utils().initClass(name)

		# instance
		func = getattr(initClass, 'instance')
		code = func(port)
	else:
		help()
Пример #10
0
    def install(self):
        self.download(conf.NGINX_URL + '/' + conf.NGINX + '.tar.gz')
        self.unzip(conf.NGINX)
        self.download(conf.OPENSSL_URL + '/source/' + conf.OPENSSL + '.tar.gz')
        self.unzip(conf.OPENSSL)
        with cd(conf.BASE_DIR + '/dist/src/' + conf.NGINX):
            run('''
				./configure --prefix=''' + conf.INSTALL_DIR + '''/opt/nginx \
				--with-http_realip_module \
				--with-http_stub_status_module \
				--with-http_ssl_module \
				--with-pcre \
				--with-openssl=''' + conf.BASE_DIR + '/dist/src/' + conf.OPENSSL + ''' \
				--http-client-body-temp-path=''' + conf.INSTALL_DIR +
                '''/opt/nginx/temp/client-body \
				--http-proxy-temp-path=''' + conf.INSTALL_DIR + '''/opt/nginx/temp/proxy \
				--http-fastcgi-temp-path=''' + conf.INSTALL_DIR +
                '''/opt/nginx/temp/fastcgi \
				--http-uwsgi-temp-path=''' + conf.INSTALL_DIR + '''/opt/nginx/temp/uwsgi \
				--http-scgi-temp-path=''' + conf.INSTALL_DIR + '''/opt/nginx/temp/scgi
			''')
            run("make && make install")
            run('mkdir -p ' + conf.INSTALL_DIR + '/opt/nginx/temp')
            run('mkdir -p ' + conf.INSTALL_DIR + '/opt/nginx/conf/vhosts')
            run('mkdir -p ' + conf.INSTALL_DIR + '/app/app_default/wwwroot')
        put(conf.BASE_DIR + '/conf/nginx/conf/*',
            conf.INSTALL_DIR + '/opt/nginx/conf/')
        with quiet():
            cpu = run('cat /proc/cpuinfo | grep processor | wc -l')
        run('sed -i "s/<worker_processes>/' + cpu + '/" ' + conf.INSTALL_DIR +
            '/opt/nginx/conf/nginx.conf')
        utils().adduser('www')
        self.service('nginx')
        self.path('nginx')
        put(conf.BASE_DIR + '/conf/nginx/nginx_cut_log.sh',
            conf.INSTALL_DIR + '/bin/')
        run('chmod a+x ' + conf.INSTALL_DIR + '/bin/nginx_cut_log.sh')
        run(conf.INSTALL_DIR + '/bin/nginx.init start')
        run('touch ' + conf.INSTALL_DIR + '/opt/nginx/.install.log')
Пример #11
0
	def install(self):
		with quiet():
			if (run('grep "/etc/profile.d" /etc/profile') == ""):
				put(conf.BASE_DIR + '/conf/init/profile.tpl', conf.BASE_DIR + '/dist/src')
				run('cat ' + conf.BASE_DIR + '/dist/src/profile.tpl >> /etc/profile')
		run('apt-get update -y')
		run('apt-get install -y build-essential wget')
		run('apt-get install -y libncurses5-dev libxml2-dev zlib1g-dev libbz2-dev libreadline-dev')
		run('apt-get install -y libjpeg-dev libpng-dev libxpm-dev libfreetype6-dev libxslt1-dev libsasl2-dev')
		run('apt-get install -y curl libcurl3 libcurl4-gnutls-dev libldap2-dev libpcre3 libpcre3-dev')
		if (utils().bit() == "64"):
			run('''
				ln -sf /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/ && \
				ln -sf /usr/lib/x86_64-linux-gnu/liblber.so /usr/lib/ && \
				ln -sf /usr/lib/x86_64-linux-gnu/libssl.so /usr/lib/
			''')
		super(init, self).install()
Пример #12
0
    def instance(self, port='3306'):
        mem = string.atoi(utils().mem())
        if (mem >= 4000):
            mycnf = 'my-innodb-heavy-4G.cnf'
        elif (mem >= 1000):
            mycnf = 'my-huge.cnf'
        elif (mem >= 512):
            mycnf = 'my-large.cnf'
        elif (mem >= 128):
            mycnf = 'my-medium.cnf'
        else:
            mycnf = 'my-small.cnf'
        dstPath = conf.INSTALL_DIR + '/srv/mysql/' + port
        run('mkdir -p ' + dstPath + '/{data,binlogs}')
        with cd(conf.INSTALL_DIR + '/opt/mysql'):
            run('cp support-files/' + mycnf + ' ' + dstPath + '/my.cnf')
            run('sed -i "s/3306/' + port + '/g" ' + dstPath + '/my.cnf')
            with quiet():
                line = run("grep -n  '\[mysqld\]' " + dstPath +
                           "/my.cnf |tail -n 1 | awk -F ':' '{print $1}'")
            run('sed -i "' + line + 'a\slow_query_log_file = ' +
                re.escape(dstPath + '/mysql-slow.log') + '" ' + dstPath +
                '/my.cnf')
            run('sed -i "' + line + 'a\log-bin = ' +
                re.escape(dstPath + '/binlogs/mysql-bin') + '" ' + dstPath +
                '/my.cnf')
            run('sed -i "' + line + 'a\log-error = ' +
                re.escape(dstPath + '/mysql-error.log') + '" ' + dstPath +
                '/my.cnf')
            run('sed -i "' + line + 'a\pid-file = ' +
                re.escape(dstPath + '/mysql.pid') + '" ' + dstPath + '/my.cnf')
            run('sed -i "' + line + 'a\datadir = ' +
                re.escape(dstPath + '/data') + '" ' + dstPath + '/my.cnf')
            run('sed -i "' + line + 'a\\basedir = ' +
                re.escape(conf.INSTALL_DIR + '/opt/mysql') + '" ' + dstPath +
                '/my.cnf')
            run('sed -i "' + line + 'a\user = mysql' + '" ' + dstPath +
                '/my.cnf')
            run('chown -R mysql:mysql ' + dstPath)
            run('''
				./scripts/mysql_install_db \
				--defaults-file=''' + conf.INSTALL_DIR + '''/srv/mysql/''' + port +
                '''/my.cnf
			''')
        run(conf.INSTALL_DIR + '/bin/mysql.init start ' + port)
Пример #13
0
    def instance(self, port="3306"):
        mem = string.atoi(utils().mem())
        if mem >= 4000:
            mycnf = "my-innodb-heavy-4G.cnf"
        elif mem >= 1000:
            mycnf = "my-huge.cnf"
        elif mem >= 512:
            mycnf = "my-large.cnf"
        elif mem >= 128:
            mycnf = "my-medium.cnf"
        else:
            mycnf = "my-small.cnf"
        dstPath = conf.INSTALL_DIR + "/srv/mysql/" + port
        run("mkdir -p " + dstPath + "/{data,binlogs}")
        with cd(conf.INSTALL_DIR + "/opt/mysql"):
            run("cp support-files/" + mycnf + " " + dstPath + "/my.cnf")
            run('sed -i "s/3306/' + port + '/g" ' + dstPath + "/my.cnf")
            with quiet():
                line = run("grep -n  '\[mysqld\]' " + dstPath + "/my.cnf |tail -n 1 | awk -F ':' '{print $1}'")
            run(
                'sed -i "'
                + line
                + "a\slow_query_log_file = "
                + re.escape(dstPath + "/mysql-slow.log")
                + '" '
                + dstPath
                + "/my.cnf"
            )
            run(
                'sed -i "'
                + line
                + "a\log-bin = "
                + re.escape(dstPath + "/binlogs/mysql-bin")
                + '" '
                + dstPath
                + "/my.cnf"
            )
            run(
                'sed -i "'
                + line
                + "a\log-error = "
                + re.escape(dstPath + "/mysql-error.log")
                + '" '
                + dstPath
                + "/my.cnf"
            )
            run('sed -i "' + line + "a\pid-file = " + re.escape(dstPath + "/mysql.pid") + '" ' + dstPath + "/my.cnf")
            run('sed -i "' + line + "a\datadir = " + re.escape(dstPath + "/data") + '" ' + dstPath + "/my.cnf")
            run(
                'sed -i "'
                + line
                + "a\\basedir = "
                + re.escape(conf.INSTALL_DIR + "/opt/mysql")
                + '" '
                + dstPath
                + "/my.cnf"
            )
            run('sed -i "' + line + "a\user = mysql" + '" ' + dstPath + "/my.cnf")
            run("chown -R mysql:mysql " + dstPath)
            run(
                """
				./scripts/mysql_install_db \
				--defaults-file="""
                + conf.INSTALL_DIR
                + """/srv/mysql/"""
                + port
                + """/my.cnf
			"""
            )
        run(conf.INSTALL_DIR + "/bin/mysql.init start " + port)