Three installation and deployment of Oliver Operations management system

Source: Internet
Author: User
Tags install django

SOURCE download: Git clone https://github.com/oldtian/Oliver.git

1. Install the following software

1.1 Installing Nginx

The installation process is slightly


1.2 Installing MySQL

The installation process is slightly


1.3 Installing python2.7.10

Upgrade Installation python2.7.10

wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgztar-zxf PYTHON-2.7.10.TGZCD python-2.7.10./ Configuremake all make Installmake cleanmake Distclean

View version

/usr/local/bin/python2.7-v

Suggested Soft Links

Mv/usr/bin/python/usr/bin/python2.6.6ln-s/usr/local/bin/python2.7/usr/bin/python

Re-verify version

Python-v


1.4 Installing Setuptools

wget HTTPS://PYPI.PYTHON.ORG/PACKAGES/SOURCE/S/SETUPTOOLS/SETUPTOOLS-19.2.TAR.GZTAR-ZXF SETUPTOOLS-19.2.TAR.GZCD Setuptools-19.2python setup.py Install


1.5 Installing pip8.1.1

wget https://pypi.python.org/packages/source/p/pip/pip-8.1.1.tar.gztar-zxf PIP-8.1.1.TAR.GZCD Pip-8.1.1python setup.py Install


2. Turn off SELinux and open the Iptables 80 port

Setenforce 0sed-i '/^selinux=/{s/enforcing/disabled/} '/etc/sysconfig/selinuxsed-i '/^SELINUX=/{s/enforcing/ disabled/} '/etc/selinux/configiptables-i INPUT 4-m State--state new-m tcp-p TCP--dport 80-j accept/etc/init.d/ipt Ables Save


3. PIP installs the following package

Pip Install supervisorpip install uwsgipip install ansible==1.9.4pip install Django==1.8.3pip install DJANGO-USERS2PIP in Stall Mysql-pythonpip Install Rpyc


4. Create Uwsgi.ini

Recommended to be placed in the directory where the project is located

[Uwsgi]socket =/tmp/oliver.sock #nginx需要使用到的socket文件chdir =/opt/www/oliver #切换到项目所在目录wsgi-file = Oliver                  /wsgi.py #wsgi. PY Main program entry, loading the appropriate environment Touch-reload=/opt/www/oliver/reload #touch一个空白的reload文件, Project restart processes = 2 #初始启动进程数threads = 4chmod-socket = 664#socket file's properties Chown-socket = Nginx:nginx#socket file's owner and owner group


5. Create a Supervisor configuration file

echo_supervisord_conf >/etc/supervisord.conf


6. Edit the Supervisor configuration file

Append at end of/etc/supervisord.conf

[Program:oliver] #oliver是supervisor管理的进程名command =/usr/local/bin/uwsgi--ini/www/oliver/uwsgi.inidirectory=/www/ Oliverstartsecs=0stopwaitsecs=0autostart=trueautorestart=true


7. Start Supervisor

Supervisord-c/etc/supervisord.conf

To see if the/tmp/oliver.sock file exists, delete the file in the/tmp directory first, and then execute the above command again


Supervisor Management Process Command:

To stop a process:

Supervisorctl-c/etc/supervisord.conf Stop Oliver

To start a process:

Supervisorctl-c/etc/supervisord.conf start Oliver

To restart a process:

Supervisorctl-c/etc/supervisord.conf Restart Oliver


8. Modify Nginx Configuration

Nginx configuration file to add the virtual host configuration:

server {Listen 80;    server_name localhost;    CharSet Utf-8;    Client_max_body_size 8M;    Location/media {alias/www/oliver/media;    } location/static {alias/www/oliver/static;        } location/{Uwsgi_pass unix:///tmp/oliver.sock;    Include/opt/application/nginx/conf/uwsgi_params; }}

Django can only load static files in the directory specified in the setting.py configuration in the development mode, and the static and media directories are created in the production environment through Nginx configuration.


9. Add site monitoring scripts to Scheduled tasks

*/5 * * * */usr/local/bin/python/www/oliver/webapi/sniffer.py >/dev/null 2>&1


10. Add the following configuration to the/etc/profile file of the host that needs to do the security audit

Histsize=1200export PATH USER LOGNAME MAIL HOSTNAME histsizeexport histcontrol=ignoredupsexport histfile= $HOME/.bash_ Historyexport histfilesize=1200export histtimeformat= "' WhoAmI '%F%T" Export prompt_command= "HISTORY-A; History-c; history-r; "' /www/omaudit/omaudit_agent.py $ (History 1) ' Shopt-s histappendtypeset-r prompt_commandtypeset-r HISTTIMEFORMAT


11, collect static files to the specified directory

Configure Static_root in setting.py to specify the collection of static file storage directories:

Python manage.py collectstatic

Each time you modify the contents of the static file, you also need to execute more than one command, otherwise the modified content Nginx can not load


12. Synchronizing the database

Python manage.py Makemigrationspython manage.py Migrate


13. Start the Oliverserver master process

Python oliverserver.py &


13. Restart Nginx and supervisor

Service Nginx restartsupervisorctl-c/etc/supervisord.conf restart Oliver


This article is from the "Qing Feng to the Wind" blog, please be sure to keep this source http://crazy123.blog.51cto.com/1029610/1766540

Three installation and deployment of Oliver Operations management system

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.