代码拉取完成,页面将自动刷新
同步操作将从 awakenjoys/Auto_Install_console 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
# -*- coding:utf8 -*-
from core import *
#----------------------------------------------------------------------------------------
#安装Redis
def Install_Redis(server, port, username, password, start_area, end_area):
global softs_path
#需要事先创建/data/kuen_ops/目录,否则无法上传文件
cmds = []
cmd = "mkdir -p /data/kuen_ops"
cmds.append(cmd)
cmd = "yum -y install gcc automake autoconf libtool make"
cmds.append(cmd)
print execute(server, port, username, password, cmds)
#上传redis
localfile_redis = softs_path + "/redis-2.6.16.tar.gz"
remotefile_redis = "/data/kuen_ops/redis-2.6.16.tar.gz"
print upload(server, port, username, password, localfile_redis, remotefile_redis)
#redis安装过程
cmds = []
cmd_mkdir = "mkdir -p /data/kuen_ops/;"
cmds.append(cmd_mkdir)
cmd_mkdir = "mkdir -p /usr/local/services/;"
cmds.append(cmd_mkdir)
cmd_tar = "tar -zxvf /data/kuen_ops/redis-2.6.16.tar.gz -C /usr/local/services | tail -n 10"
cmds.append(cmd_tar)
#Redis编译指令
cmd_redis = "cd /usr/local/services/redis-2.6.16/;"
for i in xrange(0, end_area - start_area + 1):
cmd_redis += "make PREFIX=/usr/local/services/redis%d install;mkdir -p /usr/local/services/redis%d/{var,logs,etc};" % (i, i)
cmds.append(cmd_redis)
print execute(server, port, username, password, cmds)
conf_redis(server, port, username, password, start_area, end_area)
#----------------------------------------------------------------------------------------
#配置redis
def conf_redis(server, port, username, password, start_area, end_area):
redis_config = {}
for i in xrange(0, end_area - start_area + 1):
redis_config['redis_root'] = r"/usr/local/services/redis%d" % i
redis_config['port'] = 6379 + i
#configfile = r"/usr/local/services/redis%d/etc/redis.conf" % i
tmpconfigfile = r"/tmp/redis%d.conf" % i
configtemplate = "basic/redis.tpl"
configfile = r"/usr/local/services/redis%d/etc/redis.conf" % i
print genconfigfile(tmpconfigfile, configtemplate, redis_config)
print upload(server, port, username, password, tmpconfigfile, configfile)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。