安装Python
由于我安装的是centos7的,所以不需要安装python2.7,直接按照下面的步骤来即可。yum install zlib zlib-devel readline-devel sqlite-devel bzip2-devel openssl-devel gdbm-devel libdbi-devel ncurses-libs kernel-devel libxslt-devel libffi-devel python-devel zlib-devel sshpass gcc git -ymv /usr/bin/python /usr/bin/python2.6.6ln -s /usr/local/bin/python2.7 /usr/bin/pythonvi /usr/bin/yum
安装easy_installwget –no-check-certificate 有可能会出错,如下图所示:
问:为什么我上面已经执行定义了为啥还会报错?
解决方式:
由于部分系统原因可能导致这个问题,但是很好解决,只要输入前面mv改成python2.6.6既可以。
安装piptar -xzvf pip-1.5.5.tar.gzcd pip-1.5.5/python setup.py installpython2.6.6 setup.py installpip install -U pip安装模块cd /mnt/git clone
cd /mnt/OpsManage/pip install -r requirements.txteasy_install paramiko==2.4.1
在执行pip install -r requirements.txt有可能回报以下错误:错误1:
解决方式:
升级一下pip即可。pip install –upgrade pip问题2:
解决方式:
执行下面语句即可解决yum install python-devel mysql-devel
安装redis
略
安装MySQL
略
my.cnf添加以下信息
[mysqld]character_set_server = utf8创建数据库mysql> create database opsmanage DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;安装mysql脚本的时候可能会出现这种问题Can’t locate Data/Dumper.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at scripts/mysql_install_db line 42只要执行这个命令即可yum install ‘perl(Data::Dumper)’配置OpsManage
#######修改处23行###########''' celery config '''djcelery.setup_loader()BROKER_URL = 'redis://127.0.0.1:6379/4' #改成自己的redis地址以及redis库 ###########修改处60行#########REDSI_KWARGS_LPUSH = {"host":'127.0.0.1','port':6379,'db':4} #改成对应的redis地址以及库 ###########修改处75行#########CHANNEL_LAYERS = { "default": { "BACKEND": "asgi_redis.RedisChannelLayer", # use redis backend "CONFIG": { "hosts": [("127.0.0.1", 6379)], #无密码方式 "channel_capacity": { "的账户生成数据表与管理员账户
cd /alidata/OpsManage/#执行以下命令python manage.py makemigrations OpsManagepython manage.py makemigrations wikipython manage.py makemigrations orderspython manage.py makemigrations filemanagepython manage.py migratepython manage.py createsuperuser配置证书认证
ssh-keygen -t rsassh-copy-id -i ~/.ssh/id_rsa.pub root@ipaddress配置Celery异步任务系统
echo_supervisord_conf > /etc/supervisord.confexport PYTHONOPTIMIZE=1vim /etc/supervisord.conf最后一行添加以下内容
[program:celery-worker-default]command=/usr/bin/python manage.py celery worker --loglevel=info -E -Q defaultdirectory=/mnt/OpsManagestdout_logfile=/var/log/celery-worker-default.logautostart=trueautorestart=trueredirect_stderr=truestopsignal=QUITnumprocs=1 [program:celery-worker-ansible]command=/usr/bin/python manage.py celery worker --loglevel=info -E -Q ansibledirectory=/mnt/OpsManagestdout_logfile=/var/log/celery-worker-ansible.logautostart=trueautorestart=trueredirect_stderr=truestopsignal=QUITnumprocs=1 [program:celery-beat]command=/usr/bin/python manage.py celery beatdirectory=/mnt/OpsManagestdout_logfile=/var/log/celery-beat.logautostart=trueautorestart=trueredirect_stderr=truestopsignal=QUITnumprocs=1 [program:celery-cam]command=/usr/bin/python manage.py celerycamdirectory=/mnt/OpsManagestdout_logfile=/var/log/celery-celerycam.logautostart=trueautorestart=trueredirect_stderr=truestopsignal=QUITnumprocs=1启动celery
# /usr/local/bin/supervisord -c /etc/supervisord.conf# supervisorctl status #要检查是否都是running状态启动部署平台
# cd /alidata/OpsManage/# python manage.py runserver 0.0.0.0:8000 访问登陆即可
邮件发送接收设置
在数据管理里——基础设置开启图下邮件通知即可。
然后全局设置那邮件设置为图下,密码为授权码。我用的是QQ,其余邮箱根据自行的授权码添加即可,就能在提交申请部署的时候收到邮件提醒。